protected void btnDelete_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdSecurityPolicyID.Value)) { SecurityPolicyDAL oSpDAL = new SecurityPolicyDAL(); Result oResult = (Result)oSpDAL.Detete(hdSecurityPolicyID.Value); if (oResult.Status) { this.LoadList(); this.ClearTextValue(); ucMessage.OpenMessage(Constants.MSG_SUCCESS_DELETE, Constants.MSG_TYPE_SUCCESS); } else { if (oResult.Message.Equals(Constants.TABLE_MAIN)) { ucMessage.OpenMessage(Constants.MSG_APPROVED_DELETE_DATA, Constants.MSG_TYPE_ERROR); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_DELETE, Constants.MSG_TYPE_ERROR); } } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_DELETE, Constants.MSG_TYPE_ERROR); } }
protected void btnSave_Click(object sender, EventArgs e) { SecurityPolicy oSP = new SecurityPolicy(Util.GetIntNumber(hdSecurityPolicyID.Value)); SecurityPolicyDAL oSPDAL = new SecurityPolicyDAL(); oSP.IsChangePassFirst = ddlRequiredToChangePw.SelectedValue == "true" ? true : false; oSP.OldPassProhibited = Util.GetIntNumber(txtOldPwprohibited.Text.Trim()); oSP.MinPassLength = Util.GetIntNumber(txtMinimumPwLg.Text.Trim()); oSP.IsForceAlphaNumericPass = ddlAlphaNumPw.SelectedValue == "true" ? true : false; oSP.PassExpiresAfterDays = Util.GetIntNumber(txtPwExpDays.Text.Trim()); oSP.DaysEarlierPass = Util.GetIntNumber(txtDayEarly.Text.Trim()); oSP.MaxWrongTtrial = Util.GetIntNumber(txtWrongLoginTrial.Text.Trim()); oSP.UserDetails = ucUserDet.UserDetail; Result oResult = (Result)oSPDAL.Save(oSP); if (oResult.Status) { this.LoadList(); ClearTextValue(); hdSecurityPolicyID.Value = ""; ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR); } }
// ok private void LoadList() { Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; if (oConfig != null) { SecurityPolicy oSP = new SecurityPolicy(); SecurityPolicyDAL oSPDal = new SecurityPolicyDAL(); Result oResult = oSPDal.LoadUnapprovedList(oConfig.UserName, false); gvList.DataSource = null; gvList.DataBind(); if (oResult.Status) { DataTable dtTmpList = (DataTable)oResult.Return; if (dtTmpList.Rows.Count > 0) { dtTmpList.Columns.Remove("MakerID"); gvList.DataSource = dtTmpList; gvList.DataBind(); Session[Constants.SES_CONFIG_UNAPPROVE_DATA] = dtTmpList; } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("Delete"), true); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("Delete"), true); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("Delete"), true); } }
protected void btnReject_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdSecurityPolicyID.Value)) { SecurityPolicy oSP = new SecurityPolicy(Util.GetIntNumber(hdSecurityPolicyID.Value)); SecurityPolicyDAL oSPDAL = new SecurityPolicyDAL(); oSP.UserDetails = ucUserDet.UserDetail; Result oResult = (Result)oSPDAL.Reject(oSP); if (oResult.Status) { ucMessage.OpenMessage(Constants.MSG_SUCCESS_REJECT, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_REJECT, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_REJECT, Constants.MSG_TYPE_ERROR); } }
private void LoadDataByID(int iSPID) { SecurityPolicy oSp = new SecurityPolicy(iSPID); SecurityPolicyDAL oSpDAL = new SecurityPolicyDAL(); Result oResult = new Result(); oResult = oSpDAL.LoadByID(oSp); ClearTextValue(); if (oResult.Status) { oSp = (SecurityPolicy)oResult.Return; if (oSp != null) { DDListUtil.Assign(ddlRequiredToChangePw, oSp.IsChangePassFirst); txtOldPwprohibited.Text = oSp.OldPassProhibited.ToString(); txtMinimumPwLg.Text = oSp.MinPassLength.ToString(); DDListUtil.Assign(ddlAlphaNumPw, oSp.IsForceAlphaNumericPass); txtPwExpDays.Text = oSp.PassExpiresAfterDays.ToString(); txtDayEarly.Text = oSp.DaysEarlierPass.ToString(); txtWrongLoginTrial.Text = oSp.MaxWrongTtrial.ToString(); ucUserDet.UserDetail = oSp.UserDetails; hdSecurityPolicyID.Value = oSp.SecurityPolicyID.ToString(); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_INFO); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true); } } else { ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR); ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("Delete"), true); } }
protected void btnSave_Click(object sender, EventArgs e) { // need to check first //This block is used for checking the Security Policy UserDAL oUserDAL = new UserDAL(); bool status = true; string sErrorMessage = string.Empty; Result oResult = null; if (string.IsNullOrEmpty(hdUserID.Value)) { oResult = oUserDAL.CheckUserIDAvailability(txtLoginUserID.Text.Trim()); if (oResult.Status) { if (Convert.ToInt32((Object)oResult.Return) > 0) { sErrorMessage = "This User Login ID exists. Please try with another one"; txtLoginUserID.Text = string.Empty; status = false; } } } else { SecurityPolicyDAL oSpDAL = new SecurityPolicyDAL(); Result oPOResult = oSpDAL.LoadApprovedData(); SecurityPolicy oSp = null; if (oPOResult.Status) { oSp = (SecurityPolicy)oPOResult.Return; if (oSp != null) { int iMinLength = oSp.MinPassLength; bool bAlpNu = oSp.IsForceAlphaNumericPass; if (txtNewPassword.Text.Length < iMinLength) { sErrorMessage += "<LI>Password is too short.</LI>"; status = false; } if (bAlpNu) { if (IsIsDigitValidPassword(txtNewPassword.Text) == false) { sErrorMessage += "<LI>Password must be alpha numeric.</LI>"; status = false; } } } } } //This block is used for checking the Security Policy if (status) { User oUser = new User(); oUser.UserID = Util.GetIntNumber(hdUserID.Value == "" ? "0" : hdUserID.Value); oUser.UserName = Request[txtLoginUserID.UniqueID].Trim(); oUser.Group.GroupID = Util.GetIntNumber(ddlUserClass.SelectedItem.Value); oUser.FirstName = txtUserFirstName.Text; oUser.LastName = txtUserLastName.Text; oUser.Password = txtNewPassword.Text; oUser.Designation.DesignationID = Util.GetIntNumber(ddlDesignation.SelectedItem.Value); oUser.Status = chkStatus.Checked; oUser.DivisionID = ddlDivision.SelectedValue; oUser.UserDetails = ucUserDet.UserDetail;; oResult = (Result)oUserDAL.Save(oUser); if (oResult.Status) { ClearTextValue(); LoadList(); ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage("<UI>" + sErrorMessage + "</UI>", Constants.MSG_TYPE_ERROR); } }
protected void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtNewPassword.Text) && !string.IsNullOrEmpty(txtOldPassword.Text) && !string.IsNullOrEmpty(txtConfirmPassword.Text)) { string sErrorMessage = string.Empty; Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; if (oConfig != null) { // need to check first //This block is used for checking the Security Policy SecurityPolicyDAL oSpDAL = new SecurityPolicyDAL(); Result oPOResult = new Result(); oPOResult = oSpDAL.LoadApprovedData(); SecurityPolicy oSp = null; bool status = true; if (oPOResult.Status) { oSp = (SecurityPolicy)oPOResult.Return; if (oSp != null) { int iMinLength = oSp.MinPassLength; bool bAlpNu = oSp.IsForceAlphaNumericPass; if (txtNewPassword.Text.Length < iMinLength) { sErrorMessage += "<LI>Password is too short.</LI>"; status = false; } if (bAlpNu) { if (IsIsDigitValidPassword(txtNewPassword.Text) == false) { sErrorMessage += "<LI>Password must be alpha numeric.</LI>"; status = false; } } } } //This block is used for checking the Security Policy if (status == true) { User oUesr = new User(txtLoginUserID.Text); oUesr.Password = txtNewPassword.Text; UserDAL oUserDAL = new UserDAL(); Result oResult = (Result)oUserDAL.ChangePassword(oConfig.UserID, oConfig.UserName, txtOldPassword.Text, txtNewPassword.Text); if (oResult.Status) { ucMessage.OpenMessage(oResult.Message, Constants.MSG_TYPE_SUCCESS); } else { ucMessage.OpenMessage(oResult.Message, Constants.MSG_TYPE_ERROR); } } else { ucMessage.OpenMessage("<UI>" + sErrorMessage + "</UI>", Constants.MSG_TYPE_ERROR); } } } }
protected void SearchAction() { string sType = Request.QueryString["pType"]; Config oConfig = (Config)Session[Constants.SES_USER_CONFIG]; gvData.DataSource = null; gvData.DataBind(); if (!string.IsNullOrEmpty(sType)) { Session[Constants.SES_SA_UNAPPROVE_DATA] = new DataTable(); if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.USER).PadLeft(5, '0'))) { lgText.InnerHtml = "User Approval Queue List"; UserDAL oUserDAL = new UserDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'User' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = oUserDAL.LoadUnapprovedList(null, true, oConfig.DivisionID, oConfig.BankCodeID); DataTable dtTmpList = (DataTable)oResult.Return; if (dtTmpList != null) { if (dtTmpList.Rows.Count > 0) { gvData.DataSource = dtTmpList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpList; } } } else if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.DEPARTMENT).PadLeft(5, '0'))) { lgText.InnerHtml = "Department Approval Queue List"; DepartmentDAL oDptDAL = new DepartmentDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'Department' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = oDptDAL.LoadUnapprovedList(null, true); DataTable dtTmpList = (DataTable)oResult.Return; if (dtTmpList != null) { gvData.DataSource = dtTmpList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpList; } } else if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.DESIGNATION).PadLeft(5, '0'))) { lgText.InnerHtml = "Designation Approval Queue List"; DesignationDAL oDsgDAL = new DesignationDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'Designation' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = oDsgDAL.LoadUnapprovedList(null, true); DataTable dtTmpDsgList = (DataTable)oResult.Return; if (dtTmpDsgList != null) { gvData.DataSource = dtTmpDsgList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpDsgList; } } else if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.SECURITY_POLICY).PadLeft(5, '0'))) { lgText.InnerHtml = "Security policy Approval Queue List"; SecurityPolicyDAL oSPDAL = new SecurityPolicyDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'Security policy' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = oSPDAL.LoadUnapprovedList(null, true); DataTable dtTmpSPList = (DataTable)oResult.Return; if (dtTmpSPList != null) { gvData.DataSource = dtTmpSPList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpSPList; } } else if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.GROUP_PERMISSION).PadLeft(5, '0'))) { lgText.InnerHtml = "Group Permission Approval Queue List"; GroupDAL oGPDAL = new GroupDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'Group Permission' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = oGPDAL.LoadUnapprovedList(null, true); DataTable dtTmpSPList = (DataTable)oResult.Return; if (dtTmpSPList != null) { gvData.DataSource = dtTmpSPList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpSPList; } } else if (sType.Equals(Convert.ToString((int)Constants.PAGEINDEX_SA.SCREEN_SETUP).PadLeft(5, '0'))) { lgText.InnerHtml = "Screen Setup Approval Queue List"; ScreenDAL sCRDAL = new ScreenDAL(); TemplateBuilder tbGvData = new TemplateBuilder(); tbGvData.AppendLiteralString("No 'Screen Setup' record found"); gvData.EmptyDataTemplate = tbGvData; Result oResult = sCRDAL.LoadUnapprovedList(null, true); DataTable dtTmpSPList = (DataTable)oResult.Return; if (dtTmpSPList != null) { gvData.DataSource = dtTmpSPList; gvData.DataBind(); Session[Constants.SES_SA_UNAPPROVE_DATA] = dtTmpSPList; } } } }