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 { } }