protected void btnLogin_Click(object sender, EventArgs e) { string query = "select count(*) from tblRegisteration where EmailId = '" + txtEmail.Text + "' and Password = '******'"; string res = c1.SelectScalar(query); if (int.Parse(res) == 1) { Session.Add("userId", txtEmail.Text); Response.Redirect("Index.aspx"); } else { lblMsg.Text = "Either EmailId or Password is wrong"; } }
protected void btnSubmit_Click(object sender, EventArgs e) { lblMessage.Visible = false; string query = "select count(*) from tblRegisteration where EmailId = '" + txtEmail.Text + "'"; string res = c1.SelectScalar(query); if (int.Parse(res) == 0) { query = "insert into tblRegisteration(FirstName,LastName,EmailId,Password,MobileNo)values('" + txtFirst.Text + "','" + txtSecond.Text + "','" + txtEmail.Text + "','" + txtCPassword.Text + "','" + txtMobile.Text + "')"; c1.ExecuteQry(query); Response.Redirect("ConfirmRegistration.aspx"); } else { lblMessage.Visible = true; } }
protected void btnConfirmOrder_Click(object sender, EventArgs e) { string query = ""; string orderno = "select max(OrderNo) from tblOrderDetail"; int orderNo = int.Parse(con.SelectScalar(orderno)); orderNo = orderNo + 1; if (Session["userId"] != null) { query = "insert into tblOrderDetail values('" + orderNo + "','" + Session["userId"].ToString() + "','" + Session["item_id"].ToString() + "','" + Session["quantity"].ToString() + "','" + txtAddress1.Text + "','" + txtAddress2.Text + "','" + txtAddress3.Text + "','" + txtCity.Text + "','" + txtPincode.Text + "','Pending')"; } else { query = "insert into tblOrderDetail values('" + orderNo + "','" + Session["userId"].ToString() + "','" + Session["item_id"].ToString() + "','" + Session["quantity"].ToString() + "','" + txtAddress1.Text + "','" + txtAddress2.Text + "','" + txtAddress3.Text + "','" + txtCity.Text + "','" + txtPincode.Text + "','Pending')"; } con.ExecuteQry(query); query = "delete from tblCart where userid = '" + Session["userId"] + "'"; con.ExecuteQry(query); Response.Redirect("ConfirmOrder.aspx"); }