private void BindGvCardDtl()//string CustId { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { int CustId = int.Parse(Session["CustId"].ToString()); var a = (from s in db.tbl_ItemListDtls join q in db.tbl_ItemQtyDtls on s.ItemId equals q.ItemId join p in db.tbl_CartDtls on s.ItemId equals p.ItemId join r in db.tbl_GrocerRateDtls on q.ItemQtyId equals r.ItemQtyId //join h in db.tbl_HomeDelChrgs on r.GrocerRateId equals h.GrocerId where p.CustomerId == CustId && p.PaymentStatus == false select new { s.Image, s.BrandName, r.OfferRate, p.Quantity, p.cartID, r.GrocerId }).ToList(); //var a = (from s in db.ShopCart(int.Parse(CustId)) select s).ToList(); GvCardDtl.DataSource = a; GvCardDtl.DataBind(); //int quantity1 = 0; //int Subtotal = 0; //for (int i = 0; i < a.Count; i++) //{ // quantity1 = quantity1 + int.Parse(a[i].Quantity.ToString()); // int total = int.Parse((a[i].Quantity * a[i].OfferRate).ToString()); // Subtotal = Subtotal + total; //} } }
private void BindGvCardDtl()//string CustId { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { int quantity1 = 0; double Subtotal = 0; double total1 = 0; if (Request.Cookies["ShoppingCart"] != null) { string objCartListString = Request.Cookies["ShoppingCart"].Value.ToString(); string[] objCartListStringSplit = objCartListString.Split('|'); dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("Image", typeof(string))); dt.Columns.Add(new DataColumn("BrandName", typeof(string))); dt.Columns.Add(new DataColumn("Quantity", typeof(string))); dt.Columns.Add(new DataColumn("OfferRate", typeof(string))); dt.Columns.Add(new DataColumn("Size", typeof(string))); dt.Columns.Add(new DataColumn("ItemId", typeof(string))); dt.Columns.Add(new DataColumn("GrocerId", typeof(string))); //dt.Columns.Add(new DataColumn("Column5", typeof(string))); //dt.Columns.Add(new DataColumn("Column6", typeof(string))); //dr = dt.NewRow(); ////dr["RowNumber"] = 1; ////dr["Image"] = string.Empty; ////dr["BrandName"] = string.Empty; ////dr["Quantity"] = string.Empty; ////dr["OfferRate"] = string.Empty; ////dr["Column5"] = string.Empty; ////dr["Column6"] = string.Empty; //dt.Rows.Add(dr); //foreach (string s in objCartListStringSplit) //{ //string fname = Request.Cookies["ShoppingCart"]["FirstName"]; //string lname = Request.Cookies["ShoppingCart"]["LastName"]; int ri = 0; foreach (string item in objCartListStringSplit) { ArrayList colCookies1 = new ArrayList(); string[] ss = item.Split(','); var BrandName = ss[0]; var Quantity = int.Parse(ss[1]); var OfferRate = Convert.ToDouble(ss[2]); var Size = ss[3]; var groserid = ss[4]; colCookies1.Add(BrandName); colCookies1.Add(Quantity); colCookies1.Add(OfferRate); colCookies1.Add(Size); colCookies1.Add(groserid); var a = (from ssss in db.tbl_ItemListDtls join c in db.tbl_ProductListDtls on ssss.ProductId equals c.ProductId where ssss.ItemId == int.Parse(BrandName.ToString()) select new { ssss.Image, ssss.BrandName, c.ProductName, ssss.ItemId, OfferRate = OfferRate, Quantity = Quantity, Size = Size, groserid = groserid }).FirstOrDefault(); if (a != null) { // DataRow drCurrentRow = null;================== //if (dt.Rows.Count > 0) //{ //drCurrentRow = dt.NewRow();======================================= dr = dt.NewRow(); //drCurrentRow["RowNumber"] = dt.Rows.Count + 1;============================== dr["RowNumber"] = dt.Rows.Count + 1; //add new row to DataTable //dt.Rows.Add(drCurrentRow);================================== dt.Rows.Add(dr); dt.Rows[ri]["Image"] = a.Image; dt.Rows[ri]["BrandName"] = a.BrandName; dt.Rows[ri]["Quantity"] = a.Quantity; dt.Rows[ri]["OfferRate"] = a.OfferRate; dt.Rows[ri]["Size"] = a.Size; dt.Rows[ri]["ItemId"] = a.ItemId; dt.Rows[ri]["GrocerId"] = a.groserid; //dt.Rows[ri]["Column5"] = ""; //dt.Rows[ri]["Column6"] = DaaieIsDelete.Text; ri = ri + 1; quantity1 = quantity1 + int.Parse(Quantity.ToString()); double total = double.Parse((Quantity * OfferRate).ToString()); total1 = total1 + total; Subtotal = Subtotal + total; lblSubTotal.Text = total1.ToString(); lblQuantity.Text = quantity1.ToString(); var ship = (from s in db.tbl_HomeDelChrgs where s.DelyType == "SC " select s).FirstOrDefault(); if (ship.Amount >= int.Parse(lblSubTotal.Text)) { lblShoppingCost.Text = ship.HomeDelCrhg.ToString(); } else { lblShoppingCost.Text = "FREE"; } if (lblShoppingCost.Text == "FREE") { lblGrandTotal.Text = Subtotal.ToString(); } else { lblGrandTotal.Text = (ship.Amount + int.Parse(lblSubTotal.Text)).ToString(); } } //} int m = dt.Rows.Count; ViewState["CurrentTreatmentTable"] = dt; if (dt != null) { GvCardDtl.DataSource = dt; GvCardDtl.DataBind(); } else { } //ArrayList colCookies = new ArrayList(); //for (int i = 0; i < Request.Cookies.Count; i++) //{ // colCookies.Add(Request.Cookies[i]); // // string[] arr = text.Split('|'); // //return cart; //} } int h = dt.Rows.Count; } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your Cart is Empty.')", true); } //ArrayList colCookies = new ArrayList(); //for (int i = 0; i < Request.Cookies.Count; i++) //{ // colCookies.Add(Request.Cookies[i]); // GvCardDtl.DataSource = colCookies; // GvCardDtl.DataBind(); //} //var a = (from s in db.tbl_ItemListDtls // join q in db.tbl_ItemQtyDtls on s.ItemId equals q.ItemId // join p in db.tbl_CartDtls on s.ItemId equals p.ItemId // join r in db.tbl_GrocerRateDtls on q.ItemQtyId equals r.ItemQtyId // //join h in db.tbl_HomeDelChrgs on r.GrocerRateId equals h.GrocerId // //where p.CustomerId == int.Parse(CustId) && p.PaymentStatus == false // select new { s.Image, s.BrandName, r.OfferRate, p.Quantity, p.cartID ,r.GrocerId}).ToList(); ////var a = (from s in db.ShopCart(int.Parse(CustId)) select s).ToList(); //GvCardDtl.DataSource = a; //GvCardDtl.DataBind(); //int quantity1 = 0; //int Subtotal = 0; //for (int i = 0; i < a.Count; i++) //{ // quantity1 = quantity + int.Parse(a[i].Quantity.ToString()); // int total = int.Parse((a[i].Quantity * a[i].OfferRate).ToString()); // Subtotal = Subtotal + total; //} //lblQuantity.Text = quantity.ToString(); //lblSubTotal.Text = Subtotal.ToString(); //lblShoppingCost.Text = "FREE"; //if (lblShoppingCost.Text == "FREE") //{ // lblGrandTotal.Text = Subtotal.ToString(); //} //else //{ // lblGrandTotal.Text = lblShoppingCost.Text + Subtotal; //} } }
protected void lbtnRemoveFromCart_Click(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { LinkButton lb = (LinkButton)sender; GridViewRow gvRow = (GridViewRow)lb.NamingContainer; int rowID = gvRow.RowIndex; if (ViewState["CurrentTreatmentTable"] != null) { DataTable dtt = (DataTable)ViewState["CurrentTreatmentTable"]; if (dtt.Rows.Count > 0) { if (gvRow.RowIndex < dtt.Rows.Count) { //Remove the Selected Row data and reset row number dtt.Rows.Remove(dtt.Rows[rowID]); ResetRowID(dt); } } //Store the current data in ViewState for future reference ViewState["CurrentTreatmentTable"] = dtt; //Re bind the GridView for the updated data if (dtt.Rows.Count > 0) { GvCardDtl.DataSource = dtt; GvCardDtl.DataBind(); } else { GvCardDtl.DataSource = dtt; GvCardDtl.DataBind(); lblnorecordfound.Visible = true; } //int quantity1 = 0; //double Subtotal = 0; //double total1 = 0; lblSubTotal.Text = "0"; lblQuantity.Text = "0"; string dta = ""; foreach (DataRow row in dtt.Rows) { //var Image = row["Image"]; var BrandName = row["ItemId"]; var Quantity = row["Quantity"]; var OfferRate = row["OfferRate"]; var Size = row["Size"]; var Grocerid = row["GrocerId"]; if (dta == "") { dta = BrandName + "," + Quantity + "," + OfferRate + "," + Size + "," + Grocerid; } else { dta = dta + "|" + BrandName + "," + Quantity + "," + OfferRate + "," + Size + "," + Grocerid; } lblSubTotal.Text = (int.Parse(lblSubTotal.Text) + int.Parse(OfferRate.ToString())).ToString(); lblQuantity.Text = (int.Parse(lblQuantity.Text) + int.Parse(Quantity.ToString())).ToString(); var ship = (from s in db.tbl_HomeDelChrgs where s.DelyType == "SC " select s).FirstOrDefault(); if (ship.Amount >= int.Parse(lblSubTotal.Text)) { lblShoppingCost.Text = ship.HomeDelCrhg.ToString(); } else { lblShoppingCost.Text = "FREE"; } if (lblShoppingCost.Text == "FREE") { lblGrandTotal.Text = lblSubTotal.Text; } else { lblGrandTotal.Text = (ship.Amount + int.Parse(lblSubTotal.Text)).ToString(); } } Response.Cookies["ShoppingCart"].Value = dta; Session["ShoppingCart"] = dta; //lbtnUpadate.Visible = true; //btnBuyNew.Visible = false; //Request.Cookies["ShoppingCart"].Expires = DateTime.Now.AddDays(-30); ((Site1)Master).BindGvCardDtl(); // UpadateCook(); } } }
public void BindGvCardDtl()//string CustId { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { double quantity1 = 0; double Subtotal = 0; //if (Request.Cookies["ShoppingCart"] != null) if (Session["ShoppingCart"] != null) { //string objCartListString = Request.Cookies["ShoppingCart"].Value.ToString(); string objCartListString = (Session["ShoppingCart"]).ToString(); if (objCartListString == "") { lblCartValue.Text = "0"; GvCardDtl.DataSource = null; GvCardDtl.DataBind(); } else { string[] objCartListStringSplit = objCartListString.Split('|'); lblCartValue.Text = objCartListStringSplit.Count().ToString(); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("Image", typeof(string))); dt.Columns.Add(new DataColumn("BrandName", typeof(string))); dt.Columns.Add(new DataColumn("Quantity", typeof(string))); dt.Columns.Add(new DataColumn("OfferRate", typeof(string))); dt.Columns.Add(new DataColumn("Size", typeof(string))); int ri = 0; foreach (string item in objCartListStringSplit) { ArrayList colCookies1 = new ArrayList(); string[] ss = item.Split(','); var BrandName = ss[0]; var Quantity = int.Parse(ss[1]); var OfferRate = Convert.ToDouble(ss[2]); var Size = ss[3]; colCookies1.Add(BrandName); colCookies1.Add(Quantity); colCookies1.Add(OfferRate); colCookies1.Add(Size); var a = (from ssss in db.tbl_ItemListDtls join c in db.tbl_ProductListDtls on ssss.ProductId equals c.ProductId where ssss.ItemId == int.Parse(BrandName.ToString()) select new { ssss.Image, ssss.BrandName, c.ProductName, ssss.ItemId, OfferRate = (Quantity * OfferRate), Quantity = Quantity }).FirstOrDefault(); if (a != null) { DataRow drCurrentRow = null; //if (dt.Rows.Count > 0) //{ drCurrentRow = dt.NewRow(); drCurrentRow["RowNumber"] = dt.Rows.Count + 1; //add new row to DataTable dt.Rows.Add(drCurrentRow); dt.Rows[ri]["Image"] = a.Image; dt.Rows[ri]["BrandName"] = a.BrandName; dt.Rows[ri]["Quantity"] = a.Quantity; dt.Rows[ri]["OfferRate"] = a.OfferRate; //dt.Rows[ri]["Column5"] = ""; //dt.Rows[ri]["Column6"] = DaaieIsDelete.Text; ri = ri + 1; //} quantity1 = double.Parse(Quantity.ToString()); double total = double.Parse((quantity1 * OfferRate).ToString()); Subtotal = Subtotal + total; lblQunatity.Text = Subtotal.ToString(); } //} GvCardDtl.DataSource = dt; GvCardDtl.DataBind(); } } } } }
protected void btnPlaceOrder_Click(object sender, EventArgs e) { if (Page.IsValid) { if (Session["CustId"] != null) { int CustID = int.Parse(Session["CustId"].ToString()); var k = DateTime.Today.ToString("ddMMyy"); //string OderID = k + CustID + CustOdr; string OderID = CustID + k; using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { string j = ""; int rowcount = 1; foreach (GridViewRow row in GvCardDtl.Rows) //Running all lines of grid { int CartId = int.Parse(((Label)row.FindControl("lblItemID")).Text.ToString()); int Quantity = int.Parse(((Label)row.FindControl("txtQunatity")).Text.ToString()); int MRP = int.Parse(((Label)row.FindControl("lblMRP")).Text.ToString()); string Size = (((Label)row.FindControl("lblSize")).Text.ToString()); int grocerid = int.Parse(((Label)row.FindControl("lblGrocerId")).Text.ToString()); if (rowcount < 2) { //var da = (from s in db.tbl_orderConfirms where s.ConfirmOdrID == j && s.GrocerId == grocerid select s).FirstOrDefault(); //if (da == null) //{ tbl_orderConfirm h = new tbl_orderConfirm(); h.ConfirmOdrID = OderID; db.tbl_orderConfirms.InsertOnSubmit(h); db.SubmitChanges(); h.CustId = CustID; h.OrderAmount = lblSubTotal.Text; //if (rbtDelivertype.SelectedItem != null) //{ // t.DeliType = rbtDelivertype.SelectedItem.Text; //} //else //{ // t.DeliType = "Standard Delivery"; //} h.Time_Date = DateTime.Now; //t.PaymentMode = h.Toatal_price = lblGrandTotal.Text; h.isDelete = false; //if (rbtDelivertype.SelectedItem != null) //{ // t.Deliver_Charge = rbtDelivertype.SelectedItem.Value; //} //else //{ // t.Deliver_Charge = "FREE"; //} h.Deliver_Charge = lblShoppingCost.Text; h.Odr_status = true; h.Complt_Odr = "S"; h.GrocerId = grocerid; h.ConfirmOdrID = OderID + h.CustOrdId; // db.tbl_orderConfirms.InsertOnSubmit(t); db.SubmitChanges(); rowcount++; j = h.ConfirmOdrID; //} } var daa = (from s in db.tbl_orderConfirms where s.ConfirmOdrID == j && s.GrocerId == grocerid select s).FirstOrDefault(); if (daa == null) { tbl_orderConfirm b = new tbl_orderConfirm(); b.GrocerId = grocerid; b.CustId = CustID; b.OrderAmount = lblSubTotal.Text; //if (rbtDelivertype.SelectedItem != null) //{ // t.DeliType = rbtDelivertype.SelectedItem.Text; //} //else //{ // t.DeliType = "Standard Delivery"; //} b.Time_Date = DateTime.Now; //t.PaymentMode = b.Toatal_price = lblGrandTotal.Text; b.isDelete = false; //if (rbtDelivertype.SelectedItem != null) //{ // t.Deliver_Charge = rbtDelivertype.SelectedItem.Value; //} //else //{ // t.Deliver_Charge = "FREE"; //} b.Odr_status = true; b.Complt_Odr = "S"; b.ConfirmOdrID = j; db.tbl_orderConfirms.InsertOnSubmit(b); db.SubmitChanges(); } tbl_CartDtl m = new tbl_CartDtl(); var a = (from s in db.tbl_CartDtls where s.cartID == CartId select s).FirstOrDefault(); //a.Quantity = int.Parse(Quantity.ToString()); m.ItemId = CartId; m.Quantity = Quantity; m.GrocerRateID = MRP; m.CustomerId = CustID; m.Size = Size; m.GrocerId = grocerid; m.PaymentStatus = false; m.IsDelete = false; m.CustmerOdrId = j; db.tbl_CartDtls.InsertOnSubmit(m); db.SubmitChanges(); } Tbl_CustDeliveryAddressDtl c = new Tbl_CustDeliveryAddressDtl(); c.CustId = CustID; c.CustFullName = txtFName.Text; c.CustLName = txtLName.Text; c.MobileNo = txtMobileNo.Text; c.AltMobileNo = txtALTMobile.Text; c.EmailId = txtEMail.Text; if (ddlState.SelectedItem.Value != "-----Select-----") { c.StateId = int.Parse(ddlState.SelectedItem.Value); } if (ddlCity.SelectedItem.Value != "-----Select-----") { c.CityId = int.Parse(ddlCity.SelectedItem.Value); } c.Address = txtAddress.Text; //if (rbtDelivertype.SelectedItem != null) //{ // c.Deliverytype = rbtDelivertype.SelectedItem.Value; //} //else //{ // c.Deliverytype = "FREE"; //} c.Odr_Status = true; c.CustOrdId = j; c.isdelete = false; if (txtZip.Text != "") { c.ZipCode = int.Parse(txtZip.Text); } db.Tbl_CustDeliveryAddressDtls.InsertOnSubmit(c); db.SubmitChanges(); txtFName.Text = ""; txtLName.Text = ""; txtMobileNo.Text = ""; txtAddress.Text = ""; txtALTMobile.Text = ""; txtCreDitCardNumber.Text = ""; txtCVV.Text = ""; txtEMail.Text = ""; txtExperyDate.Text = ""; txtNameOnCard.Text = ""; txtZip.Text = ""; ddlState.Items.Clear(); ddlCity.Items.Clear(); //rbtDelivertype.SelectedItem.Value = "FREE"; GvCardDtl.DataSource = null; GvCardDtl.DataBind(); lblSubTotal.Text = ""; if (Request.Cookies["ShoppingCart"] != null) { //Session.Abandon(); //Session.Clear(); Response.Cookies.Clear(); Response.Cookies["ShoppingCart"].Value = null; Request.Cookies["ShoppingCart"].Value = null; Response.Cookies["ShoppingCart"].Expires = DateTime.Now.AddDays(-30); Session["ShoppingCart"] = null; //Response.Cookies.Add(Response.Cookies["ShoppingCart"]); } ((Site1)Master).BindGvCardDtl(); Response.Redirect("Default.aspx"); //var a = (from s in db.tbl_CartDtls where s.CustomerId == CustID && s.PaymentStatus == false && s.IsDelete == false select s).ToList(); // var c = (from s in db.Tbl_CustDeliveryAddressDtls where s.CustId == CustID & s.Odr_Status == false select s).FirstOrDefault(); //var d = (from s in db.tbl_orderConfirms where s.CustOrdId == CustOdr select s).FirstOrDefault(); //foreach (tbl_CartDtl s in a) //{ // s.CustmerOdrId = Convert.ToInt64(OderID); // s.CustmerOdrId = CustOdr; // s.PaymentStatus = true; // db.SubmitChanges(); //} //c.CustOrdId = int.Parse(CustOdr.ToString()); //c.Odr_Status = true; //db.SubmitChanges(); //d.Complt_Odr = false; //d.Odr_status = true; //d.ConfirmOdrID = int.Parse(OderID.ToString()); //db.SubmitChanges(); //if (Session["OnlinePayment"] != null) //{ // Response.Redirect("~/m.app/PaytmPaymentGateway.aspx"); //} //API api = new API(); //var Customer = (from s in db.mstCustomerDtls where s.CustId == CustID select s).FirstOrDefault(); //var Grocer = (from s in db.mstGrocerDtls where s.GrocerId == GrocerID select s).FirstOrDefault(); //string _CustomerName = Customer.CustName; //string _MOBNO = Customer.MobileNo; //string _OderNo = d.ConfirmOdrID.ToString(); //string _msg = "Thanks Mr. " + _CustomerName + "<br>" + " your order list has been submitted successfully." + " Order ID :" + ' ' + _OderNo + " for future reference. your order will be process soon. " + "<br>" + "KITCHEN BASKET"; //sendsms(_MOBNO, _msg); //string _GrocerName = Grocer.ShopName; //string _MOBILENO = Grocer.MobNo; //string _MESSAGE = "MR. " + _CustomerName + " has Submited Order list Order ID " + ' ' + _OderNo + " For Future reference" + "<br>" + "KITCHEN BASKET"; //sendsms(_MOBILENO, _MESSAGE); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Your Order Place Successfully...!.' );", true); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Please Login First');", true); } } }
private void BindGvCardDtl()//string CustId { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { int quantity1 = 0; double Subtotal = 0; double total1 = 0; if (Request.Cookies["ShoppingCart"] != null) { string objCartListString = Request.Cookies["ShoppingCart"].Value.ToString(); string[] objCartListStringSplit = objCartListString.Split('|'); DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("ItemId", typeof(string))); dt.Columns.Add(new DataColumn("Image", typeof(string))); dt.Columns.Add(new DataColumn("BrandName", typeof(string))); dt.Columns.Add(new DataColumn("Quantity", typeof(string))); dt.Columns.Add(new DataColumn("OfferRate", typeof(string))); dt.Columns.Add(new DataColumn("Size", typeof(string))); dt.Columns.Add(new DataColumn("GrocerId", typeof(string))); //dt.Columns.Add(new DataColumn("Column5", typeof(string))); //dt.Columns.Add(new DataColumn("Column6", typeof(string))); //dr = dt.NewRow(); ////dr["RowNumber"] = 1; ////dr["Image"] = string.Empty; ////dr["BrandName"] = string.Empty; ////dr["Quantity"] = string.Empty; ////dr["OfferRate"] = string.Empty; ////dr["Column5"] = string.Empty; ////dr["Column6"] = string.Empty; //dt.Rows.Add(dr); //foreach (string s in objCartListStringSplit) //{ //string fname = Request.Cookies["ShoppingCart"]["FirstName"]; //string lname = Request.Cookies["ShoppingCart"]["LastName"]; int ri = 0; foreach (string item in objCartListStringSplit) { ArrayList colCookies1 = new ArrayList(); string[] ss = item.Split(','); var BrandName = ss[0]; var Quantity = int.Parse(ss[1]); var OfferRate = Convert.ToDouble(ss[2]); var Size = ss[3]; var grocerId = ss[4]; colCookies1.Add(BrandName); colCookies1.Add(Quantity); colCookies1.Add(OfferRate); colCookies1.Add(Size); colCookies1.Add(grocerId); var a = (from ssss in db.tbl_ItemListDtls join c in db.tbl_ProductListDtls on ssss.ProductId equals c.ProductId where ssss.ItemId == int.Parse(BrandName.ToString()) select new { ssss.Image, ssss.BrandName, c.ProductName, ssss.ItemId, OfferRate = OfferRate, Quantity = Quantity, Size = Size, grocerId = grocerId }).FirstOrDefault(); if (a != null) { DataRow drCurrentRow = null; //if (dt.Rows.Count > 0) //{ drCurrentRow = dt.NewRow(); drCurrentRow["RowNumber"] = dt.Rows.Count + 1; //add new row to DataTable dt.Rows.Add(drCurrentRow); dt.Rows[ri]["Image"] = a.Image; dt.Rows[ri]["ItemId"] = a.ItemId; dt.Rows[ri]["BrandName"] = a.BrandName; dt.Rows[ri]["Quantity"] = a.Quantity; dt.Rows[ri]["OfferRate"] = a.OfferRate; dt.Rows[ri]["Size"] = a.Size; dt.Rows[ri]["GrocerId"] = a.grocerId; //dt.Rows[ri]["Column5"] = ""; //dt.Rows[ri]["Column6"] = DaaieIsDelete.Text; ri = ri + 1; quantity1 = quantity1 + int.Parse(Quantity.ToString()); double total = double.Parse((Quantity * OfferRate).ToString()); total1 = total1 + total; Subtotal = Subtotal + total; lblSubTotal.Text = total1.ToString(); lblQuantity.Text = quantity1.ToString(); var ship = (from s in db.tbl_HomeDelChrgs where s.DelyType == "SC " select s).FirstOrDefault(); if (ship.Amount >= int.Parse(lblSubTotal.Text)) { lblShoppingCost.Text = ship.Amount.ToString(); } else { lblShoppingCost.Text = "FREE"; } if (lblShoppingCost.Text == "FREE") { lblGrandTotal.Text = Subtotal.ToString(); } else { lblGrandTotal.Text = (ship.Amount + int.Parse(lblSubTotal.Text)).ToString(); } } //} GvCardDtl.DataSource = dt; GvCardDtl.DataBind(); } } } }