Beispiel #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            using (var db = new bigshopeEntities())
            {
                if (Request.QueryString["gen_id"] != null)
                {
                    int    gen_id = Convert.ToInt32(Request.QueryString["gen_id"]);
                    tblGen g      = db.tblGens.FirstOrDefault(v => v.gen_id == gen_id);
                    g.gen_name = tbName.Text;
                    g.gen_desc = tbDesc.Text;
                    db.SaveChanges();

                    lblStatus.Text = "Generation updated successfully!";
                    Response.Redirect("catagoriesrecord.aspx");
                }
                else
                {
                    db.addGenration(tbName.Text, tbDesc.Text);
                    db.SaveChanges();
                    tbName.Text    = "";
                    tbDesc.Text    = "";
                    lblStatus.Text = "New gen added successfully!";
                }
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            using (var db = new bigshopeEntities())
            {
                if (Request.QueryString["brnd_id"] != null)
                {
                    int      brnd_id = Convert.ToInt32(Request.QueryString["brnd_id"]);
                    tblBrand b       = db.tblBrands.FirstOrDefault(v => v.brnd_id == brnd_id);
                    b.brnd_name = tbName.Text;
                    b.brnd_desc = tbDesc.Text;
                    db.SaveChanges();

                    lblStatus.Text = "Brands updated successfully!";
                    Response.Redirect("catagoriesrecord.aspx");
                }
                else
                {
                    db.addBrands(tbName.Text, tbDesc.Text);
                    db.SaveChanges();
                    tbName.Text    = "";
                    tbDesc.Text    = "";
                    lblStatus.Text = "Brand added successfully!";
                }
            }
        }
Beispiel #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            using (var db = new bigshopeEntities())
            {
                if (Request.QueryString["proc_id"] != null)
                {
                    int          proc_id = Convert.ToInt32(Request.QueryString["proc_id"]);
                    tblProcessor p       = db.tblProcessors.FirstOrDefault(v => v.proc_id == proc_id);
                    p.proc_name = tbName.Text;
                    p.proc_desc = tbDesc.Text;
                    db.SaveChanges();

                    lblStatus.Text = "Processor updated successfully!";
                    Response.Redirect("catagoriesrecord.aspx");
                }
                else
                {
                    db.addProc(tbName.Text, tbDesc.Text);
                    db.SaveChanges();
                    tbName.Text    = "";
                    tbDesc.Text    = "";
                    lblStatus.Text = "New processor added successfully!";
                }
            }
        }
Beispiel #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            using (var db = new bigshopeEntities())
            {
                if (Request.QueryString["prod_id"] != null)
                {
                    int        prod_id = Convert.ToInt32(Request.QueryString["prod_id"]);
                    tblProduct p       = db.tblProducts.FirstOrDefault(v => v.prod_id == prod_id);
                    p.prod_name  = tbName.Text;
                    p.prod_desc  = tbDesc.Text;
                    p.prod_price = Convert.ToInt32(tbPrice.Text);
                    p.prod_qnty  = Convert.ToInt32(tbQty.Text);
                    p.prod_ram   = tbRAM.Text;

                    db.SaveChanges();
                    Response.Redirect("productrecord.aspx");
                }
                else
                {
                    //Forign Keys
                    int brnd_key = Convert.ToInt32(slctBrand.SelectedValue);
                    int proc_key = Convert.ToInt32(slctProc.SelectedValue);
                    int gen_key  = Convert.ToInt32(slctGen.SelectedValue);

                    String img       = fileImage.FileName.ToString();
                    int    prod_qnty = Convert.ToInt32(tbQty.Text);

                    string folderPath = Server.MapPath("Files/");

                    //Check whether Directory (Folder) exists.
                    if (Directory.Exists(folderPath) != true)
                    {
                        //If Directory (Folder) does not exists Create it.
                        Directory.CreateDirectory(folderPath + fileImage.FileName);
                    }

                    //Save the File to the Directory (Folder).
                    fileImage.SaveAs(folderPath + Path.GetFileName(fileImage.FileName));

                    db.addProducts(tbName.Text, tbDesc.Text, tbPrice.Text, img, prod_qnty, tbRAM.Text, brnd_key, proc_key, gen_key);

                    lblStatus.Text = "Product added successfully!";
                    tbName.Text    = "";
                    tbDesc.Text    = "";
                    tbPrice.Text   = "";
                    tbQty.Text     = "";
                    tbRAM.Text     = "";

                    db.SaveChanges();
                }
            }
        }
