protected void Button1_Click(object sender, EventArgs e) { shoppingDataContext sdc = new shoppingDataContext(); var query3 = from u in sdc.users where u.username == TextBox1.Text select u; if (query3.Count() == 0) { if (TextBox6.Text == TextBox7.Text) { MD5 md5 = MD5.Create(); shoppingDataContext sdc2 = new shoppingDataContext(); user user = new user() { username = TextBox1.Text, first_name = TextBox2.Text, last_name = TextBox3.Text, gender = RadioButtonList1.Text, email_id = TextBox4.Text, state = DropDownList1.SelectedItem.Text, city = DropDownList2.SelectedItem.Text, role = "customer", mob_no = long.Parse(TextBox5.Text), question = DropDownList3.SelectedItem.Text, answer = TextBox9.Text, password = GetMD5HashData(TextBox6.Text), }; sdc2.users.InsertOnSubmit(user); sdc2.SubmitChanges(); address add = new address() { address1 = TextBox8.Text, user_id = user.id }; sdc2.addresses.InsertOnSubmit(add); sdc2.SubmitChanges(); Response.Redirect("login.aspx?Data=Successfully Registered"); } else { Label1.Text = "Password does not match..Please try again.."; } } else { Label1.Text = "Username already exists... Please enter another Username..."; } }
protected void Button5_Click(object sender, EventArgs e) { if (ViewState["add"] != null) { int qty = int.Parse(Request.QueryString["qnty"]); int id = int.Parse(Session["cust"].ToString()); string addre = ViewState["add"].ToString(); shoppingDataContext sdc = new shoppingDataContext(); int i = int.Parse(Request.QueryString["data"]); order order = new order() { cust_id = id, prod_id = i, order_date = DateTime.Now.AddDays(0), quantity = qty, amount = int.Parse(ViewState["price"].ToString()) * qty, shipping_address = addre }; sdc.orders.InsertOnSubmit(order); sdc.SubmitChanges(); Response.Redirect("/customer/payment_order.aspx?pro-id=" + i + "&qnty=" + qty); } else { Label10.Text = "Plz select one address.."; } }
protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkRow = (row.Cells[0].FindControl("CheckBox1") as CheckBox); if (chkRow.Checked) { int id = int.Parse(row.Cells[1].Text); shoppingDataContext sdc = new shoppingDataContext(); var query = from d in sdc.products where d.id == id select d; foreach (var q in query) { sdc.products.DeleteOnSubmit(q); } sdc.SubmitChanges(); } } } GridView1.DataSource = null; GridView1.DataBind(); Label2.Text = "Delete Product Successfully"; }
protected void Button2_Click(object sender, EventArgs e) { int i = int.Parse(Request.QueryString["id"]); int qnty = int.Parse(TextBox1.Text); if (int.Parse(TextBox1.Text) != 0) { int cost = int.Parse(TextBox1.Text) * (int.Parse(Label6.Text)); shoppingDataContext sdc2 = new shoppingDataContext(); cart cart = new cart() { quantity = int.Parse(TextBox1.Text), total_cost = cost, cust_id = int.Parse(Session["cust"].ToString()), prod_id = int.Parse(Request.QueryString["id"]) }; sdc2.carts.InsertOnSubmit(cart); sdc2.SubmitChanges(); Label12.Text = "Successfully Added.."; } else { Label12.Text = "Plz select quntity"; } }
protected void Button5_Click(object sender, EventArgs e) { int id = int.Parse(Session["cust"].ToString()); shoppingDataContext sdc = new shoppingDataContext(); int qty = int.Parse(Request.QueryString["qnty"]); int pid = int.Parse(Request.QueryString["pro-id"]); int oid = int.Parse(ViewState["o-id"].ToString()); delivery del = new delivery() { cust_id = id, order_id = oid, delivery_date = DateTime.Now.AddDays(3), delivery_status = "Successfully placed.." }; sdc.deliveries.InsertOnSubmit(del); sdc.SubmitChanges(); var qu = from p in sdc.products where p.id == pid select p; foreach (var q in qu) { ViewState["q"] = q.prod_quantity; } int newqnty = int.Parse(ViewState["q"].ToString()) - qty; var query4 = from c in sdc.products where c.id == pid select c; foreach (var q in query4) { q.prod_quantity = newqnty; } sdc.SubmitChanges(); Response.Redirect("/customer/cust_delivery.aspx?pro-id=" + pid + "&order-id=" + oid); }
protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e) { int index = Convert.ToInt32(e.RowIndex); shoppingDataContext sdc = new shoppingDataContext(); var query = from c in sdc.carts where c.id == int.Parse(GridView1.Rows[index].Cells[0].Text) select c; foreach (var q in query) { sdc.carts.DeleteOnSubmit(q); } sdc.SubmitChanges(); BindGrid(); }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox6.Text != "") { shoppingDataContext sdc = new shoppingDataContext(); int id = int.Parse(Session["cust"].ToString()); address add = new address() { address1 = TextBox6.Text, user_id = id }; sdc.addresses.InsertOnSubmit(add); sdc.SubmitChanges(); } else { Label10.Text = "plz write new address"; } }
protected void Button5_Click(object sender, EventArgs e) { if (TextBox1.Text != "" && TextBox4.Text != "") { shoppingDataContext sdc = new shoppingDataContext(); var query = from u in sdc.users where u.id == int.Parse(ViewState["id"].ToString()) select u; foreach (var q in query) { q.password = GetMD5HashData(TextBox1.Text); } sdc.SubmitChanges(); Response.Redirect("login.aspx?Data=Successfully Updated"); } else { Label3.Text = "Plz fill first..."; } }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox3.Text != "") { int id = int.Parse(Session["admin"].ToString()); shoppingDataContext sdc = new shoppingDataContext(); var query = from s in sdc.users where s.id == id select s; foreach (var q in query) { q.email_id = TextBox3.Text; } sdc.SubmitChanges(); Label2.Text = "Successfully changed"; } else { Label2.Text = "Please fill up first.."; } }
protected void Button1_Click(object sender, EventArgs e) { setcatid(); setcatid2(); shoppingDataContext sdc = new shoppingDataContext(); product product = new product() { prod_name = TextBox1.Text, description = TextBox2.Text, price = int.Parse(TextBox3.Text), discount_price = int.Parse(TextBox4.Text), prod_quantity = int.Parse(TextBox5.Text), size = TextBox6.Text, cat_id = cat_id_1, cat_id_2 = cat_id_2_1, }; sdc.products.InsertOnSubmit(product); sdc.SubmitChanges(); Label2.Text = "Product is successfully added"; }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox2.Text != "" && TextBox7.Text != "") { int id = int.Parse(Session["admin"].ToString()); MD5 md5 = MD5.Create(); shoppingDataContext sdc = new shoppingDataContext(); var query = from s in sdc.users where s.id == id select s; foreach (var q in query) { q.password = GetMD5HashData(TextBox2.Text); } sdc.SubmitChanges(); Label2.Text = "Successfully changed"; } else { Label2.Text = "Please fill up first.."; } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox8.Text != "") { int id = int.Parse(Session["cust"].ToString()); int pid = int.Parse(Request.QueryString["pro-id"]); shoppingDataContext sdc = new shoppingDataContext(); feedback feed = new feedback() { prod_id = pid, cust_id = id, message = TextBox8.Text }; sdc.feedbacks.InsertOnSubmit(feed); sdc.SubmitChanges(); Label9.Text = "Successfully Submitted"; } else { Label9.Text = "Please fill first.."; } }
protected void Button9_Click(object sender, EventArgs e) { MultiView1.ActiveViewIndex = 2; if (TextBox4.Text == "") { Label4.Text = "plz fill first..."; } else { shoppingDataContext sdc = new shoppingDataContext(); var query = from d in sdc.products where d.id == int.Parse(ViewState["id"].ToString()) select d; foreach (var q in query) { q.discount_price = int.Parse(TextBox4.Text); } sdc.SubmitChanges(); Label4.Text = "successfully updated"; } }