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();
            }
        }
Пример #2
0
        protected void btnFreez_Click(object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                Button clickedButton = (Button)sender;
                if (clickedButton.Text == "Freez")
                {
                    clickedButton.BackColor = Color.Red;
                    var lblItemId = ((Label)(((Button)sender).Parent.Parent.FindControl("lblItemID"))).Text;

                    var a = (from s in db.tbl_ItemQtyDtls where s.ItemQtyId == int.Parse(lblItemId.ToString()) select s).FirstOrDefault();
                    a.IsShow = false;
                    db.SubmitChanges();
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Item Freezed');", true);

                    Button clickedButton1 = (Button)sender;
                    clickedButton1.Text    = "Show";
                    clickedButton1.Enabled = true;
                }
                else if (clickedButton.Text == "Show")
                {
                    clickedButton.BackColor = Color.Green;
                    var lblItemId = ((Label)(((Button)sender).Parent.Parent.FindControl("lblItemID"))).Text;

                    var a = (from s in db.tbl_ItemQtyDtls where s.ItemQtyId == int.Parse(lblItemId.ToString()) select s).FirstOrDefault();
                    a.IsShow = true;
                    db.SubmitChanges();
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Item Shows');", true);

                    Button clickedButton1 = (Button)sender;
                    clickedButton1.Text    = "Freez";
                    clickedButton1.Enabled = true;
                }
            }
        }
Пример #3
0
        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 btnHomeDelivery_click(object sender, EventArgs e)
 {
     using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
     {
         var chkd = (from s in db.tbl_HomeDelChrgs
                     where s.GrocerId == int.Parse(Session["GrocId"].ToString()) && s.IsDelete == false
                     select s).FirstOrDefault();
         if (chkd != null)
         {
             chkd.HomeDelCrhg = txtHomedelChrg.Text;
             chkd.GrocerId    = int.Parse(Session["GrocId"].ToString());
             chkd.IsDelete    = false;
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Home Delivery Charges Updated');", true);
             BindHomeDelChages();
         }
         else
         {
             tbl_HomeDelChrg tb = new tbl_HomeDelChrg();
             //tb.HomeDelCrhg = Convert.ToInt16(txtHomedelChrg.Text);
             tb.HomeDelCrhg = txtHomedelChrg.Text;
             tb.GrocerId    = int.Parse(Session["GrocId"].ToString());
             tb.IsDelete    = false;
             db.tbl_HomeDelChrgs.InsertOnSubmit(tb);
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Home Delivery Charges Saved Successfully');", true);
             BindHomeDelChages();
         }
     }
 }
Пример #5
0
        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();
        }
Пример #6
0
        protected void btnRegister_click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                if (FileUpload1.PostedFile != null)
                {
                    string imgpath = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
                    //string imgpath = Server.MapPath("/rImg");
                    if (imgpath != "")
                    {
                        FileUpload1.SaveAs(Server.MapPath("~/Images/GrocerImage/" + (imgpath)));
                    }


                    //FileUpload1.SaveAs(imgpath + "/" + FileUpload1.FileName);

                    mstGrocerDtl g = new mstGrocerDtl();
                    //var g = (from s in db.mstGrocerDtls where s.GrocerId == int.Parse(Session["GrocId"].ToString()) select s).FirstOrDefault();
                    if (imgpath != "")
                    {
                        g.image = ("/Images/GrocerImage/" + (imgpath));
                    }
                    g.AreaCode      = int.Parse(ddlArea.Text);
                    g.ShopName      = txtSName.Text;
                    g.ShopRegNo     = txtSRegNo.Text;
                    g.ShopAddr      = txtShopAddr.Text;
                    g.ShopOwnName   = txtOwnNm.Text;
                    g.MobNo         = txtMobNo.Text;
                    g.Email         = txtEmailId.Text;
                    g.ShopOwnAdhar  = txtOwnAdhar.Text;
                    g.BankAccNumber = txtAccountNo.Text;
                    g.IFSCcode      = txtIFSCcode.Text;

                    // g.image = ("GrocerImg/" + FileUpload1.FileName);
                    g.IsDelete = false;
                    // g.Lattitude = null;
                    //g.Longitude = null;
                    //db.mstGrocerDtls.InsertOnSubmit(g);
                    db.SubmitChanges();

                    RegistrationInfo d = new RegistrationInfo();
                    d.RegistrationDateTime = DateTime.Now;
                    d.CategoryId           = 2;
                    d.MobileNo             = txtMobNo.Text;
                    d.Password             = txtpass.Text;
                    d.UserID   = g.GrocerId;
                    d.Isdelete = false;
                    //db.RegistrationInfos.InsertOnSubmit(d);
                    db.SubmitChanges();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registration Successfully')", true);
                    //Response.Redirect("GrocerProfile.aspx");
                    pnlAddShop.Visible = false;
                    Panel2.Visible     = true;
                    showdata();
                }
            }
        }
