protected void PayNow_btn_Click(object sender, EventArgs e) { try { bh = new BussinessHandler(); Button btn = (Button)sender; GridViewRow selectedRow = (GridViewRow)btn.NamingContainer; int orderid = Convert.ToInt32(selectedRow.Cells[0].Text); int status = bh.PayInstallment(orderid); if (status == 0) { Response.Write("<script>alert('Payment Failed')</script>"); } else { Response.Write("<script>alert('Payment Successful')</script>"); } allEMI_dt = bh.GetAllEMIHistory(username); FillActiveEMITable(); FillOrderHistory(username); } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Error During Payment :" + errormessage + "');</script>"); } }
protected void Login_Click(object sender, EventArgs e) { try { BussinessHandler bh = new BussinessHandler(); var x = bh.Authorize(username.Text, password.Text); if (x == null) { Response.Write("<script>alert('Invalid UserName or Password');</script>"); } else if (x.TableName == "admin") { Session["Username"] = "******"; Response.Redirect("AdminPage.aspx"); } else { Session["Username"] = x.Rows[0]["username"].ToString(); Session["Verified"] = x.Rows[0]["verified"].ToString(); Session["CardTypeid"] = x.Rows[0]["cardtypeid"].ToString(); Session["Validated"] = x.Rows[0]["activationstatus"].ToString(); Response.Redirect("Dashboard.aspx"); } } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Error Signing In :" + errormessage + "');</script>"); } }
protected void TicketCompleted_CheckedChanged(object sender, EventArgs e) { try { CheckBox chkBx = sender as CheckBox; GridViewRow row = chkBx.NamingContainer as GridViewRow; CheckBox chk = (CheckBox)row.FindControl("TicketCompleted"); BussinessHandler bh = new BussinessHandler(); bool isSelected = chk.Checked; //string uname = (row.FindControl("username") as Label).Text; string uname = row.Cells[0].Text; int check = Convert.ToInt32(isSelected); int n = bh.VerifyFunction(uname, check); //GridView1234.EditIndex = -1; this.BindGrid(); this.BindGrid1(); } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Session Expired :" + errormessage + "');</script>"); Response.Redirect("Index.aspx"); } //if (n > 0) // Response.Write("Successfully verified"); //if (chk.Checked) //{ // Response.Write("<script>alert('checked Called');</script>"); // //string ID = ((Label)row.FindControl("supid")).Text; //} }
protected void Page_Load(object sender, EventArgs e) { CheckBox checkbox1 = (CheckBox)FormView1.FindControl("Checkbox1"); Label lblLogin = (Label)Page.Master.FindControl("Label1"); //checkbox1.AutoPostBack = true; //if (!IsPostBack) // checkbox1.CheckedChanged += CheckBox1_CheckedChanged; if (!Session.IsNewSession) { lblLogin.Text = Session["Username"].ToString(); } else { lblLogin.Text = "{{Anonymous}}"; } //Session["validity"] = "2020-03-25"; if (!IsPostBack) { BussinessHandler bh = new BussinessHandler(); // Response.Write(Session["ProductId"]); DataSet ds = bh.GetProductInfo((int)Session["ProductId"]); FormView1.DataSource = ds.Tables[0]; FormView1.DataBind(); } DropDownList DropDownList1 = (DropDownList)FormView1.FindControl("DropDownList1"); int selectedTenureId = Convert.ToInt32(DropDownList1.SelectedItem.Value); DateTime vdate = Convert.ToDateTime(Session["validity"].ToString()); DateTime newdate = DateTime.Now.Date.AddMonths(selectedTenureId * 3); // Response.Write(newdate); Label Label3 = (Label)FormView1.FindControl("Label3"); Label Label7 = (Label)FormView1.FindControl("Label7"); Label7.Text = "₹ " + (Convert.ToInt32(Session["price"]) / (selectedTenureId * 3)).ToString(); Button Button1 = (Button)FormView1.FindControl("Button1"); if (checkbox1 == null || checkbox1.Checked == true) { Label3.Text = ""; Button1.Enabled = true; } if (DateTime.Compare(vdate, newdate) < 0) { Label3.Text = "Sorry, your EMI tenure exceeds your card validity period. Please select again."; Button1.Enabled = false; } Label Label2 = (Label)FormView1.FindControl("Label2"); Session["schemeid"] = selectedTenureId; //Label2.Text = selectedCategory.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { try { BussinessHandler bh = new BussinessHandler(); if (bh.RegisterFunction (name.Text, Convert.ToInt64(phoneno.Text), email.Text, username.Text, address.Text, password.Text, Convert.ToDateTime(TextBox1.Text), Convert.ToInt32(RadioButtonList1.SelectedValue), Convert.ToInt32(selectbank.SelectedValue), Convert.ToInt32(accountno.Text), Convert.ToInt32(ifsccode.Text), false, 1234) > 1) { try { Session["Username"] = username.Text; Response.Write("<script>alert('Registered');</script>"); MailMessage mail = new MailMessage(); mail.To.Add("*****@*****.**"); mail.From = new MailAddress("*****@*****.**"); mail.Subject = "Email using Gmail"; string Body = username.Text + " succesfully registered"; mail.Body = Body; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp-mail.outlook.com";//"smtp.gmail.com"; //Or Your SMTP Server Address smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "20Aug1997"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Send(mail); } catch (SmtpException ex) { string errormessage = ex.Message; Response.Write("<script>alert('Error Sending Mail:" + errormessage + "');</script>"); Response.Redirect("Dashboard.aspx"); } Response.Redirect("Dashboard.aspx"); } else { Response.Write("<script>alert('Registeration Error');</script>"); } } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Error Registering In :" + errormessage + "');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { this.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; try { Label lblLogin = (Label)Page.Master.FindControl("Label1"); if (!Session.IsNewSession) { lblLogin.Text = Session["Username"].ToString(); } else { lblLogin.Text = "{{Anonymous}}"; } BussinessHandler bh = new BussinessHandler(); DataSet ds = bh.GetCategories(); // //Response.Write(selectedCategory); // if (!IsPostBack) { if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { DropDownList1.DataSource = ds.Tables[0]; DropDownList1.DataTextField = ds.Tables[0].Columns["categoryname"].ToString(); DropDownList1.DataValueField = ds.Tables[0].Columns["categoryid"].ToString(); DropDownList1.DataBind(); } } int selectedCategory = Convert.ToInt32(DropDownList1.SelectedItem.Value); productset = bh.GetProductsToCart(Session["Username"].ToString(), selectedCategory); ListView1.DataSource = productset.Tables[0]; //Label1.Text = DropDownList1.SelectedItem.Value.ToString(); ListView1.DataBind(); } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Session Expired :" + errormessage + "');</script>"); Response.Redirect("Index.aspx"); } // }
public string sendSMS() { string result = ""; try { BussinessHandler bh = new BussinessHandler(); var x = bh.GetMobileNumber(username.Text); if (x == null) { Response.Write("<script>alert('Invalid UserName');</script>"); } else { number = x.Rows[0]["phoneno"].ToString(); } Random r = new Random(); int m = r.Next(100000, 1000000); otphidden.Text = m.ToString(); //String number = Phoneno.Text; String message = HttpUtility.UrlEncode("This is your OTP to reset password:"******". OTP expires in 10 minutes."); using (var wb = new WebClient()) { byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection() { { "apikey", "RZIjimkiHQY-PwCs2bMnmVhRxtkK6gm0ZlFVgxqDzV" }, { "numbers", number }, { "message", message }, { "sender", "TXTLCL" } }); result = System.Text.Encoding.UTF8.GetString(response); //return 1; } return(result); } catch (Exception) { Response.Write("<script>alert('Invalid UserName');</script>"); } return(result); }
protected void BindGrid1() { this.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; try { BussinessHandler bh = new BussinessHandler(); GridView1.DataSource = bh.GetVerifiedUserFunction(); GridView1.DataBind(); } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Session Expired :" + errormessage + "');</script>"); Response.Redirect("Index.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { try { BussinessHandler bh = new BussinessHandler(); bool PaymentSuccessful = bh.OrderProduct(Session["username"].ToString(), Convert.ToInt32(Session["productid"]), Convert.ToInt32(Session["schemeid"])); if (PaymentSuccessful) { try { MailMessage mail = new MailMessage(); mail.To.Add("*****@*****.**"); mail.From = new MailAddress("*****@*****.**"); mail.Subject = "Update" + username; string Body = "Order by " + username + " Placed successfully"; mail.Body = Body; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp-mail.outlook.com";//"smtp.gmail.com"; //Or Your SMTP Server Address smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "20Aug1997"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Send(mail); } catch (SmtpException ex) { string errormessage = ex.Message; Response.Write("<script>alert('Error Sending Mail :" + errormessage + "');</script>"); } Response.Redirect("Payment.aspx"); } } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('Internal Payment Error :" + errormessage + "');</script>"); } }
protected void CheckUserNameAvailability(object sender, EventArgs e) { try { BussinessHandler bh = new BussinessHandler(); if (bh.UserExists(username.Text)) { UpdateMsg.Text = "User Already Exists"; } else { UpdateMsg.Text = "Valid Username"; } } catch (Exception ex) { UpdateMsg.Text = "Error Checking in DB:" + ex.Message; } }
protected void Button1_Click(object sender, EventArgs e) { try { BussinessHandler bh = new BussinessHandler(); var x = bh.UpdatePassword(Username, confirmpassword.Text); if (x > 0) { Response.Write("<script>alert('Your Password has been updated');</script>"); } else { Response.Write("<script>alert('There was some error');</script>"); } } catch (Exception ex) { string errormessage = ex.Message; Response.Write("<script>alert('DB Connection failed :" + errormessage + "');</script>"); Response.Redirect("Index.aspx"); } }