protected void btnCreateMyAccount_Click(object sender, EventArgs e) { if (Page.IsValid) { companyBAL.CompanyName = txtCompany.Text.Trim(); companyBAL.Subdomain = txtSubdomain.Text.Trim(); companyBAL.CardNumber = txtCardNumber.Text.Trim(); companyBAL.ExpiresOn = ddlMonth.SelectedValue + "-" + ddlYear.SelectedValue; companyBAL.BillingZip = txtBillingZip.Text.Trim(); companyBAL.Coupon = txtCoupon.Text.Trim(); companyBAL.PaymentPlanId = paymentPlanId; try { companyId = companyBAL.CompanyInsert(); } catch (SqlException ex) { Response.Write(ex.Message); } userBAL.FirstName = txtFirstName.Text.Trim(); userBAL.LastName = txtLastName.Text.Trim(); userBAL.Email = txtEmail.Text.Trim(); userBAL.UserName = txtUserName.Text.Trim(); userBAL.UserPassword = txtPassword2.Text.Trim(); userBAL.Title = ""; userBAL.OfficeNo = ""; userBAL.MobileNo = ""; userBAL.UserRoleId = 1; userBAL.CompanyId = companyId; try { userBAL.UserId = userBAL.UserInsert(); dt = userBAL.UserSelect(); if (dt.Rows.Count > 0) { Session["UserName"] = dt.Rows[0]["UserName"].ToString(); Session["UserId"] = dt.Rows[0]["UserId"].ToString(); Session["CompanyId"] = dt.Rows[0]["CompanyId"].ToString(); Session["ProjectId"] = 1; Session["ProjectName"] = "Project 1"; Session["RoleName"] = dt.Rows[0]["RoleName"].ToString(); Response.Redirect("~/FirstVisit.aspx"); } } catch (SqlException ex) { Response.Write(ex.Message); } //RestartPage(); } }
protected void btnSend_Click(object sender, EventArgs e) { usersBAL.UserName = txtForgotUserName.Text; usersBAL.UserPassword = ""; try { dataTable = usersBAL.UserSelect(); } catch (Exception ex) { lblErrorMsg.Text = "Some Problem With Forgot Password !" + ex.Message; } if (dataTable.Rows.Count > 0) { commonClassDAL.sendEmail(dataTable.Rows[0]["UserPassword"].ToString(), "", "WebKred <br/><br/> Your User Name is : " + txtForgotUserName.Text + "<br/>Your Password is: " + dataTable.Rows[0]["UserPassword"].ToString(), "Your Forgotten Password from WebKred"); lblErrorMsg.Text = "Your Password Has Been Sent To Your Email ID !"; } else { lblErrorMsg.Text = "User Does Not Exist Please Try Again !"; } }