Пример #7
0
        protected void btnRegister_click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                if (FileUpload1.PostedFile != null)
                {
                    string imgpath = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
                    //string imgpath = Server.MapPath("/rImg");
                    if (imgpath != "")
                    {
                        FileUpload1.SaveAs(Server.MapPath("~/Images/DeliveryBoyImage/" + (imgpath)));
                    }


                    //FileUpload1.SaveAs(imgpath + "/" + FileUpload1.FileName);

                    mstDeliveryBoyDtl g = new mstDeliveryBoyDtl();

                    if (imgpath != "")
                    {
                        g.image = ("/Images/GrocerImage/" + (imgpath));
                    }
                    g.AreaCode        = int.Parse(ddlArea.Text);
                    g.DeliverBoyName  = txtSName.Text;
                    g.DeliverBoyRegNo = txtSRegNo.Text;
                    g.DeliverBoyAddr  = txtShopAddr.Text;
                    //g. = txtOwnNm.Text;
                    g.MobNo = txtMobNo.Text;
                    g.Email = txtEmailId.Text;
                    g.DeliverBoyOwnAdhar = txtOwnAdhar.Text;
                    g.BankAccNo          = txtAccountNo.Text;
                    g.IFSCcode           = txtIFSCcode.Text;
                    // g.image = ("GrocerImg/" + FileUpload1.FileName);
                    g.IsDelete = false;
                    // g.Lattitude = null;
                    //g.Longitude = null;
                    db.mstDeliveryBoyDtls.InsertOnSubmit(g);
                    db.SubmitChanges();

                    RegistrationInfo d = new RegistrationInfo();
                    d.RegistrationDateTime = DateTime.Now;
                    d.CategoryId           = 4;
                    d.MobileNo             = txtMobNo.Text;
                    d.Password             = txtpass.Text;
                    d.UserID   = g.DeliveryBoyId;
                    d.Isdelete = false;
                    db.RegistrationInfos.InsertOnSubmit(d);
                    db.SubmitChanges();
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registration Successfully')", true);
                    pnlAddShop.Visible = false;
                    pnlgrid.Visible    = true;
                    showdata();
                }
            }
        }
Пример #8
0
        protected void lbtnUpdateAddress_Click(object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                int custid  = int.Parse(Session["CustId"].ToString());
                var adrress = (from s in db.Tbl_CustDeliveryAddressDtls where s.CustId == custid select s).FirstOrDefault();

                adrress.CustFullName = txtFName.Text;



                adrress.CustLName   = txtLName.Text;
                adrress.MobileNo    = txtMobileNo.Text;
                adrress.AltMobileNo = txtALTMobile.Text;
                adrress.EmailId     = txtEMail.Text;
                if (ddlState.SelectedItem.Value != "-----Select-----")
                {
                    adrress.StateId = int.Parse(ddlState.SelectedItem.Value);
                }
                if (ddlCity.SelectedItem.Value != "-----Select-----")
                {
                    adrress.CityId = int.Parse(ddlCity.SelectedItem.Value);
                }

                adrress.Address = txtAddress.Text;

                adrress.ZipCode = int.Parse(txtZip.Text);

                db.SubmitChanges();

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Address Updated Successfully');", true);
            }
        }
