Exemplo n.º 1
0
        void cartItemDetails()
        {
            try
            {
                string userid = Convert.ToString(Session["customeruserid"]);

                DataTable ds = objshow.cartItemsDetails(userid);
                if (ds.Rows.Count > 0)
                {
                    dlitems.DataSource = ds;
                    dlitems.DataBind();
                    ds1 = objshow.cartItemsTotal(userid);
                }



                else
                {
                    dlitems.DataSource = null;
                    dlitems.DataBind();
                    lblcartmsg.InnerText = "Your Cart Is Empty";
                    lblprice.Visible     = false;
                    masterpage master = Master as masterpage;
                    master.cartItems();
                    btnshopping.Visible = true;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
            }
        }
Exemplo n.º 2
0
 protected void dlitems_ItemCommand(object source, DataListCommandEventArgs e)
 {
     try
     {
         int    Id            = Convert.ToInt32(e.CommandArgument);
         string userid        = Convert.ToString(Session["customeruserid"]);
         int    Issuccessfull = objedit.deleteCartItems(userid, Id);
         if (Issuccessfull == 1)
         {
             masterpage master = Master as masterpage;
             master.cartItems();
             cartItemDetails();
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertsuccess()", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
     }
 }
Exemplo n.º 3
0
        protected void dlitems_ItemCommand(object source, DataListCommandEventArgs e)
        {
            try
            {
                string userid = Convert.ToString(Session["customeruserid"]);

                int Id = Convert.ToInt32(e.CommandArgument);

                string currentcity = Convert.ToString(Session["city"]);

                #region command name = Add Items

                if (e.CommandName == "add")
                {
                    if (userid != "")
                    {
                        #region code to checking existing order


                        DataTable objdt = objshow.cartItems(userid, Id);
                        if (objdt.Rows.Count == 0)
                        {
                            #region code to make order


                            DataTable objdtcity = objshow.chkItemsCity(Id);
                            if (objdtcity.Rows.Count > 0)
                            {
                                string city = Convert.ToString(objdtcity.Rows[0]["city"]);

                                if (city.ToUpper() == currentcity.ToUpper())
                                {
                                    int Issuccessfull = objinsert.makeOrder(Id, userid);
                                    if (Issuccessfull == 1)
                                    {
                                        masterpage master = Master as masterpage;
                                        master.cartItems();

                                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertsuccess()", true);
                                    }
                                    else
                                    {
                                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
                                    }
                                }
                                else
                                {
                                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertcityerror()", true);
                                }
                            }


                            #endregion
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "productexist()", true);
                        }

                        #endregion
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertwarning()", true);
                    }
                }

                #endregion

                #region command name = Wishlist


                else if (e.CommandName == "wishlist")
                {
                    if (userid != "")
                    {
                        #region code to checking existing wishlist


                        DataTable objdt = objshow.wishlistItems(userid, Id);
                        if (objdt.Rows.Count == 0)
                        {
                            #region code to make wishlist

                            int Issuccessfull = objinsert.makeWishlist(Id, userid);
                            if (Issuccessfull == 1)
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertwishlist()", true);
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
                            }

                            #endregion
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "productexist()", true);
                        }

                        #endregion
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alertwarning()", true);
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "alerterror()", true);
            }
        }
Exemplo n.º 4
0
        void confirmOrder()
        {
            try
            {
                Page.Validate();
                if (!Page.IsValid)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "warningmodal()", true);
                }
                else
                {
                    #region receiptno

                    string    receiptno = "";
                    DataTable dt        = objshow.receiptnoGeneration();
                    if (dt.Rows.Count > 0)
                    {
                        receiptno = "rec00" + dt.Rows[0]["LastID"].ToString();
                    }

                    #endregion

                    #region order no


                    string orderno = "orderno10" + dt.Rows[0]["LastID"].ToString();

                    #endregion

                    string totalamt = "";

                    string userid      = Convert.ToString(Session["customeruserid"]);
                    string address     = txtaddress.Value;
                    string email       = txtemail.Value;
                    string state       = txtstate.Value;
                    string city        = txtcity.Value;
                    long   pincode     = Convert.ToInt64(txtpincode.Value);
                    long   contactno   = Convert.ToInt64(txtcontactno.Value);
                    string paymentmode = rdbpayment.SelectedValue;


                    #region receipt generation

                    DataSet ds = objshow.cartItemsTotal(userid);

                    if (ds.Tables.Count > 0)
                    {
                        totalamt = ds.Tables[0].Rows[0]["total"].ToString();



                        objinsert.receipt(userid, receiptno, totalamt, orderno);
                    }

                    #endregion

                    #region upi details

                    string upiid = txtupiid.Value;

                    #endregion

                    #region debit card details

                    string cvv       = txtcvv.Value;
                    string deb1      = txtdb1.Value;
                    string deb2      = txtdb2.Value;
                    string deb3      = txtdb3.Value;
                    string deb4      = txtdb4.Value;
                    string debitcard = txtdb1.Value + txtdb2.Value + txtdb3.Value + txtdb4.Value;

                    #endregion

                    #region payment mode

                    objinsert.paymentmode(userid, orderno, paymentmode, upiid, debitcard, cvv);

                    #endregion

                    #region data insertion

                    int count = dlitems.Items.Count;

                    int Issuccessfull = 0;

                    for (int i = 0; i < count; i++)
                    {
                        HiddenField hdfid = dlitems.Items[i].FindControl("hdfid") as HiddenField;
                        int         Id    = Convert.ToInt32(hdfid.Value);



                        Issuccessfull = objedit.makeOrderConfirm(userid, orderno, address, city, state, pincode, contactno, paymentmode, email, Id);
                    }

                    #endregion

                    if (Issuccessfull == 1)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "successmodal()", true);
                        cartItemDetails();
                        masterpage master = Master as masterpage;
                        master.cartItems();
                    }

                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "errormodal()", true);
                    }
                }
            }


            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Popup", "errormodal()", true);
            }
        }