|
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.UI.WebControls;
using MVC.Models;
using NHibernate.MapClasses;
using MVC.Controllers;
public partial class Controllers_Store_checkout : System.Web.UI.Page, MVC.Views.IGeneralView
{
private MVC.Controllers.IStoreController _controller;
public delegate Order SingleOrder_delegate();
public void Alert(string message)
{
notice.Text = message;
}
protected void Page_Load(object sender, EventArgs e)
{
_controller = MVC.Factories.Factory.PointerToFactory.GetStoreController(this);
if (!IsPostBack) //on GET we need ampty Order for DS in edit mode
{
ODS_CheckOut.TypeName = _controller.GetType().FullName;
SingleOrder_delegate GiveMethodName = new SingleOrder_delegate(_controller.SingleOrder);
ODS_CheckOut.SelectMethod = GiveMethodName.Method.Name;
OrderForm.DataSourceID = ODS_CheckOut.ID;
}
}
protected void ODS_CheckOut_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
{
e.ObjectInstance = _controller; //gets current _controller instance
}
protected void ODS_CheckOut_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{
DropDownList DrDl_PayTypeList = (DropDownList)OrderForm.FindControl("PayTypeList");
string selection = DrDl_PayTypeList.SelectedItem.ToString();
e.NewValues.Add("Pay_Type", selection);
List<CartMember> SessionList =
(List<CartMember>)Session["cart"];
// we pass by ref to be sure that shopping cart is
//passed by reference
if (SessionList != null)
_controller.CreateOrder(e.NewValues, ref SessionList);
else
Alert("Error: Cart is empty!");
e.Cancel = true;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
After defending his
PhD thesis in 2005 (computational nuclear physics) at Vanderbilt in Nashville, the author decided to pursue a career in software development. As a long time open source advocate, he started with writing web applications using Linux-Apache-MySql-P (LAMP) framework. After that experience, he decided to embrace Microsoft technologies.
Currently working as a web developer in .NET platform in the online payments company.