Пример #9
0
        protected void btnAddItem_Click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                string imgpath = System.IO.Path.GetFileName(FileUploaditem.PostedFile.FileName);
                //FileUploaditem.SaveAs("D:/Project/GrocerApplication/GrocerApplication/Images/Itemimg/" + (imgpath));
                //FileUploaditem.SaveAs("D:/WIUMS PROJECT/GrocerApplication_Vesion2012/Images/Itemimg/" + (imgpath));
                FileUploaditem.SaveAs(Server.MapPath("~/Images/Itemimg/" + (imgpath)));

                tbl_ItemListDtl z = new tbl_ItemListDtl();

                z.BrandName    = txtbrandNm.Text;
                z.Details      = txtDetails.Text;
                z.Image        = ("/Images/Itemimg/" + (imgpath));
                z.ProductId    = Convert.ToInt32(ddlProduct.Text);
                z.IsDelete     = false;
                z.RegularItems = true;
                db.tbl_ItemListDtls.InsertOnSubmit(z);
                db.SubmitChanges();

                //ScriptManager.(Page, Page.GetType(), "str", "alert(Items Added Successfully!);", true);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Items Added Successfully.....!')", true);
                Bindgrid();
            }
        }
Пример #10
0
 protected void btnAddcat_Click(Object sender, EventArgs e)
 {
     using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
     {
         string imgpath = System.IO.Path.GetFileName(FileUploadCat.PostedFile.FileName);
         //FileUploadCat.SaveAs("D:/Project/GrocerApplication/GrocerApplication/Images/Categoryimg/" + (imgpath));
         // FileUploadCat.SaveAs("D:/WIUMS PROJECT/GrocerApplication_Vesion2012/Images/Categoryimg/" + (imgpath));
         if (imgpath != "")
         {
             FileUploadCat.SaveAs(Server.MapPath("~/Images/HeaderImage/" + (imgpath)));
         }
         tbl_HeaderImage s = new tbl_HeaderImage();
         //s.CategoryName = txtAddCat.Text;
         if (imgpath != "")
         {
             s.HeaderImage = ("/Images/HeaderImage/" + (imgpath));
         }
         s.IsDelete = false;
         //s.MarathiCatagory = txtMarathicat.Text;
         db.tbl_HeaderImages.InsertOnSubmit(s);
         db.SubmitChanges();
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Header Image Added Successfully.....!')", true);
         BindCategory();
     }
 }
Пример #11
0
        protected void Discount_click(object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                if (gvItemRate.Rows.Count > 0)
                {
                    for (int i = 0; i < gvItemRate.Rows.Count; i++)
                    {
                        string OfferRate = (((TextBox)gvItemRate.Rows[i].FindControl("txtFinalOfferRate")).Text.ToString());

                        if (OfferRate != "")
                        {
                            string Discount = (((TextBox)gvItemRate.Rows[i].FindControl("txtDiscount")).Text.ToString());

                            if (Discount != "")
                            {
                                int grocerRateID = int.Parse(((Label)gvItemRate.Rows[i].FindControl("lblGrocerId")).Text.ToString());


                                var check = (from s in db.tbl_GrocerRateDtls where s.GrocerRateId == int.Parse(grocerRateID.ToString()) select s).FirstOrDefault();


                                check.OfferRate = Convert.ToInt32(OfferRate.ToString());
                                check.Discount  = Convert.ToInt32(Discount.ToString());
                                check.IsDelete  = false;
                                db.SubmitChanges();
                            }
                        }
                    }
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Item Rate Added Successfully.....!')", true);
            }
        }
Пример #12
0
        protected void btnAddSubcat_Click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                string imgpath = System.IO.Path.GetFileName(FileUploadSubcat.PostedFile.FileName);
                // FileUploadSubcat.SaveAs("D:/Project/GrocerApplication/GrocerApplication/Images/Sub_catimg/" + (imgpath));
                // FileUploadSubcat.SaveAs("D:/WIUMS PROJECT/GrocerApplication_Vesion2012/Images/Sub_catimg/" + (imgpath));
                if (imgpath != "")
                {
                    FileUploadSubcat.SaveAs(Server.MapPath("~/Images/Sub_catimg/" + (imgpath)));
                }

                tbl_SubCategoryDtl a = new tbl_SubCategoryDtl();
                a.SubCatName = txtSubcate.Text;
                if (imgpath != "")
                {
                    a.Image = ("/Images/Sub_catimg/" + (imgpath));
                }
                a.CatId    = Convert.ToInt32(ddlCate.Text);
                a.IsDelete = false;
                if (chkRegular.Checked == true)
                {
                    a.RegularItems = true;
                }
                else
                {
                    a.RegularItems = false;
                }
                db.tbl_SubCategoryDtls.InsertOnSubmit(a);
                db.SubmitChanges();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Sub-Category Added Successfully.....!')", true);
                BindGrid();
                chkRegular.Checked = false;
            }
        }
