protected void btnDelivered_Click(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { int DeliBoyID = int.Parse((Session["DeliBoyID"]).ToString()); string OderID = ((Label)((Button)sender).Parent.Parent.FindControl("lblConfirmorderId")).Text.ToString(); int lblGrocerId = Convert.ToInt32(((Label)((Button)sender).Parent.Parent.FindControl("lblGrocerId")).Text.ToString()); //int lblCustID = Convert.ToInt32(((Label)((Button)sender).Parent.Parent.FindControl("lblCustID")).Text.ToString()); var so = (from s in db.tbl_DeliveryBoy_Odrs where s.ConfirmOdrID == OderID && s.GrocerId == lblGrocerId && s.Flag == "P" select s).FirstOrDefault(); if (so != null) { so.Flag = "C"; db.SubmitChanges(); } var ft = (from d in db.Tbl_DeliveryActions where d.OrderId == OderID && d.ActFlag == "A" && d.Status == "P" && d.GrocerId == DeliBoyID select d).FirstOrDefault(); if (ft != null) { ft.Status = "C"; db.SubmitChanges(); } var tb = (from d in db.Tbl_DeliveryActions where d.OrderId == OderID && d.ActFlag == "P" && d.Status == "P" && d.GrocerId == DeliBoyID select d).FirstOrDefault(); if (tb != null) { tb.Status = "C"; db.SubmitChanges(); } var charges = (from s in db.mst_DeliveryBoyCharges where s.IsDelete == false orderby s.Date descending select s).FirstOrDefault(); var tbt = (from d in db.Tbl_DeliveryActions where d.OrderId == OderID && d.ActFlag == "C" && d.Status == "C" && d.GrocerId == DeliBoyID select d).FirstOrDefault(); //if (tbt == null) //{ Tbl_DeliveryAction t = new Tbl_DeliveryAction(); t.OrderId = OderID; t.GrocerId = DeliBoyID; //t.CustId = lblCustID; t.ActFlag = "C"; t.Status = "C"; t.ActByCategory = int.Parse(Session["CategoryId"].ToString()); t.ActDate = DateTime.Now; t.Type = "D "; t.Isdelete = false; if (charges != null) { t.drDeliCharges = charges.Rate; } db.Tbl_DeliveryActions.InsertOnSubmit(t); db.SubmitChanges(); //} PanelDetail.Visible = false; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Order Accept.);", true); BindData(); } }
protected void btnPrepared_click(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { string OderID = ((Label)((Button)sender).Parent.Parent.FindControl("lblConfirmorderId")).Text.ToString(); int lblGrocerId = Convert.ToInt32(((Label)((Button)sender).Parent.Parent.FindControl("lblGrocerId")).Text.ToString()); int lblCustID = Convert.ToInt32(((Label)((Button)sender).Parent.Parent.FindControl("lblCustID")).Text.ToString()); Tbl_DeliveryAction t = new Tbl_DeliveryAction(); var ft = (from d in db.Tbl_DeliveryActions where d.OrderId == OderID && d.ActFlag == "A" && d.Status == "A" && d.Type == "G" select d).FirstOrDefault(); if (ft != null) { ft.Status = "P"; db.SubmitChanges(); } t.OrderId = OderID; t.GrocerId = lblGrocerId; t.CustId = lblCustID; t.ActFlag = "P"; t.Status = "P"; t.ActByCategory = int.Parse(Session["CategoryId"].ToString()); t.ActDate = DateTime.Now; t.Isdelete = false; t.Type = "G"; db.Tbl_DeliveryActions.InsertOnSubmit(t); db.SubmitChanges(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Order is Prepared......');", true); BindData(); } }
protected void btnDone_Click(object sender, EventArgs e) { if (true) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { foreach (GridViewRow gr in gvAcceptordersList.Rows) { //int custordid = int.Parse(Request.QueryString["custeOrdId"]); CheckBox chk = gr.FindControl("Check") as CheckBox; //Label lblcartID = gr.FindControl("lblcartID") as Label; Label lblGrocerId = gr.FindControl("lblGrocerId") as Label; Label lblCustOrdId = gr.FindControl("lblConfirmorderId") as Label; Label lblCustID = gr.FindControl("lblCustID") as Label; if (chk.Checked == true) { int GrocerID = int.Parse((Session["GrocId"]).ToString()); var so = (from s in db.tbl_orderConfirms where s.ConfirmOdrID == lblCustOrdId.Text && s.GrocerId == GrocerID select s).FirstOrDefault(); if (so != null) { so.Complt_Odr = "A"; db.SubmitChanges(); } AcceptItemList ac = new AcceptItemList(); ac.GrocerId = int.Parse(lblGrocerId.Text); ac.CustorderId = lblCustOrdId.Text; ac.CustomerId = int.Parse(lblCustID.Text); ac.Isdelete = false; db.AcceptItemLists.InsertOnSubmit(ac); db.SubmitChanges(); // var b = (from s in db.tbl_orderConfirms where s.ConfirmOdrID == lblCustOrdId.Text select new { s.CustOrdId}).FirstOrDefault(); Tbl_DeliveryAction t = new Tbl_DeliveryAction(); t.OrderId = lblCustOrdId.Text; t.GrocerId = int.Parse(lblGrocerId.Text); t.CustId = int.Parse(lblCustID.Text); t.ActFlag = "A"; t.Status = "A"; t.ActByCategory = int.Parse(Session["CategoryId"].ToString()); t.ActDate = DateTime.Now; t.Isdelete = false; t.Type = "G"; db.Tbl_DeliveryActions.InsertOnSubmit(t); db.SubmitChanges(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Items Verified......');", true); } } } } BindData(); }
protected void btnDone_click(object sender, EventArgs e) { using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext()) { int GrocerID = int.Parse((Session["GrocId"]).ToString()); foreach (GridViewRow gr in gvDetail.Rows) { CheckBox chk = gr.FindControl("Check") as CheckBox; Label lblGrocerRate = gr.FindControl("lblGrocerRate") as Label; Label lblCustOrdId = gr.FindControl("lblConfirmorderId") as Label; Label lblCustId = gr.FindControl("lblCustID") as Label; Label lblItemId = gr.FindControl("lblItemId") as Label; if (chk.Checked == true) { var fht = (from d in db.Tbl_GrocerOrderconfirmLists where d.OrderID == lblCustOrdId.Text && d.GrocerId == GrocerID select d).FirstOrDefault(); if (fht == null) { Tbl_GrocerOrderconfirmList g = new Tbl_GrocerOrderconfirmList(); g.OrderID = lblCustOrdId.Text; g.CustId = int.Parse(lblCustId.Text); g.ItemId = int.Parse(lblItemId.Text); g.GrocerId = int.Parse((Session["GrocId"]).ToString());; g.Status = "C"; db.Tbl_GrocerOrderconfirmLists.InsertOnSubmit(g); db.SubmitChanges(); } var ft = (from d in db.Tbl_DeliveryActions where d.OrderId == lblCustOrdId.Text && d.ActFlag == "A" && d.Status == "P" && d.GrocerId == GrocerID && d.Type == "G" select d).FirstOrDefault(); if (ft != null) { ft.Status = "C"; db.SubmitChanges(); } var tb = (from d in db.Tbl_DeliveryActions where d.OrderId == lblCustOrdId.Text && d.ActFlag == "P" && d.Status == "P" && d.GrocerId == GrocerID && d.Type == "G" select d).FirstOrDefault(); if (tb != null) { tb.Status = "C"; db.SubmitChanges(); } var tbt = (from d in db.Tbl_DeliveryActions where d.OrderId == lblCustOrdId.Text && d.ActFlag == "C" && d.Status == "C" && d.GrocerId == GrocerID && d.Type == "G" select d).FirstOrDefault(); if (tbt == null) { Tbl_DeliveryAction t = new Tbl_DeliveryAction(); t.OrderId = lblCustOrdId.Text; t.GrocerId = int.Parse(Session["GrocId"].ToString()); t.CustId = int.Parse(lblCustId.Text); t.ActFlag = "C"; t.Status = "C"; t.ActByCategory = int.Parse(Session["CategoryId"].ToString()); t.ActDate = DateTime.Now; t.Type = "G"; t.Isdelete = false; db.Tbl_DeliveryActions.InsertOnSubmit(t); db.SubmitChanges(); } } } PanelDetail.Visible = false; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Order Accept.);", true); BindData(); } }