Beispiel #5
0
 protected void GV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "delete")
     {
         using (var db = new bigshopeEntities())
         {
             int client_id = Convert.ToInt32(e.CommandArgument);
             db.deleteCustomer(client_id);
             db.SaveChanges();
             FillClients();
         }
     }
 }
Beispiel #6
0
 protected void GV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "edit")
     {
         Response.Redirect("setupproducts.aspx?prod_id=" + e.CommandArgument);
     }
     else if (e.CommandName == "delete")
     {
         using (var db = new bigshopeEntities())
         {
             int prod_id = Convert.ToInt32(e.CommandArgument);
             db.deleteProduct(prod_id);
             db.SaveChanges();
             FillProducts();
         }
     }
 }
        protected void btnCheckOut_Click(object sender, EventArgs e)
        {
            var gateway = new StripeGateway("sk_test_Biqolmcf9wmzviLy2J0xHfjg");

            var cardToken = gateway.Post(new CreateStripeToken
            {
                Card = new StripeCard
                {
                    Name           = tbFName.Text + tbLName.Text,
                    Number         = tbCardNo.Text,
                    Cvc            = tbCVC.Text,
                    ExpMonth       = Convert.ToInt32(tbMonth.Text),
                    ExpYear        = Convert.ToInt32(tbYear.Text),
                    AddressLine1   = tbAddress.Text,
                    AddressLine2   = tbAddress.Text,
                    AddressZip     = tbCity.Text,
                    AddressState   = tbState.Text,
                    AddressCountry = "Pakistan",
                },
            });

            var customer = gateway.Post(new CreateStripeCustomerWithToken
            {
                Card        = cardToken.Id,
                Description = "Purchasing Purpose",
                Email       = tbEmail.Text,
            });
            var temp   = customer.Id;
            var charge = gateway.Post(new ChargeStripeCustomer
            {
                Amount      = 100 * 10,
                Customer    = customer.Id,
                Currency    = "usd",
                Description = "Test Charge Customer",
            });


            using (var db = new bigshopeEntities())
            {
                tblCustomer cus = new tblCustomer();
                cus.customer_name     = tbFName.Text;
                cus.customer_surname  = tbLName.Text;
                cus.customer_email    = tbEmail.Text;
                cus.customer_phone    = tbPhone.Text;
                cus.customer_address  = tbAddress.Text;
                cus.customer_city     = tbCity.Text;
                cus.customer_address  = tbAddress.Text;
                cus.customer_city     = tbCity.Text;
                cus.customer_state    = tbState.Text;
                cus.customer_zip      = Convert.ToInt32(tbPost.Text);
                cus.customer_password = EncDec.Encrypt(tbPass.Text);
                //cus.customer_stripe_id = "sk_test_Biqolmcf9wmzviLy2J0xHfjg";
                cus.customer_stripe_id = temp;
                db.tblCustomers.Add(cus);
                db.SaveChanges();

                // Order Insertion
                tblOrder order = new tblOrder();
                order.order_prod_id      = 1;
                order.order_total_amount = Request.Cookies["grandTotal"].Value.ToString();
                order.order_time         = DateTime.Now;
                db.tblOrders.Add(order);
                db.SaveChanges();

                //sendMail();

                Response.Redirect("thanks_for_shopping.aspx");
            }
        }