Пример #13
0
        protected void btnUpdateRates_click(object semder, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                foreach (GridViewRow row in gvItemRate.Rows) //Running all lines of grid
                {
                    CheckBox chkRow = (CheckBox)(row.FindControl("ChkChild"));
                    if (chkRow.Checked)
                    {
                        // Label ItemId = (Label)gvItemRate.HeaderRow.FindControl("lblItemId");
                        int ItemId = int.Parse(((Label)row.FindControl("lblItemId")).Text.ToString());

                        var ChkData = (from s in db.tbl_ItemQtyDtls where s.ItemId == int.Parse(ItemId.ToString()) select s).FirstOrDefault();
                        if (ChkData == null)
                        {
                            int    temitemId = int.Parse(((Label)row.FindControl("lbllblItemId")).Text.ToString());
                            int    tempMRP   = int.Parse(((TextBox)row.FindControl("txtMRP")).Text.ToString());
                            int    Quantity  = int.Parse(((TextBox)row.FindControl("txtOty")).Text.ToString());
                            string unit      = (((DropDownList)row.FindControl("ddlunit")).Text.ToString());

                            tbl_ItemQtyDtl s = new tbl_ItemQtyDtl();
                            s.ItemId   = temitemId;
                            s.Quantity = Quantity;
                            s.Unit     = unit;
                            s.MRP      = tempMRP;
                            s.IsDelete = false;
                            s.IsShow   = true;
                            db.tbl_ItemQtyDtls.InsertOnSubmit(s);
                            db.SubmitChanges();
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Price Added Successfully.....!')", true);
                        }
                        else
                        {
                            int tempMRP = int.Parse(((TextBox)row.FindControl("txtMRP")).Text.ToString());
                            ChkData.MRP = tempMRP;
                            db.SubmitChanges();
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Price Added Successfully.....!')", true);
                        }
                    }
                }
            }
        }
Пример #14
0
        protected void Changestatus_click(object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            { string name;
              Button brn        = (Button)sender;
              string CustOdr_ID = brn.ToolTip;

              var get = (from a in db.Tbl_CustDeliveryAddressDtls
                         join c in db.tbl_orderConfirms on a.CustId equals c.CustId
                         where c.ConfirmOdrID == CustOdr_ID
                         select new { name = a.CustFullName + " " + a.CustLName, a.Address, c.ConfirmOdrID, a.MobileNo, c.DeliType, c.PaymentMode, c.Toatal_price }).FirstOrDefault();



              tbl_DeliveryBoy_Odr d = new tbl_DeliveryBoy_Odr();

              d.Cust_Address  = get.Address;
              d.Cust_Name     = get.name;
              d.Paymet_Method = get.PaymentMode;
              d.Cust_Mob      = get.MobileNo;
              d.Total_Amount  = Convert.ToInt32(get.Toatal_price);
              d.ConfirmOdrID  = get.ConfirmOdrID;
              d.IsDelete      = false;
              d.GrocerId      = int.Parse((Session["GrocId"]).ToString());
              d.Flag          = "S";

              db.tbl_DeliveryBoy_Odrs.InsertOnSubmit(d);
              db.SubmitChanges();

              string CustOdrID = ((Label)((Button)sender).Parent.Parent.FindControl("lblConfirmorderId")).Text.ToString();

              var z = (from s in db.tbl_orderConfirms where s.ConfirmOdrID == CustOdrID select s).FirstOrDefault();

              z.Complt_Odr = "true";
              db.SubmitChanges();
              BindData();
              ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Order Completed Successfully....' );", true); }
        }
Пример #15
0
 protected void btnUpdateCart_Click(object sender, EventArgs e)
 {
     using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
     {
         foreach (GridViewRow row in GvCardDtl.Rows) //Running all lines of grid
         {
             int CartId   = int.Parse(((Label)row.FindControl("lblCartId")).Text.ToString());
             int Quantity = int.Parse(((TextBox)row.FindControl("txtQunatity")).Text.ToString());
             var a        = (from s in db.tbl_CartDtls where s.cartID == CartId select s).FirstOrDefault();
             a.Quantity = int.Parse(Quantity.ToString());
             db.SubmitChanges();
         }
     }
 }
Пример #16
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (Session["CustId"] != null)
     {
         using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
         {
             int custid = int.Parse(Session["CustId"].ToString());
             var login  = (from s in db.RegistrationInfos where s.UserID == custid select s).FirstOrDefault();
             login.MobileNo = txtLoginUserName.Text;
             login.Password = txtLoginPassword.Text;
             db.SubmitChanges();
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Information Updated Sucessfully');", true);
         }
     }
 }
