protected void Page_Load(object sender, EventArgs e) { CheckUserGroup(); SqlConnection ProgramFilesCon = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS"); SqlDataAdapter ProgramFilesAdapter = new SqlDataAdapter(); DataTable ProgramFilesTable = new DataTable(); ProgramFilesCon.Open(); string OrderID = Request.QueryString["OrderID"].ToString(); string CartID = Request.QueryString["CartID"].ToString(); if (!IsPostBack) { //Repeater SqlCommand PopulateODRepeater = new SqlCommand("select * from Cart c, Orders o, Users u WHERE c.CartID=o.CartID and u.UserID=c.UserID AND o.OrderID='" + OrderID + "'", ProgramFilesCon); ProgramFilesAdapter.SelectCommand = PopulateODRepeater; ProgramFilesAdapter.Fill(ProgramFilesTable); ProgramFilesAdapter.Dispose(); PopulateODRepeater.Dispose(); ProgramFilesCon.Close(); RepeaterOrderDetails.DataSource = ProgramFilesTable; RepeaterOrderDetails.DataBind(); //Listview SqlDataAdapter ProgramFilesAdapter2 = new SqlDataAdapter(); DataTable ProgramFilesTable2 = new DataTable(); ProgramFilesCon.Open(); //ListView DataSource SqlCommand PopulateODListView = new SqlCommand("select * from CartDetail cd, Products p where p.ProductID=cd.ProductID and cd.CartID=" + CartID + "", ProgramFilesCon); ProgramFilesAdapter2.SelectCommand = PopulateODListView; ProgramFilesAdapter2.Fill(ProgramFilesTable2); ProgramFilesAdapter2.Dispose(); PopulateODListView.Dispose(); ListViewCheckout.DataSource = ProgramFilesTable2; ListViewCheckout.DataBind(); string OrderStatus = ProgramFilesTable.Rows[0]["OrderStatus"].ToString(); switch (OrderStatus) { case "Awaiting Payment": RadioButtonListStatusOption.SelectedIndex = 0; break; case "On Process": RadioButtonListStatusOption.SelectedIndex = 1; break; case "Completed": RadioButtonListStatusOption.SelectedIndex = 2; break; } } }
protected void Page_Load(object sender, EventArgs e) { //init string s_UserID = Session["SessionUserID"].ToString(); string s_CartID = Session["SessionCartID"].ToString(); SqlConnection ProgramFilesCon = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProgramFilesDB;Data Source=ACER-PC\\SQLEXPRESS"); SqlDataAdapter ProgramFilesAdapter = new SqlDataAdapter(); DataTable ProgramFilesTable = new DataTable(); ProgramFilesCon.Open(); //ListView DataSource SqlCommand PopulateListView = new SqlCommand("select * from CartDetail cd, Products p where p.ProductID=cd.ProductID and cd.CartID=" + s_CartID + "", ProgramFilesCon); ProgramFilesAdapter.SelectCommand = PopulateListView; ProgramFilesAdapter.Fill(ProgramFilesTable); ProgramFilesAdapter.Dispose(); PopulateListView.Dispose(); //Count Number of Items SqlCommand CountNumberofItems = new SqlCommand("SELECT COUNT(cd.CartID) from Cart c, CartDetail cd, Products p where c.CartID = cd.CartID and p.ProductID=cd.ProductID and cd.CartID=" + s_CartID + "", ProgramFilesCon); string NumberOfItems = CountNumberofItems.ExecuteScalar().ToString(); LabelNumberofItems.Text = NumberOfItems; //Total Size SqlCommand CountTotalSize = new SqlCommand("select SUM(p.ProductSize) from Cart c, CartDetail cd, Products p where c.CartID = cd.CartID and p.ProductID=cd.ProductID and cd.CartID=" + s_CartID + "", ProgramFilesCon); LabelTotalSize.Text = CountTotalSize.ExecuteScalar().ToString(); //Needed CD Calculations double CDNeededRounded = Math.Ceiling((Convert.ToDouble(LabelTotalSize.Text)) / 10); LabelCDNeeded.Text = CDNeededRounded.ToString(); //CD Price double CDPrice = ((Convert.ToDouble(LabelCDNeeded.Text)) * 6000); LabelCDPrice.Text = CDPrice.ToString(); Session["CDPrice"] = LabelCDPrice.Text; LabelCDWeight.Text = (Convert.ToDouble(LabelCDNeeded.Text) * 0.125).ToString(); LabelCDWeightRounded.Text = (Math.Ceiling(Convert.ToDouble(LabelCDWeight.Text))).ToString(); Session["WeightRounded"] = LabelCDWeightRounded.Text; //Burning fee calculation double BurnFee = (Convert.ToDouble(LabelCDNeeded.Text)) * 2500; LabelBurningFee.Text = BurnFee.ToString(); Session["BurningFee"] = LabelBurningFee.Text; //Update BurningFee SqlCommand UpdateBurnFee = new SqlCommand("UPDATE Cart SET BurningFee=" + BurnFee + " WHERE CartID=" + s_CartID + "", ProgramFilesCon); UpdateBurnFee.ExecuteNonQuery(); ProgramFilesCon.Close(); ListViewCheckout.DataSource = ProgramFilesTable; ListViewCheckout.DataBind(); }