Analysis of Asp.net MVC sample project "Suteki. Shop"-Installation

Source: Internet
Author: User

Statement: As the beginning of this series, the system will introduce some of my thoughts and experiences in studying the source code of this project.
Of course, this system is by no means the so-called "best demonstration". The usage skills or design ideas mentioned in this system are just for your practical work.
For reference, the so-called "best" and other words are "". I believe you have successfully analyzed several
After the MVC example, you will find a method or idea suitable for your team or company. In fact, we are looking for a suitable MVC display.
For example, I have spent "some time", and this example is relatively good for me (except for the few documents and instructions ).
). In addition, the project uses other frameworks or DLL files, such as castle, MvcContrib, and NVelocity.
These contents will be discussed in subsequent articles.

First, we need to explain what this is. In fact, Suteki is an online store B2C example.
Here, you can select your favorite products and purchase them through the online payment function. At the same time, it also provides a relatively complete set of management machines
Allows administrators to easily manage their product information, category information, and order information. In short, this is a relatively complete system.
Guan Suteki has not been widely installed and used, and some websites are using it. You can refer to it through this address.
Run the instance: http://sutekishop.co.uk /.

Source code of this project:
Http://code.google.com/p/sutekishop/downloads/list

BLOG about the project: http://mikehadlow.blogspot.com/search/label/Suteki%20Shop, only
Pity :(

Next we will take a look at how to install and implement a sutekishop.

First, run the SQL script in the downloaded package to generate the database and initialize the corresponding data. The SQL file is located in the Database
Create_database. SQL (create database and table) and insert_static_data (initialize data) under the folder ).
Because the author is a British, the database scripts used by the author are different from the Chinese SQL statements in China, and I am running
SQL2005 of is Chinese, so some exceptions may occur if you directly run the content in create_database. Fortunately, later I
I picked out some of the content that caused the error from create_database and found that it can be installed. So I will modify
The SQL script content is published (at the end of the article). You can download and run it to complete database installation.

Note: Some "database link strings" in the project should be replaced with our local database in batches.

Next, let's look at the final running effect :)



When you click the Login link in the lower-right corner of the page, a logon prompt box is displayed. Here we enter:

Email: admin@sutekishop.co.uk
Password: 123123


Click"SubmitQuery"Button:


In this way, we log on to the system as an administrator, and the relevant management menu will appear at the top. We can use it to create
Product category, product information, location information, User information, and so on.


 

The following describes how to create a User. Click the "User" link:

As you can see, I have created several user information, including the Administrator information "admin@sutekishop.co.uk ",
(Note: currently, the list only displays information where Role is Administrator or Order Processor)

 

Click "New User" To Go To The add User page and add the following information:
Email: test@sample.com
Password: 123123
Role: Customer

Then click "Save :)



In this way, we can log on to the front-end as this user.

Similarly, after we add information such as "Categories" and "Countries", the corresponding results are as follows:



After completing the relevant settings, you can purchase the product.

Log on to the system with the newly created test@sample.com account, click "Movie" --> "action Movie ":



We click on the movies under this category. For example, after this "brave island", we will go to the "purchase process ".


Click"Add to basket", A purchase list is displayed:


After confirming the current purchase information, we can click"Checkout"Link:

In the next payment process, you need to fill in the corresponding payment card, address and other information. This process only requires you to buy something online.
Friends should not be unfamiliar.


 

Note:Here, the logic of credit card verification may be troublesome. If you want to skip this verification, you can comment out the following code:
Suteki. Shop \ Suteki. Common \ Validation \ ValidationExtensions. cs

Public ValidationProperty <T> IsCreditCard ()
{
If (IsString)
{
Var trimmedValue = Regex. Replace (value. ToString (), "[^ 0-9]", "");

TrimmedValue. Label (label). IsNumeric (). WithLengthRange (13.To( 19 ));

Var numbers = trimmedValue. Trim (). Reverse (). Select (c => int. Parse (c. ToString ()));

Var oddSum = numbers. AtOddPositions (). Sum ();
Var doubleEvenSum = numbers. AtEvenPositions (). selectvalues (I => new [] {(I * 2) % 10, (I * 2)/10}). Sum ();

// If (oddSum + doubleEvenSum) % 10! = 0)
//{
// Throw new ValidationException (label, "{0} is not a valid credit card number". With (label ));
//}
}
Return this;
}

In this way, the detailed information is displayed after the order information is successfully submitted.



Here, the flow of the user's purchase and order is complete, but the entire business process is not over, We have to switch back to the Administrator
Identity to view and perform the corresponding operations:


Note:In this case, the system also checks the validity of your credit card information.


Well, the main business process will be introduced here.

The following is a brief introduction to the project file of the product. The product consists of four projects:
Suteki. Common: This project includes some basic function classes, extension methods, and Controller, Model, and Filter
The base class declaration (described in later articles) also includes Service interface customization and third-party plug-in extension. In addition
The corresponding ViewData base class and related ancillary type declaration.

Suteki. Common. Tests: This project is mainly for the unit test of the above Suteki. Common Project.

Suteki. Shop: This project includes the specific design and function implementation for the Controller, Model, and Filter. Service,
Specific definitions and implementations of ViewData, HtmlHelpers extensions, Repositories (CRUD) encapsulation, and Views folders.

Suteki. Shop. Tests: This project is mainly for the unit test of the above Suteki. Shop project.

Today's content is here first. In the next article, we will introduce the inheritance structure and implementation method of the Controller in this project,
For more information, see :)

SQL installation script download: http://files.cnblogs.com/daizhj/suteki_Database.rar

Link: http://www.cnblogs.com/daizhj/archive/2009/05/11/1451925.html

Author: daizhj, Dai zhenjun, LaoD

URL: http://daizhj.cnblogs.com/












Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.