Пример #17
0
        protected void btnsave_click(object sender, EventArgs e)
        {
            int RegID = int.Parse(Session["DeliBoyID"].ToString());

            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                var z = (from s in db.mstDeliveryBoyDtls where s.DeliveryBoyId == RegID select s).FirstOrDefault();
                if (z != null)
                {
                    z.Lattitude = Convert.ToDouble(txtlatitude.Text);
                    z.Longitude = Convert.ToDouble(txtlongitude.Text);
                    db.SubmitChanges();
                }
            }
        }
Пример #18
0
        protected void AddImg_click(object sender, EventArgs e)
        {
            string imgpath = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);

            FileUpload1.SaveAs("D:/SuperBazar/Mobile View/GrocerApplication/GrocerApplication/Adds/" + (imgpath));
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                mst_Advertisement a = new mst_Advertisement();
                a.Category_ID = Convert.ToInt32(ddlcat.SelectedItem.Value);
                a.imgurl      = ("../Adds/" + (imgpath));
                a.IsDelete    = false;
                db.mst_Advertisements.InsertOnSubmit(a);
                db.SubmitChanges();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Advertisement Added Successfully.....!')", true);
                BindAdvertisement();
            }
        }
Пример #19
0
        protected void Deletecat_Click(object sender, EventArgs e)
        {
            String Id = ((Label)((Button)sender).Parent.Parent.FindControl("lblhederid")).Text.ToString();

            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                var getinfo = (from s in db.tbl_HeaderImages
                               where s.IsDelete == false &
                               s.HeaderId == int.Parse(Id)
                               select s).FirstOrDefault();
                getinfo.IsDelete = true;
                db.SubmitChanges();
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str",
                                                    "alert('Record Deleted Successfully....' );", true);
                //txtAddCat.Text = "";
                BindCategory();
            }
        }
Пример #20
0
        protected void Deletrprod_Click(object sender, EventArgs e)
        {
            String _RegId =
                ((Label)((Button)sender).Parent.Parent.FindControl("lblProductId")).Text.ToString();

            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                var getinfo = (from s in db.tbl_ProductListDtls
                               where s.ProductId
                               == int.Parse(_RegId)
                               select s).FirstOrDefault();
                getinfo.IsDelete = true;
                db.SubmitChanges();
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str",
                                                    "alert('Record Deleted Successfully....' );", true);
                BindGrid();
            }
        }
