protected void btnSignUp_Click(object sender, EventArgs e) { Model.User u = new Model.User(); Random rnd = new Random(); u.Uid = rnd.Next(1, 999999); u.Uname = TxtName.Text; u.Uusername = TxtUsername.Text; u.Upassword = EncryptionDecryption.EncodePasswordToBase64(TxtPassword.Text); u.Uemail = TxtEmail.Text; u.UDOB = DateTime.ParseExact(TxtDob.Text, "yyyy-MM-dd", null); u.Umobile = TxtMobile.Text; u.Udate = DateTime.Now; u.Urole = "user"; u.Uaddress = TxtAddress.Text; u.Uimage = u.Uid + ".jpeg"; string gender = "Male"; if (Male.Checked) { gender = Male.Text; } else if (Female.Checked) { gender = Female.Text; } else if (Other.Checked) { gender = Other.Text; } u.Ugender = gender; Controller.User uc = new Controller.User(); if (uc.ValidateUser(u)) { Response.Write("<script language=javascript>alert('Successfully Registered');</script>"); Response.AppendHeader("Refresh", "5;url=Login.aspx"); RedirectMessage.Text = "You will now be redirected to Login Page in 5 seconds"; RedirectMessage.Visible = true; //Response.Redirect("Login.aspx"); } else { Response.Write("<script language=javascript>alert('User Already Exists');</script>"); Response.AppendHeader("Refresh", "5;url=Login.aspx"); RedirectMessage.Text = "You will now be redirected to Login Page in 5 seconds"; RedirectMessage.Visible = true; } }
protected void BtnConfirm_Click(object sender, EventArgs e) { Controller.Payment pyc = new Controller.Payment(); Model.Payment py = new Model.Payment(); Random rnd = new Random(); py.Payment_id = rnd.Next(19898876, 99999999); Session["PaymentId"] = py.Payment_id; py.CardNumber = DebitCard.Text; py.ExpiryDate = ExpiryMonth.Text + "/" + ExpiryYear.Text; py.Cvv = EncryptionDecryption.EncodePasswordToBase64(CVVCode.Text); py.Uid = int.Parse(Session["UserId"].ToString()); py.Cart_id = int.Parse(Session["CartId"].ToString()); py.Ship_id = int.Parse(Request.QueryString["shipid"].ToString()); py.Totalamount = double.Parse(Session["TotalAmount"].ToString()); py.Status = "paid"; py.Paymentdate = DateTime.Now; bool status = pyc.ValidatePayment(py); if (status) { Response.Redirect("PaymentSuccessful.aspx"); } }