private DataTable BindGridViewBySearch(ML_UserName objML_UserName) { DataTable dtUserName = new DataTable("GridSearch"); try { objBusinessClass = new BusinessLayer.BusinessClass(); dtUserName = objBusinessClass.GetUserNameBySeacrh(objML_UserName); } catch (Exception ex) { Exception exx = ex; } return(dtUserName); }
protected void btnChangePassword_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_UserName = new ML_UserName(); string UserName = ML_Common.clean(txtUserName.Text); string oldPassword = ML_Common.clean(txtOldPassword.Text); string newPassword = ML_Common.clean(txtNewPassword.Text); int obhReturn = objBusinessClass.UpdatePassword(UserName, oldPassword, newPassword); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Password changed Successfully"; } else if (obhReturn == 2) { lblMsg.Text = "User Name/Password is not Correct!"; lblMsg.Visible = true; } else { lblMsg.Text = "There are some issue while Updating, Please enter correct old Password!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
protected void btnSearch_Click(object sender, EventArgs e) { objML_UserName = new ML_UserName(); try { lblMsg.Text = string.Empty; lblMsg.Visible = false; lblMsgEdit.Text = string.Empty; lblMsgEdit.Visible = false; ViewState["grdUserName"] = null; FillGrid(); } catch (Exception ex) { Exception exx = ex; } }
private void FillObjectToForm(int lngId, bool IsEditFlag = true) { objBusinessClass = new BusinessLayer.BusinessClass(); ML_UserName objML_UserName = objBusinessClass.GetUserNameById(lngId); try { if (objML_UserName != null) { if (IsEditFlag) { txtUserNameEdit.Text = ML_Common.clean(objML_UserName.UserName); txtFirstNameEdit.Text = ML_Common.clean(objML_UserName.FirstName); txtLastNameEdit.Text = ML_Common.clean(objML_UserName.LastName); txtEmailEdit.Text = ML_Common.clean(objML_UserName.Email); txtMobileEdit.Text = ML_Common.clean(objML_UserName.Mobile); lblUserType.Text = ML_Common.clean(objML_UserName.UserType); } else { lblUserName.Text = ML_Common.clean(objML_UserName.UserName); lblFirstName.Text = ML_Common.clean(objML_UserName.FirstName); lblLastName.Text = ML_Common.clean(objML_UserName.LastName); lblEmail.Text = ML_Common.clean(objML_UserName.Email); lblMobile.Text = ML_Common.clean(objML_UserName.Mobile); lblUserType.Text = ML_Common.clean(objML_UserName.UserType); } } } catch (Exception ex) { Exception exx = ex; } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsValid) { //errNumber = -1; try { objBusinessClass = new BusinessLayer.BusinessClass(); objML_UserName = new ML_UserName(); objML_UserName.UserName = ML_Common.clean(txtUserName.Text); objML_UserName.FirstName = ML_Common.clean(txtFirstName.Text); objML_UserName.LastName = ML_Common.clean(txtLastName.Text); objML_UserName.Email = ML_Common.clean(txtEmail.Text); objML_UserName.Telephone = ML_Common.clean(txtTelephone.Text); objML_UserName.Mobile = ML_Common.clean(txtMobile.Text); objML_UserName.Password = ML_Common.clean(txtPassword.Text); objML_UserName.UserTypeId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlUserType, true)); objML_UserName.UserType = ML_Common.string2string(ML_Common.GetDropDownValue(ddlUserType, false)); objML_UserName.ReTryAttempt = 3; // ML_Common.string2int32(ML_Common.clean(txtReTryAttempt.Text)); objML_UserName.IsLocked = false; // ML_Common.string2Boolean(ML_Common.clean(txtIsLocked.Text)); objML_UserName.LockedDateTime = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_UserName.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_UserName.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); if (Session["UserName"] != null && Session["UserNameId"] != null) { objML_UserName.CreatedBy = ML_Common.clean(Session["UserName"]); objML_UserName.ModifiedBy = ML_Common.clean(Session["UserName"]); objML_UserName.CreatedByUserNameId = ML_Common.string2int32(ML_Common.clean(Session["UserNameId"])); } int obhReturn = objBusinessClass.AddUserName(objML_UserName); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Saved Successfully"; FormFieldsClear(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsg.Visible = true; } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
protected void btnUpdate_Click(object sender, EventArgs e) { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; if (IsValid) { //errNumber = -1; try { BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = Convert.ToInt32(ViewState["UserNameViewId"]); ML_UserName objML_UserName = objBusinessClass.GetUserNameById(lngId); objML_UserName.UserName = ML_Common.clean(txtUserNameEdit.Text); objML_UserName.FirstName = ML_Common.clean(txtFirstNameEdit.Text); objML_UserName.LastName = ML_Common.clean(txtLastNameEdit.Text); objML_UserName.Email = ML_Common.clean(txtEmailEdit.Text); objML_UserName.Telephone = ML_Common.clean(txtTelephoneEdit.Text); objML_UserName.Mobile = ML_Common.clean(txtMobileEdit.Text); objML_UserName.Remarks = ML_Common.clean(txtRemarksEdit.Text); objML_UserName.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_UserName.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_UserName.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.CreatedBy = ML_Common.clean(string.Empty); objML_UserName.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_UserName.ModifiedBy = ML_Common.clean(string.Empty); if (Session["UserName"] != null && Session["UserNameId"] != null) { objML_UserName.CreatedBy = ML_Common.clean(Session["UserName"]); objML_UserName.ModifiedBy = ML_Common.clean(Session["UserName"]); objML_UserName.CreatedByUserNameId = ML_Common.string2int32(ML_Common.clean(Session["UserNameId"])); } int obhReturn = objBusinessClass.UpdateUserName(objML_UserName); if (obhReturn == 1) { lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; FormFieldsClear(); } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsgEdit.Text = "Record Already Exists!"; } else { lblMsg.Text = "There are some issue while Updating!"; lblMsgEdit.Text = "There are some issue while Updating!"; } UpdatePanelEdit.Update(); } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exx = ex; } } }
protected void btnLogin_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtPassword.Text)) { objBusinessClass = new BusinessLayer.BusinessClass(); objML_UserName = new ML_UserName(); objML_UserName = objBusinessClass.GetUserDetailsByLoginId(txtUserName.Text.Trim(), txtPassword.Text.Trim()); if (objML_UserName != null && objML_UserName.UserNameId > 0 && !string.IsNullOrEmpty(objML_UserName.UserName)) { string _ID = objML_UserName.UserNameId.ToString().Trim(); _Name = objML_UserName.UserName.ToString().Trim(); Session["UserId"] = objML_UserName.Id; Session["UserNameId"] = objML_UserName.UserNameId; Session["UserName"] = objML_UserName.UserName; Session["UserFullName"] = objML_UserName.FirstName + " " + objML_UserName.LastName; Session["UserTypeId"] = objML_UserName.UserTypeId; Session["UserType"] = objML_UserName.UserType; Session["UserEmail"] = objML_UserName.Email; FormsAuthentication.SetAuthCookie(objML_UserName.UserName, true); // string strSession = Session.SessionID.ToString().Trim(); //if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])) //{ // Response.Redirect(Request.QueryString["ReturnUrl"]); //} //else //{ // FormsAuthentication.RedirectFromLoginPage(objML_UserName.UserName, true); //} //string ReturnUrl = Convert.ToString(Request.QueryString["url"]); //if (!string.IsNullOrEmpty(ReturnUrl)) //{ // Session["userid"] = "TM"; // Response.Redirect(ReturnUrl); //} //else //{ // Response.Redirect("aboutmyself.aspx?msgs=" + "SuccessLogin"); //} if (objML_UserName.UserTypeId == 1) { Response.Redirect("~/frmDashBoard.aspx"); } else if (objML_UserName.UserTypeId == 2) { Response.Redirect("~/frmDashBoard.aspx"); } else if (objML_UserName.UserTypeId == 3) { Response.Redirect("~/frmLabDashBoard.aspx"); } else if (objML_UserName.UserTypeId == 5) { Response.Redirect("~/frmCSSDashBoard.aspx"); //Session["IsUserType"] = 5; //Session["IsAdminType"] = null; //FormsAuthentication.SetAuthCookie(objML_UserName.UserName, true); //Server.Transfer("~/frmCSSDashBoard.aspx", false); } else if (objML_UserName.UserTypeId == 6) { Response.Redirect("~/frmPotDashBoard.aspx"); //Session["IsUserType"] = 6; //Session["IsAdminType"] = null; //FormsAuthentication.SetAuthCookie(objML_UserName.UserName, true); //Server.Transfer("~/frmPotDashBoard.aspx", false); } } { ClientScript.RegisterClientScriptBlock(this.GetType(), "Myscript", "alert('This LoginId does not exist. Please contact adminstrator.');", true); } } } catch (Exception ex) { Exception exx = ex; } }