Пример #21
0
        protected void gvItemRate_RowUpdating(object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                //Finding the controls from Gridview for the row which is going to update
                Label   GrocerId = gvItemRate.Rows[e.RowIndex].FindControl("lblGrocerId") as Label;
                TextBox name     = gvItemRate.Rows[e.RowIndex].FindControl("txt_OffeRate") as TextBox;
                TextBox Disc     = gvItemRate.Rows[e.RowIndex].FindControl("txt_Discount") as TextBox;
                int     grocer   = int.Parse(Session["GrocId"].ToString());



                gvItemRate.EditIndex = -1;

                //Call ShowData method for displaying updated data
                //var item = (from s in db.tbl_GrocerRateDtls
                //            join a in db.tbl_ItemQtyDtls on s.ItemQtyId equals a.ItemQtyId
                //            join b in db.tbl_ItemListDtls on a.ItemId equals b.ItemId
                //            join c in db.tbl_ProductListDtls on b.ProductId equals c.ProductId
                //            where b.IsDelete == false
                //                // & s.OfferRate == null
                //            & b.ProductId == int.Parse(ddlProduct.SelectedItem.Value) & s.GrocerId == int.Parse(GrocerId.ToString())
                //            select new { ItemName = (b.BrandName + " " + c.ProductName), a.MRP, s.GrocerRateId, b.Image, Qty = (a.Quantity + " " + a.Unit), s.OfferRate }).FirstOrDefault ();
                var check = (from s in db.tbl_GrocerRateDtls where s.GrocerRateId == int.Parse(GrocerId.Text) select s).FirstOrDefault();
                check.OfferRate = Convert.ToDouble(name.Text);
                check.Discount  = Convert.ToInt16(Disc.Text);

                // item.IsDelete = false;
                db.SubmitChanges();
                var item = (from s in db.tbl_GrocerRateDtls
                            join a in db.tbl_ItemQtyDtls on s.ItemQtyId equals a.ItemQtyId
                            join b in db.tbl_ItemListDtls on a.ItemId equals b.ItemId
                            join c in db.tbl_ProductListDtls on b.ProductId equals c.ProductId
                            where b.IsDelete == false
                            // & s.OfferRate == null
                            & b.ProductId == int.Parse(ddlProduct.SelectedItem.Value) & s.GrocerId == int.Parse(grocer.ToString())
                            select new { ItemName = (b.BrandName + " " + c.ProductName), a.MRP, s.GrocerRateId, b.Image, Qty = (a.Quantity + " " + a.Unit), s.OfferRate, s.Discount }).ToList();


                gvItemRate.DataSource = item;
                gvItemRate.DataBind();
            }
        }
Пример #22
0
        protected void btn_PickupConfirmed(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                int RegID = Convert.ToInt32(Session["RegId"]);

                var z = (from s in db.RegistrationInfos where s.RegId == RegID select s).FirstOrDefault();

                Button brn        = (Button)sender;
                int    DeliveryID = Convert.ToInt32(brn.ToolTip.ToString());

                var a = (from s in db.tbl_DeliveryBoy_Odrs where s.Deli_ID == DeliveryID select s).FirstOrDefault();

                a.IsPick     = true;
                a.Deli_BoyID = z.UserID;
                db.SubmitChanges();
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str","alert('Order Pick Successfully....' );", true);
                Response.Redirect("~/deliveryForms/Deliveryorder.aspx");
            }
        }
Пример #23
0
 protected void btnAddProduct_Click(Object sender, EventArgs e)
 {
     using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
     {
         string imgpath = System.IO.Path.GetFileName(FileUploadProducts.PostedFile.FileName);
         // FileUploadProducts.SaveAs("D:/Project/GrocerApplication/GrocerApplication/Images/Productsimg/" + (imgpath));
         // FileUploadProducts.SaveAs("D:/WIUMS PROJECT/GrocerApplication_Vesion2012/Images/Productsimg/" + (imgpath));
         FileUploadProducts.SaveAs(Server.MapPath("~/Images/Productsimg/" + (imgpath)));
         //fileUploader.SaveAs(Server.MapPath("~/Images/") + "file.jpg");
         tbl_ProductListDtl a = new tbl_ProductListDtl();
         a.ProductName  = txtAddproducts.Text;
         a.Image        = ("/Images/Productsimg/" + (imgpath));
         a.SubCatId     = Convert.ToInt32(ddlSubCategoryPnlProd.Text);
         a.IsDelete     = false;
         a.RegularItems = 1;
         db.tbl_ProductListDtls.InsertOnSubmit(a);
         db.SubmitChanges();
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Products Added Successfully.....!')", true);
         txtAddproducts.Text = "";
         BindGrid();
     }
 }
