protected void btnsubmit_Click(object sender, EventArgs e) { nszillow.clsappprp objprp = new nszillow.clsappprp(); nszillow.clsapp obj = new nszillow.clsapp(); objprp.appdat = Convert.ToDateTime(txtboxdate.Text + " 00:00:00"); objprp.appphn = txtboxphn.Text; objprp.appdsc = txtboxdsc.Text; objprp.appusrcod = Convert.ToInt32(Session["cod"]); objprp.appprpcod = Convert.ToInt32(Request.QueryString["pcod"]); objprp.appsts = 'B'; List <nszillow.clsusrprp> usrdet; nszillow.clsusr fndusr = new nszillow.clsusr(); usrdet = fndusr.Find_Rec(objprp.appusrcod); try { obj.Save_Rec(objprp); String usreml = obj.findagtbyapp(objprp.appprpcod); MailMessage mailMessage = new MailMessage("*****@*****.**", usreml); mailMessage.Subject = "Appointment Booked!!"; mailMessage.Body = "Appointment booked by " + usrdet[0].usreml + " on " + objprp.appdat.ToShortDateString() + ". You can contact the user at " + objprp.appphn; SmtpClient smtpClient = new SmtpClient(); smtpClient.Send(mailMessage); nszillow.misc.showMessageAndRedirect("Appointment Booked Successfully", "frmsrc.aspx"); } catch { } }
protected void Button1_Click(object sender, EventArgs e) { if (Page.IsValid) { nszillow.clsusr obj = new nszillow.clsusr(); nszillow.clsusrprp objprp = new nszillow.clsusrprp(); objprp.usreml = TextBox2.Text; objprp.usrregdat = DateTime.Now; objprp.usrrol = 'A'; String pwd = Guid.NewGuid().ToString(); pwd = pwd.Substring(0, 9); objprp.usrpwd = pwd; try { Int32 usrcod = obj.Save_Rec(objprp); nszillow.clsagt obj1 = new nszillow.clsagt(); nszillow.clsagtprp objprp1 = new nszillow.clsagtprp(); objprp1.agtloccod = Convert.ToInt32(DropDownList2.SelectedValue); objprp1.agtnam = TextBox1.Text; objprp1.agtpic = ""; objprp1.agtprf = ""; objprp1.agtser = ""; objprp1.agtusrcod = usrcod; try { obj1.Save_Rec(objprp1); clearAll(); divSuc.Visible = true; divFail.Visible = false; divEmailExists.Visible = false; MailMessage mailMessage = new MailMessage("*****@*****.**", objprp.usreml); mailMessage.Subject = "Welcome to Zillow!!"; mailMessage.Body = "Your Password is " + pwd + ". Please Update Your Password as you login first time."; SmtpClient smtpClient = new SmtpClient(); smtpClient.Send(mailMessage); } catch { divFail.Visible = true; divSuc.Visible = false; divEmailExists.Visible = false; } } catch (SqlException exp) { if (exp.Message.StartsWith("Violation of UNIQUE KEY constraint")) { divEmailExists.Visible = true; divFail.Visible = false; divSuc.Visible = false; } } } }
protected void btncreateaccount_Click(object sender, EventArgs e) { nszillow.clsusr obj = new nszillow.clsusr(); nszillow.clsusrprp objprp = new nszillow.clsusrprp(); objprp.usreml = txtbxemail.Text; objprp.usrpwd = txtbxpw.Text; objprp.usrregdat = DateTime.Now; objprp.usrrol = 'U'; try { obj.Save_Rec(objprp); } catch { } }
protected void btn1_Click(object sender, EventArgs e) { if (Page.IsValid) { nszillow.clsusr obj = new nszillow.clsusr(); Int32 cod; Char rol; cod = obj.logincheck(txteml.Text, txtpwd.Text, out rol); if (cod == -1 || cod == -2) { dvMessage.Visible = true; Label1.Text = "Email or Password Incorrect"; } else { FormsAuthenticationTicket tk = new FormsAuthenticationTicket(1, txteml.Text, DateTime.Now, DateTime.Now.AddHours(2), false, rol.ToString()); String s = FormsAuthentication.Encrypt(tk); HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, s); Response.Cookies.Add(ck); Session["cod"] = cod; if (rol == 'A') { Response.Redirect("agent/frmprf.aspx"); } else if (rol == 'D') { //FormsAuthentication.RedirectFromLoginPage() //FormsAuthentication.RedirectFromLoginPage("ADMIN", false); //Session["userLoggedIn"] = false; Response.Redirect("admin/frmcty.aspx"); } else if (rol == 'U') { Session["userLoggedIn"] = true; Response.Redirect("index.aspx"); } } } }