protected void btnReset_Click(object sender, EventArgs e) { UserBAL userBAL = new UserBAL(); UserBE user = new UserBE(); LoggedIn master = (LoggedIn)this.Master; if (txtOldPass.Text == commonBAL.Decrypt(((UserBE)Session["LoggedInUser"]).EncPass.ToString(), false)) { user.UserId = Convert.ToInt32(((UserBE)Session["LoggedInUser"]).UserId); user.EncPass = commonBAL.Encrypt(txtNewPass.Text, false); if (txtNewPass.Text == txtconfirmPass.Text) { if (userBAL.ResetPassword(user)) { master.ShowMessage("Password Changed Successfully", true); } else { master.ShowMessage("Unsuccessful", false); } } else { master.ShowMessage("Password Mismatched", false); } } else { master.ShowMessage("Incorrect Old Password", false); } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; string msg = Request.QueryString["Message"]; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); return; } else { if (!IsPostBack) { lblPageSize.Visible = false; ddlPageSize.Visible = false; LvHomePageItems.Visible = false; HomePageDataPager.Visible = false; } } MaintainScrollPositionOnPostBack = true; }
protected void Page_Load(object sender, EventArgs e) { //First check, if LoggedInUser exists i.e. no timeout yet - check in Session["LoggedInUser"] if null or not //Second check, if LoggedInUser has access right to this page - use Session["UserAccessRights"] and if this page has // at least one function (i.e. Add, Delete....) true for this page in at least one of the role LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("You are not authorised to access this page. Please contact system administrator.", false); // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage string msg = Request.QueryString["Message"]; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); return; } else { setBreadCrumb(); } }
protected void btnSavePassword_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtPassword.Text) || string.IsNullOrWhiteSpace(txtConfirmPassword.Text)) ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Please enter Password');", true); else if (!txtPassword.Text.Trim().Equals(txtConfirmPassword.Text.Trim())) ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Password does not matched.');", true); else { UserBE userInfo = new UserBE(); UserBAL userBAL = new UserBAL(); CommonBAL combal = new CommonBAL(); string pwd = combal.Encrypt(txtPassword.Text.Trim(), false); int i = userBAL.SaveConfirmation(Request.QueryString["userid"].ToString(), Request.QueryString["key"].ToString(), pwd); if (i > 0) ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Password saved, Please relogin'); location.href ='login.aspx';", true); else ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('try again later');", true); } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("You are not authorised to access this page. Please contact system administrator.", false); // Server.Transfer("UM_BlankPage.aspx"); //?? send Message through Query String to the BlankPage string msg = Request.QueryString["Message"]; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); return; } else { setBreadCrumb(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (string.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["userid"].ToString())) || string.IsNullOrWhiteSpace(Convert.ToString(Request.QueryString["Key"].ToString()))) { divConfirm.Visible = false; ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Network Problem Please Try Again later');", true); return; } UserBE userInfo = new UserBE(); UserBAL userBAL = new UserBAL(); DataSet ds = userBAL.CheckConfirmationRequest(Request.QueryString["userid"].ToString(), Request.QueryString["Key"].ToString()); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows[0][0].ToString().Equals("No")) { divConfirm.Visible = false; ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('You are already verified');", true); } } } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "add")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to Perform any operation on this page. Please contact system administrator.", false); return; } if (ValidData()) { } else { LoggedIn master = (LoggedIn)this.Master; CommonBAL combal = new CommonBAL(); UserBE addUserBE = new UserBE(); UserDAL addUserdAL = new UserDAL(); UserBAL addUserBal = new UserBAL(); int ReturnOutput = 0; addUserBE.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; addUserBE.UserName = txtUserName.Text; addUserBE.FirstName = txtFName.Text; addUserBE.MiddleName = txtMName.Text; addUserBE.LastName = txtLName.Text; addUserBE.PrimaryEmailId = txtPREmailId.Text; addUserBE.SecondaryEmailId = txtSCEmailId.Text; addUserBE.MobileNo = txtMobileNo.Text; addUserBE.Address1 = txtAddress1.Text; addUserBE.Address2 = txtAddress2.Text; addUserBE.Street = txtStreet.Text; addUserBE.City = txtCity.Text; addUserBE.State1 = txtState.Text; addUserBE.Country = txtCountry.Text; addUserBE.SecretQuest = ddSecretQuest.SelectedValue; addUserBE.SecretAns = txtSecretAns.Text; addUserBE.EncPass = combal.Encrypt(txtPass.Text, false); if (addUserBal.AddUser(addUserBE, ref ReturnOutput)) { if(ReturnOutput==1) { master.ShowMessage("User of this User Name Already exist. ", false); } else if (ReturnOutput == 2) { clearFields(); master.ShowMessage("Record Inserted Successfully.", true); } } else { master.ShowMessage("Unsuccessful", false); } } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... //Response.Redirect("~/Login.aspx"); } if (Session["KOWOLoginId"] != null) { CommonBAL commBAL = new CommonBAL(); bool blnTemp = commBAL.KOTotalViewCountrIncrement(Convert.ToInt16(Session["KOWOLoginId"]), 0); if (!IsPostBack) { hdnKOID.Value = Session["KOWOLoginId"].ToString(); retreiveDATA(); Session["KOWOLoginId"] = null; } } }
public Boolean Validate(ref UserBE user) { CommonDAL commondal = new CommonDAL(); DataTable dt = new DataTable(); SqlConnection con = commondal.Connection(); SqlDataAdapter da = new SqlDataAdapter("Sp_UM_UserInfo", con); da.SelectCommand.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@UserName ", SqlDbType.VarChar); SqlParameter p2 = new SqlParameter("@EncPass", SqlDbType.VarChar); p1.Value = user.UserName; p2.Value = user.EncPass; da.SelectCommand.Parameters.Add(p1); da.SelectCommand.Parameters.Add(p2); da.Fill(dt); if (loadUserProfile(ref user, ref dt)) { return true; } else { return false; } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; string msg = Request.QueryString["Message"]; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); //?? Message through Query String return; } else { if (!IsPostBack) { ddlPageSize.Text = MyQuestDataPager.PageSize.ToString(); bindLVQuest(); LatestData(); setBreadCrumb(); } } }
public bool Validate(ref UserBE user) { UserDAL userDAL = new UserDAL(); if (userDAL.Validate(ref user)) return true; else return false; }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (!IsPostBack) { setBreadCrumb(); } }
protected void Page_Load(object sender, EventArgs e) { string msg = Request.QueryString["Message"]; LoggedIn master = (LoggedIn)this.Master; master.ShowMessage(msg, false); LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (Session["QuestId"] != null) { Response.Redirect("~/QuestAns/QA_QuestWithAns.aspx"); } if (!IsPostBack) { setBreadCrumb(); hdnbtnQueryId.Value = "1"; hdnbtnKOId.Value = "4"; ChangeKOButtonBackColor(Convert.ToInt32(hdnbtnKOId.Value)); ChangeQueryButtonBackColor(Convert.ToInt32(hdnbtnQueryId.Value)); ddlPageSize.Text = KODataPager.PageSize.ToString(); ddlPageSizeQuery.Text = QueryDataPager.PageSize.ToString(); bindLVKO(); bindLVQuery(); } //CultureInfo ci = new CultureInfo("en-US"); //if (!IsPostBack) //??? //{ // HomePageSetUpBAL setupBAL = new HomePageSetUpBAL(); // DataTable dt = new DataTable(); // if (setupBAL.DisplayHomePage(ref dt)) // { // string s = dt.Rows[0]["Pagehtml"].ToString(); // pnl.InnerHtml = HttpUtility.HtmlDecode(s); // //???divOutput.InnerText = s; // DateTime time = DateTime.Now; // string format = "dd (ddd) MM (MMM) yyyy - HH:mm "; // divOutput.InnerHtml = "<b>" + (time.ToString(format, ci)) + "</b><br/><br/>"; // } //} }
public bool Modify(UserBE user) { UserDAL userDAL = new UserDAL(); if (userDAL.Modify(user)) { return true; } else { return false; } }
public bool Delete(UserBE user) { UserDAL userDAL = new UserDAL(); if (userDAL.Delete(user)) { return true; } else { return false; } }
public bool ViewUser(UserBE viewuser) { UserDAL userDAL = new UserDAL(); if (userDAL.ViewUser(viewuser)) { return true; } else { return false; } }
public bool AddUser(UserBE addUserBE , ref int ReturnOutput) { UserDAL userDAL = new UserDAL(); if (userDAL.AddUser(addUserBE, ref ReturnOutput)) { return true; } else { return false; } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (!commonBAL.isPageAccessibleToUser(LoggedInUser.UserId, thisPageName)) { LoggedIn master = (LoggedIn)this.Master; Server.Transfer("LoggedInHome.aspx?Message=You are not authorised to access this page. Please contact system administrator."); return; } if (!IsPostBack) { if (Session["UCHomePageId"] != null) { string pagesize = Session["PageSize"].ToString(); ddlPageSize.SelectedValue = Session["PageNo"].ToString(); HomePageDataPager.SetPageProperties(Convert.ToInt32(Session["CurrentRow"]), Convert.ToInt32(pagesize), true); BindHomePageList(); recalcNoOfPages(); setBreadCrumb(); Session["UCHomePageId"] = null; } else { if (!IsPostBack) { ddlPageSize.SelectedValue = HomePageDataPager.PageSize.ToString(); BindHomePageList(); recalcNoOfPages(); setBreadCrumb(); } } } MaintainScrollPositionOnPostBack = true; }
protected void Page_Load(object sender, EventArgs e) { // string PageName = Request.QueryString["Page"]; LoggedIn lgdIn = (LoggedIn) this.Page.Master; LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } if (Session["HomePageId"] != null) { if (!IsPostBack) { hdnHomePageId.Value = Session["HomePageId"].ToString(); btnUpdate.Visible = true; btnSave.Visible = false; btnBack.Visible = true; retreiveDATA(); Session["HomePageId"] = null; } } else { if (!IsPostBack) { btnUpdate.Visible = false; btnSave.Visible = true; btnBack.Visible = false; } } }
protected void btnLogin_Click(object sender, EventArgs e) { string RealPass = txtPass.Text; if (ValidData()) { return; } UserBE LoggedInUser = new UserBE(); CommonBAL combal = new CommonBAL(); UserBAL userBAL = new UserBAL(); DataTable dt = new DataTable(); // Using screen inputs create UserBE; LoggedInUser.UserName = txtName.Text; LoggedInUser.EncPass = combal.Encrypt(txtPass.Text, false); if (userBAL.Validate(ref LoggedInUser)) { Session["LoggedInUser"] = LoggedInUser; if (Session["LoggedInUser"] != null) { LoggedInUser.UserId = ((UserBE)Session["LoggedInUser"]).UserId; if(userBAL.UserAccessRight(LoggedInUser,ref dt)) { Session["UserAccessRights"] = dt; Response.Redirect(@"~\UserMaint\LoggedInHome.aspx"); } //General master = (General)this.Master; //master.ShowMessage("You are not authorised to access this page. Please contact system administrator.", false); //?? Message through Query String ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('You are not authorised to access this page. Please contact system administrator.');", true); return; } } else { //General master = (General)this.Master; //master.ShowMessage("Incorrect Email or Password.", false); ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Incorrect Email or Password.');", true); return; } }
//LoggedIn LIPg = new LoggedIn(); //string thisPageName = "~/UserMaint/UM_ResetPassword.aspx"; protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } else { if (!IsPostBack) { setBreadCrumb(); } } }
protected void Page_Load(object sender, EventArgs e) { LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { if (Session["QuestId"] == null) //cv?org { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } else { //coming from QA_SearchQuestionWOLogin.aspx page - i.e. search w/o login - Quick Search click } } if (!IsPostBack) { if (Session["QuestId"] != null) //CV?org { hdnQuestId.Value = Session["QuestId"].ToString(); //cv?org CommonBAL commBAL = new CommonBAL(); //am?? bool blnTemp = commBAL.QueriesTotalViewCountrIncrement(Convert.ToInt16(Session["QuestId"]), (int)LoggedInUser.UserId); //am??? //Session["QuestIdWOLogin"] = Session["QuestId"].ToString(); //cv?org Session["QuestId"] = null; //CV??org ShowQuestion(); GetAnswers(); } else { Response.Redirect("~/UserMaint/LoggedInHome.aspx"); } } }
//protected void lvUserList_ItemUpdating(object sender, ListViewUpdateEventArgs e) //{ // if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "AddRec")) // { // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); // return; // } // UserBE user = new UserBE(); // UserBAL userBAL = new UserBAL(); // CommonBAL CommonBAL = new CommonBAL(); // user.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; // string UserId = lvUserList.DataKeys[e.ItemIndex].Value.ToString();// // Label userName = lvUserList.Items[e.ItemIndex].FindControl("lbUserName") as Label;// // TextBox firstName = lvUserList.Items[e.ItemIndex].FindControl("txtFName") as TextBox; // TextBox middleName = lvUserList.Items[e.ItemIndex].FindControl("txtMName") as TextBox; // TextBox lastName = lvUserList.Items[e.ItemIndex].FindControl("txtLName") as TextBox; // TextBox primaryEmailId = lvUserList.Items[e.ItemIndex].FindControl("txtPREmailId") as TextBox; // TextBox secondaryEmailId = lvUserList.Items[e.ItemIndex].FindControl("txtSCEmailId") as TextBox; // TextBox mobileNo = lvUserList.Items[e.ItemIndex].FindControl("txtMobileNo") as TextBox; // TextBox address1 = lvUserList.Items[e.ItemIndex].FindControl("txtAddress1") as TextBox; // TextBox address2 = lvUserList.Items[e.ItemIndex].FindControl("txtAddress2") as TextBox; // TextBox street = lvUserList.Items[e.ItemIndex].FindControl("txtStreet") as TextBox; // TextBox city = lvUserList.Items[e.ItemIndex].FindControl("txtCity") as TextBox; // TextBox state1 = lvUserList.Items[e.ItemIndex].FindControl("txtState1") as TextBox; // TextBox country = lvUserList.Items[e.ItemIndex].FindControl("txtCountry") as TextBox; // TextBox secretQuest = lvUserList.Items[e.ItemIndex].FindControl("txtSecretQuest") as TextBox;//? // TextBox secretAns = lvUserList.Items[e.ItemIndex].FindControl("txtSecretAns") as TextBox; // TextBox Pass = lvUserList.Items[e.ItemIndex].FindControl("txtPass") as TextBox;//? // user.UserId = Convert.ToInt32(UserId); // user.UserName = userName.Text; // user.FirstName = firstName.Text; // user.MiddleName = middleName.Text; // user.LastName = lastName.Text; // user.PrimaryEmailId = primaryEmailId.Text; // user.SecondaryEmailId = secondaryEmailId.Text; // user.MobileNo = mobileNo.Text; // user.Address1 = address1.Text; // user.Address2 = address2.Text; // user.Street = street.Text; // user.City = city.Text; // user.State1 = state1.Text; // user.Country = country.Text; // user.SecretQuest = secretQuest.Text; // user.SecretAns = secretAns.Text; // user.EncPass = CommonBAL.Encrypt( Pass.Text,false); // if (userBAL.Modify(user)) // { // lvUserList.EditIndex = -1; // bindLVUser(); // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Record Successfully Updated.", true); // } // else // { // LoggedIn master = (LoggedIn)this.Master; // master.ShowMessage("Unsuccessful",false); // } // recalcNoOfPages(); //} protected void btnUpdate_Click(object sender, EventArgs e) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "edit")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } UserBE user = new UserBE(); UserBAL userBAL = new UserBAL(); CommonBAL CommonBAL = new CommonBAL(); user.LastModifiedBy = ((UserBE)Session["LoggedInUser"]).UserId; user.UserId = Convert.ToInt32(hdnUserUpdateId.Value); user.UserName = txtUserName.Text; user.FirstName = txtFirstName.Text; user.MiddleName = txtMiddleName.Text; user.LastName = txtLName.Text; user.PrimaryEmailId = txtPREmailId.Text; user.SecondaryEmailId = txtSCEmailID.Text; user.MobileNo = txtMobileNo.Text; user.Address1 = txtAddress1.Text; user.Address2 = txtAddress2.Text; user.Street = txtStreet.Text; user.City = txtCity.Text; user.State1 = txtState.Text; user.Country = txtCountry.Text; user.SecretQuest = txtSecretQuest.Text; user.SecretAns = txtSecretAns.Text; user.EncPass = CommonBAL.Encrypt(txtPass.Text, false); if (userBAL.Modify(user)) { lvUserList.EditIndex = -1; bindLVUser(); LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Record Successfully Updated.", true); } else { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("Unsuccessful", false); } recalcNoOfPages(); }
protected void lvUserListItem_OnItemCommand(object sender, ListViewCommandEventArgs e) { HtmlTableRow SelectedRow; if (e.Item.DisplayIndex % 2 == 0) //even { SelectedRow = e.Item.FindControl("trItemTemplate") as HtmlTableRow; } else //odd { SelectedRow = e.Item.FindControl("trAltItemTemplate") as HtmlTableRow; } SelectedRow.BgColor = "Red"; if (String.Equals(e.CommandName, "Delete")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "delete")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } UserBE user = new UserBE(); string[] arg = new string[3]; arg = e.CommandArgument.ToString().Split(','); hdnUserId.Value = arg[0].ToString(); user.UserName= arg[1].ToString(); user.LastName = arg[2].ToString(); UserNameText.Text = user.UserName; LastNameText.Text = user.LastName; mpe_DeleteUser.Show(); } if (String.Equals(e.CommandName, "Edit")) { if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "edit")) { LoggedIn master = (LoggedIn)this.Master; master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false); return; } UserBE user = new UserBE(); string[] arg = new string[17]; arg = e.CommandArgument.ToString().Split(','); hdnUserUpdateId.Value = arg[0].ToString(); user.UserName = arg[1].ToString(); user.FirstName = arg[2].ToString(); user.MiddleName = arg[3].ToString(); user.LastName = arg[4].ToString(); user.PrimaryEmailId = arg[5].ToString(); user.SecondaryEmailId = arg[6].ToString(); user.MobileNo = arg[7].ToString(); user.Address1 = arg[8].ToString(); user.Address2 = arg[9].ToString(); user.Street = arg[10].ToString(); user.City = arg[11].ToString(); user.State1 = arg[12].ToString(); user.Country = arg[13].ToString(); user.SecretQuest = arg[14].ToString(); user.SecretAns = arg[15].ToString(); user.EncPass = arg[16].ToString(); txtUserName.Text = user.UserName; txtFirstName.Text = user.FirstName; txtMiddleName.Text = user.MiddleName; txtLName.Text = user.LastName; txtPREmailId.Text = user.PrimaryEmailId; txtSCEmailID.Text = user.SecondaryEmailId; txtMobileNo.Text = user.MobileNo; txtAddress1.Text = user.Address1; txtAddress2.Text = user.Address2; txtStreet.Text = user.Street; txtCity.Text = user.City; txtState.Text = user.State1; txtCountry.Text = user.Country; txtSecretQuest.Text = user.SecretQuest; txtSecretAns.Text = user.SecretAns; txtPass.Text = user.EncPass; mpe_EditUser.Show(); } }
protected void btnReply_Click(object sender, EventArgs e) { //DataTable dtQuestion = (DataTable)ViewState["QuestionTable"]; //lblQuestPopup.Text = dtQuestion.Rows[0]["DetlQuestn"].ToString(); //lblQuestShortDescPopup.Text = dtQuestion.Rows[0]["ShortDesc"].ToString(); //lblQuestpostbyPopup.Text = dtQuestion.Rows[0]["LastModifiedBy"].ToString(); //lblQuestPostedTimePopup.Text = dtQuestion.Rows[0]["LastModifiedAt"].ToString(); //mpe_Reply.Show(); LoggedInUser = (UserBE)Session["LoggedInUser"]; if (LoggedInUser == null) { if (Session["QuestId"] == null) { // return to login page because user has not loggedin or session has timedout... Response.Redirect("~/Login.aspx"); } else { //coming from QA_SearchQuestionWOLogin.aspx page - i.e. search w/o login - Quick Search click } } }
protected void btnSignUp_Click(object sender, EventArgs e) { if (ValidData()) return; UserBE NewUser = new UserBE(); CommonBAL combal = new CommonBAL(); DataTable dt = new DataTable(); General master = (General)this.Master; dt = userBAL.GetUsers().Tables[0]; if (dt.Rows.Count > 0) { DataRow[] dr = dt.Select("UserName='******'"); if (dr.Length > 0) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('User Name Already Exists.. Please sign up with diffrent user name. ');", true); return; } dr = dt.Select("EmailAddress='" + txtEmail.Text + "'"); if (dr.Length > 0) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('Email Address Already Exists.. ');", true); return; } } // Using screen inputs create UserBE; NewUser.FirstName = txtFName.Text.Trim(); NewUser.LastName = txtLName.Text.Trim(); NewUser.UserName = txtUName.Text.Trim(); NewUser.PrimaryEmailId = txtEmail.Text.Trim(); NewUser.SecretQuest = ddlSecretQuestion.SelectedValue; NewUser.SecretAns = txtAnswer.Text; NewUser.MiddleName = NewUser.SecondaryEmailId = NewUser.MobileNo = NewUser.Address1 = NewUser.Address2 = NewUser.Street = NewUser.City = NewUser.State1 = NewUser.Country = NewUser.EncPass = string.Empty; DataSet ds1 = userBAL.InsertUser(NewUser); if (ds1.Tables.Count > 0) { if (ds1.Tables[0].Rows.Count > 0) { MailMessage Email = new MailMessage(); //???Email.From = new MailAddress("*****@*****.**"); Email.From = new MailAddress("*****@*****.**"); Email.To.Add(txtEmail.Text); Email.Subject = "MuLessons : Just one more step to get started"; string url = Request.Url.OriginalString.Replace("SignUp.aspx", "ConfirmPassword.aspx")+"?userid=" + txtUName.Text + "&key=" + ds1.Tables[0].Rows[0]["MailKey"].ToString(); Email.Body = "Dear " + txtFName.Text + ", <br /><br /> Thanks for signingup with MuLessons. You are almost done with the sign-up process. Please click on below link and complete the sign up process" + "<br /><a href='" + url +"'>Confirm Your Account</a>"; Email.IsBodyHtml = true; SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = "smtp.gmail.com"; smtpClient.Port = 587; //???smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "c@123456"); smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "c@123456"); smtpClient.EnableSsl = true; smtpClient.Send(Email); string msg = txtFName.Text + ", go to " + txtEmail.Text + " to complete the sign-up process."; txtFName.Text = txtLName.Text = txtUName.Text = txtEmail.Text = txtAnswer.Text = string.Empty; ddlSecretQuestion.SelectedIndex = 0; ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CallJS", "alert('" + msg + "');", true); } } }
public bool UserAccessRight(UserBE user, ref DataTable dt) { UserDAL userDAL = new UserDAL(); if(userDAL.UserAccessRight(user,ref dt)) { return true; } else { return false; } }
public bool ResetPassword(UserBE user) { UserDAL userDAL = new UserDAL(); if (userDAL.ResetPassword(user)) { return true; } else { return false; } }
private bool ValidateData(UserBE user) { //Check required fields // Check specific field wise check - email, phone, country,... Regex re = new Regex("^[0-9]{10}"); Regex rex = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"); if (re.IsMatch(user.MobileNo.Trim()) == false || user.MobileNo.Length > 10) { return false; } else { return true; } //if (rex.IsMatch(user.PrimaryEmailId.Trim()) == false || user.PrimaryEmailId.Length > 50) //{ // return false; //} //else //{ // return true; //} }
public DataSet InsertUser(UserBE UserBE) { try { UserDAL userDAL = new UserDAL(); return userDAL.InsertUser(UserBE); } catch (Exception ex) { throw ex; } finally { } }