Пример #24
0
        protected void btnUpdateRates_click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                if (gvItemRate.Rows.Count > 0)
                {
                    for (int i = 0; i < gvItemRate.Rows.Count; i++)
                    {
                        int grocerid = int.Parse(((Label)gvItemRate.Rows[i].FindControl("lblGrocerId")).Text.ToString());

                        if (grocerid != null)
                        {
                            string Offer = (((Label)gvItemRate.Rows[i].FindControl("lbl_OffeRate")).Text.ToString());

                            if (Offer != "")
                            {
                                Double OffRate  = Convert.ToDouble(((Label)gvItemRate.Rows[i].FindControl("lbl_OffeRate")).Text.ToString());
                                int    Discount = Convert.ToInt16(((Label)gvItemRate.Rows[i].FindControl("lbl_Discount")).Text.ToString());
                                int    MRP      = int.Parse(((Label)gvItemRate.Rows[i].FindControl("lblMRP")).Text.ToString());

                                var check = (from s in db.tbl_GrocerRateDtls where s.GrocerRateId == int.Parse(grocerid.ToString()) select s).FirstOrDefault();

                                //OffRate = Convert.ToDouble (check.OfferRate);
                                check.OfferRate = Convert.ToDouble(OffRate.ToString());
                                check.MRP       = int.Parse(MRP.ToString());
                                check.Discount  = Discount;
                                check.IsDelete  = false;
                                db.SubmitChanges();
                            }
                        }
                    }
                }
                //showItemRateGrid();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Item Rate Added Successfully.....!')", true);
            }
        }
Пример #25
0
        protected void btnSave_click(Object sender, EventArgs e)
        {
            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                int grocer = int.Parse(Session["GrocId"].ToString());
                if (gvItemList.Rows.Count > 0)
                {
                    for (int i = 0; i < gvItemList.Rows.Count; i++)
                    {
                        CheckBox chk = (CheckBox)gvItemList.Rows[i].FindControl("chk");
                        if ((chk.Checked) == true)
                        {
                            int    lblItemId = int.Parse(((Label)gvItemList.Rows[i].FindControl("lblItemID")).Text.ToString());
                            string lblQty    = ((Label)gvItemList.Rows[i].FindControl("lblQty")).Text.ToString();

                            //var qry = (from s in db.tbl_ItemQtyDtls where s.ItemId == lblItemId select new {s.MRP}).ToList();

                            var a = (from s in db.tbl_GrocerRateDtls where s.ItemQtyId == lblItemId && s.GrocerId == grocer select s.ItemQtyId).FirstOrDefault();
                            if (a != null)
                            {
                            }
                            else
                            {
                                tbl_GrocerRateDtl tb = new tbl_GrocerRateDtl();
                                tb.ItemQtyId = int.Parse(lblItemId.ToString());
                                tb.GrocerId  = int.Parse(grocer.ToString());
                                tb.IsDelete  = false;
                                db.tbl_GrocerRateDtls.InsertOnSubmit(tb);
                                db.SubmitChanges();
                            }
                        }
                    }
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "str", "alert('Item Saved Successfully');", true);
                }
            }
        }
Пример #26
0
        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);
                }
            }
        }
Пример #27
0
        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();
            }
        }
Пример #28
0
        protected void lbtnRegisterNew_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
                {
                    //string p = txttest.Text;

                    var z = (from s in db.RegistrationInfos where s.MobileNo == txtRegUserName.Text && s.Password == txtRegPassword.Text select s).ToList();
                    if (z.Count > 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Mobile No Already Registrered')", true);
                    }
                    else
                    {
                        if (txtRegUserName.Text != "")
                        {
                            mstCustomerDtl tb = new mstCustomerDtl();
                            tb.CustName  = txtRegFName.Text;
                            tb.CustLName = txtRegLName.Text;
                            tb.MobileNo  = txtRegUserName.Text;

                            //tb.EmailId = txtEmailId.Text;
                            tb.isdelete = false;
                            db.mstCustomerDtls.InsertOnSubmit(tb);
                            db.SubmitChanges();



                            //int subareaid = int.Parse(ddlSubArea.SelectedItem.Value);
                            RegistrationInfo reg = new RegistrationInfo();
                            reg.RegistrationDateTime = DateTime.Now;
                            reg.CategoryId           = 3; //ststic
                            reg.MobileNo             = txtRegUserName.Text;
                            reg.Password             = txtRegPassword.Text;
                            reg.UserID   = tb.CustId;
                            reg.GrocerId = 9;  //static

                            //reg.SubAreaId = ;

                            reg.Isdelete = false;

                            db.RegistrationInfos.InsertOnSubmit(reg);
                            db.SubmitChanges();
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('User Registered Successfully')", true);

                            //HttpCookie userInfo = new HttpCookie("userInfo");
                            //userInfo["UserName"] = txtRegUserName.Text;
                            //userInfo["Password"] = txtRegPassword.Text;
                            //userInfo.Expires.Add(new TimeSpan(31, 0, 0, 0));
                            //Response.Cookies.Add(userInfo);

                            //Session["RegId"] = reg.RegId;
                            //Session["CustId"] = reg.UserID;
                            //Session["CategoryId"] = reg.CategoryId;
                            //Session["GrocerId"] = int.Parse(ddlShop.SelectedItem.Value);

                            //int custid = int.Parse(Session["CustId"].ToString());

                            //int catId = int.Parse(Session["CategoryId"].ToString());
                            //if (catId == 1)
                            //{
                            //    Response.Redirect("~/m.app/Admin1/HomeAdmin.aspx");
                            //}
                            //else if (catId == 2)
                            //{
                            //    Response.Redirect("~/m.app/Grocer/GrocerHome.aspx");
                            //}
                            //else if (catId == 3)
                            //{

                            //    Response.Redirect("~/CheckOut.aspx?ProdId=" + Session["ProdId"] + "&CustId=" + Session["CustId"]);

                            //}
                            //else if (catId == 4)
                            //{
                            //    Response.Redirect("~/deliveryForms/DeliveryHome.aspx");
                            //}
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Insert UserName')", true);
                        }
                    }
                }

                Response.Redirect("Login.aspx");
            }
        }
