Tools - Visual Studio 2015 MVC 5 Bootstrap 4.3 SQL Server 2014 Task 1 - Lets Start Create Default MVC Project - Shoppingwebsite

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 38

Tools –

Visual Studio 2015


MVC 5
Bootstrap 4.3
Sql Server 2014
TASK 1 – Lets Start
 Create default MVC project - ShoppingWebsite
 Add package for bootstrap
o Open NUGET package for bootstrap 

o Install-Package bootstrap

 Add BundleConfig.cs file to Visual Studio


o Add package –
Open nugget package  Install-Package Microsoft.AspNet.Web.Optimization
o Add BundleConfig.cs file

 Write the below code –


//this will point to all the css files within the Content folder. But will not
take of the ordering of stylesheets.
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/*.css"));

bundles.Add(new ScriptBundle("~/Script/Js")
.Include("~/Scripts/bootstrap.js",
"~/Scripts/jquery-{version}.js",
"~/Scripts/popper-utils.js",
"~/Scripts/popper.js"
));
}
 Add Controller –

Similarly, add other controllers like –


o HomeController
o LoginController
o PaymentController
o CartController

 Add ActionResult
o HomeController
 Index
 SearchProduct
 SearchProductByType
 FilterProductBySegment
 FilterProductByName
 FilterProductByCategory
 FilterProductByBrand
 FilterProductByBudget

o LoginController
 Login
 Registration
 forgetPassword
 changePassword
 edit_user_info

o PaymentController
 payPal
 payTm
 debitCard
 generateOTP

o CartController
 addProductToCart
 addNewProduct
 placeOrder
 deleteProductFrmCart
TASK 2 –
 Add Layout
o Go to View  Create Shared Folder  Add _LayouyPage.cshtml

Remove below code from layout, then layout page will look as below -
@{
Layout = null;
}
 Issue 1 – issue in _LayoutPage
o Solution 1 -
 The name 'Scripts' (or style) does not exists in the current context in
MVC
 In this case, add a code in webconfig –
<system.web.webPages.razor>
<pages>
<namespaces>
<add namespace="System.Web.Optimization"/>
</namespaces>
</pages>
</system.web.webPages.razor>

o Solution 2 –
 issue number 2 occurs after above error –
 namespace bundleconfig not exist in the current context
in Global.asax.cs file
o Solution –
 Goto to BundleConfig.cs find below code

 From the above code, just remove


.AppStart like below
Now, error will be gone –

o Solution 2 –
 It issue @Styles and @Script still persist –

 In these case –
 Solution 1 –
o Add namespace in view –

@Using System.Web.Optimization
TASK 2 –
o Add search box as in amazon.com website
o Add Home, SignIn, SignUp, Cart menu

TASK 3 – add dropdown without model


https://www.youtube.com/watch?v=c93hVSjVSWU

HOW TO IMPLEMENT REPOSITORY?


1. Step 1 – create a new project (e.g. with name Repository)
2. Step 2 – add ef package
a. Menu  Tools  NuGet package manager  Package manager
console 

3.
4. Step 3 –
 Add Entity framework
o Right click Modal folder  Add  select New Item new dialog will
appear select c# from left side menus  select ADO.Net entity
Model

o New dialog box appear  Select  ef designer from database 


press “OK”
o Click on New Connection button and
Select server and rename connection string name
as in below e.g. we rename it as RepositorySampleEntities
o Then a new dialog box will appear  where select Tables fro
database –
Note – These table must contain pk
o The above step will create .edmx file
o It will DbContext and DbSet code in Model.Context.cs file as below

o Model class also create in


o Model.tt  Customer.cs and Movie.cs
Contain model information. Each model class represent tables from
database.

o Customer.cs

5. Step 4 –
 Goto model  add DAL folder
 Right click to DAL  Add interface

 Add below code to interface –


 Also add one more class as CustomerRepo.cs

 Implement interface in class –

 Step 5 – add logic to each of these above method –


o Add DataContext to Webconfig – e.g. movieDataContext
 Step 6 – Add class in Model  DAL
name it as CustomerRepo.cs
Add below code -
namespace REpositoryPatternSample.Models.DAL
{
public class CustomerRepo : ICustomerRepository
{
private movieEntities _dataContext;

public CustomerRepo(movieEntities _dataContext)


{
this._dataContext = _dataContext;
}

public void insert(Customer cust)


{
_dataContext.Customers.Add(cust);
}
public void update(Customer cust)
{
_dataContext.Entry(cust).State = System.Data.Entity.EntityState.Modified;
}

public void delete(int cust_id)


{
Customer cust = _dataContext.Customers.Find(cust_id);
_dataContext.Customers.Remove(cust);
}

public void Save()


{
_dataContext.SaveChanges();
}

public void Dispose()


{
throw new NotImplementedException();
}

public Customer GetByCust_Id()


{
throw new NotImplementedException();
}

public IEnumerable<Customer> GetCustomer()


{
throw new NotImplementedException();
}

public void insert()


{
throw new NotImplementedException();
}

public void update()


{
throw new NotImplementedException();
}
public void delete()
{
throw new NotImplementedException();
}
}
}

 Step 7 –
o Add HomeController
o Inside HomeController add constructor –

o Add view page for Index action method like below way –
SHOPPING CART WEBSITE
OBJECTIVE –

1. Case Statement
2. Scenario
3. Actors
4.
5. What is Software project management?
6. How to plan a software? Phases in software planning?
7. Design database
1. Case Statement
Ans.:
 In this case, we will be designing a simple online shopping portal.

2. Scenario
Ans.:
 A user visits the online shopping portal.
 There are two type of user –
o Visitor –
 A user visit the page check the product, this type of user are
called as visitor.
 He cannot add product to cart. He should login first.
o Customer –
 A user visit the website,
 Check product of his insterest
 do registration
 Login to use our application
 After
 He can add product to shopping cart, and can proceed
with the buying the product online.
 While checking the product online –
o Scroll the website
o User may enters product name online
o User may select a segment  then a category  brand  Budget
o User may select the product an click on Buy  at that time if is already
login then he will taken to shopping cart page  otherwise if user had
not login then he will be taken to login page.

 Add product to shooping cart


o The multiple product can be added to cart
o The process can be repeated for more items. Once the customer
finishes selecting the product the cart can be viewed,
o if the customer wants to edit the final cart it can be done here.
o Final cart is submitted for payment and card details and address(where
shipment has to be made) are be confirmed by the customer
.Customer is confirmed with a shipment Id and delivery of goods within
15 days.

3. Actor
a. Customer
b. Admin
4. What is Software project management?
Ans.:
 Software project management is an art of planning.
 It compromise of various processes which is divided into multiple task.
Software project management ensures that each task are well coordinated in
such a way that the objective is timely completed.
 Project planning helps use to –
o Monitor project progress
o Create a documentation for software planning, tasks, approach o be
used to develop a software.

5. Explain different Phase is project planning?


Ans.:
 There are Six phases in project planning -
o Initialization
o Definition
o Design
o Development
o Implementation
o Follow Up
 Initialization phase –
o It is a first phase of project planning
o Identify business need
o Idea behind project
o Reason for developing project
o End user
o Limitations

 Definition Phase –
If initialization phase approved then we use definition phase -
o Preconditions
o Functional requirements
 A functional requirement document defines the functionality of a
system
o Operational requirements
o Design limitations

 Design phase –
o Requirement developed in definition phase is used to draw a design of
software.
o As per requirement, design are drawn using –
 Sketch
 Flow chart
 Web Site trees

 Development Phases –
o Requirement developed in design phase is used to create document
for this phase.

 Implementation Phase
o Development are actual started in this phase which involve
 Designer
 Developer
 Database manager…etc

 Follow up case –

6. Plans for Shopping Cart?


Ans.:
 Initialization –
o This website is to be build for learning purpose
o Build a basic shopping cart website using
MVC, EF, Repository pattern, SQL 2014.
 Definition –
o Preconditions –
 App must be build faster as possible
 Design is not need
 Default template is used
o Functional requirements –
 Any visitor can look at website
 Visitor can view products as per its category
 Website allows us to select category
 Product consist of electronic items like
 Mobile Phone,
 Laptop,
 TV
 On selecting a product Images its complete is displayed to user
 Price
 Size specification
 Modal specification
o Modal number
 Technical specification
o Graphics
o Screen type
o Screen resolution
o Processor
 Registration page –
 First Name
 Last name
 Address
 State
 City
 Country
 Pincode
 Landmark
 Adhar card number
 Login page –
 User and Password
 Forget Password –
 Send new password on its email id or mobile phone.
 Block user –
 Block user if trying login for 5 times,
 Block user for 24 hrs
 Duplicate user
 Check for duplicate
o email id
o mobile phone number
o Adhar card number
o Track ip address for multiple registration from
same ip address
 User add product to cart –
 Check if product available in stock
 Check if user is logged in.
 If logged in add data to its cart
 Proceed further with payment
o Ask if user want to make cash on delivery
o Or make payment online
 Payment –
 While User make –
o He had to enter to credit card information
o System verify credit card detail
o Proceed
o Deduct money from bank
 If payment successful display a message regarding successful
payment.
 MVC, EF, Repository pattern, SQL 2014, jquery, javascript.

o Operational requirements –

o Design limitations
 No Time must be spend on design Design
 Design is not need
 Default template is used
 Design
 No Time must be spend on design Design
 Development
 Implementation
 Follow Up

7. WHAT IS DFD?
Ans.:
 A data-flow diagram (DFD) is a graphical representation of the flow of a data
of a process from one component to another. The DFD also provides
information about the outputs and inputs of each entity and the process itself.
 It gives overview of system without going deep into the details of system.
E.g. -

 A data-flow diagram has no control flow, there are no decision rules and no
loops. Specific operations based on the data can be represented by
a flowchart.[1]
 Symbols used in DFD
 DFD components –
o Process –
 Process is a procedure that manipulates the data and its flow by
taking incoming data, changing it, and producing an output with
it. A process can do this by performing computations and using
logic to sort the data or change its flow of direction. Processes
usually start from the top left of the DFD and finish on the
bottom right of the diagram.
o DataStore
 Data stores hold information for later use, like a file of
documents that’s waiting to be processed. Data inputs flow
through a process and then through a data store while data
outputs flow out of a data store and then through a process.
o Data flow

 Data flow is the path the system’s information takes from


external entities through processes and data stores. With arrows
and succinct labels, the DFD can show you the direction of the
data flow.

 But before you start mapping out data flow diagram


 Each store should be given a reference letter, followed by an
arbitrary number. These reference letters are allocated as
follows:
'D' - indicates a permanent computer file
'M' - indicates a manual file
'T' - indicates a transient store, one that is deleted after
processing.

 Rules For DFD –


o Each process should have at least one input and one output.
o Each data store should have at least one data flow in and data flow
out.
o A system’s stored data must go through a process.
o All processes in a DFD must link to another process or data store.

 DFD Level –
o Level 0, Level 1, Level 3…
o Level indicate the level of information provided by diagram.
0 a simple DFD or overview of system aka Context level diagram,
1 means a more detail,
2 means even more details about and so on.

8. DFD on online shopping cart website?


Ans.:
LEVEL 0

Level 1
Add item to cart

Add product
Register and Login

E:\A. PROGRAMMING\CATEGORIES\5.Software Engineering

Simple-CaseStudy-Online-Shopping-Cart.pdf

9. WHAT IS ENTITY RELATIONSHIP DIAGRAM?


Ans.:

10. Online Shopping Cart ERD?


Ans.:

8. TABLE DESCRIPTION –
Ans.:

9. WHAT IS USE CASE DIAGRAM?


Ans.:

10. EXPLAIN USE CASE DIAGRAM?


Ans.:
PART II – Building a website
Objective –
1. Initially create a Controller –

o Action Method in controller


 HomeController
 Index()
 LoginController
 Login
 Registration
 forgetPassword
 changePassword
 edit_user_info
 CartController
 addProductToCart
 addNewProduct
 placeOrder
 deleteProductFrmCart
 PayController
 payPal
 payTm
 debitCard
 generate Otp

2. Create View
RAMSHAKAL RAMSHAKAL

You might also like