Пример #29
0
        public void getitemcount(int productid, int quantity, string grateid, string itemid)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.AddHeader("Content-Type", "text/html");
            // HttpContext.Current.Response.Write("bhushan");



            using (dbDatabaseDataDataContext db = new dbDatabaseDataDataContext())
            {
                if (quantity != 0)
                {
                    // int custid = int.Parse(HttpContext.Current.Session["CustId"].ToString());
                    // int? regid = (int?)HttpContext.Current.Session["RegId"];
                    int?custid = (int?)HttpContext.Current.Session["CustId"];
                    int?id     = (int?)HttpContext.Current.Session["ProdId"];
                    var check  = (from s in db.tbl_CartDtls where s.GrocerRateID == int.Parse(grateid.ToString()) && s.ItemId == int.Parse(itemid.ToString()) && s.CustomerId == custid && s.PaymentStatus == false select s).FirstOrDefault();
                    if (check == null)
                    {
                        tbl_CartDtl tb = new tbl_CartDtl();
                        tb.CustomerId    = custid;
                        tb.GrocerRateID  = int.Parse(grateid.ToString());
                        tb.Quantity      = int.Parse(quantity.ToString());
                        tb.ItemId        = int.Parse(itemid.ToString());
                        tb.PaymentStatus = false;
                        tb.IsDelete      = false;
                        db.tbl_CartDtls.InsertOnSubmit(tb);
                        db.SubmitChanges();
                        // Response.Redirect("~/frmAddContentToCart.aspx?ProdId=" + id);
                        //  string  message = "";
                        // return message;
                        Console.Write("Item added to cart Successfully");
                        //Server.Transfer("~/frmAddContentToCart.aspx");


                        //   HttpContext.Current.Response.Redirect("~/frmAddContentToCart.aspx");
                    }
                    else
                    {
                        //check.CustomerId = int.Parse(Session["CustID"].ToString());
                        //check.GrocerRateID = int.Parse(grocerrate.ToString());
                        //check.Quantity = int.Parse(FinalCount.ToString());
                        //check.ItemId = int.Parse(abc.ToString());
                        int a = int.Parse(check.Quantity.ToString());
                        check.Quantity      = a + quantity;
                        check.PaymentStatus = false;
                        check.IsDelete      = false;
                        db.SubmitChanges();
                        Console.Write("Item added to cart Successfully");
                        //   System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record Inserted Successfully')", true);
                        //Server.Transfer("~/frmAddContentToCart.aspx");
                        //   HttpContext.Current.Response.Redirect("~/frmAddContentToCart.aspx");
                    }
                }
                else
                {
                    HttpContext.Current.Response.Write("Please Select Quantity of Product");
                    //return (" ");
                    //count++;
                }
            }
        }