public static string Deficient(string cgi) { CryptoJS objcryptoJS = new CryptoJS(); string strURL = string.Empty; string ContractorAppId = string.Empty; try { ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString(); if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0) { ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString(); } List <clsInspector_RiskAssessor> objSPCont = new List <clsInspector_RiskAssessor>(); objSPCont = Inspector_RiskAssessorDAL.SelectDynamicInspector_RiskAssessor("InspectorRiskAssId = " + ContractorAppId + "", "InspectorRiskAssId"); if (objSPCont != null) { objSPCont[0].IsActive = 3; if (!Inspector_RiskAssessorDAL.UpdateInspector_RiskAssessor(objSPCont[0])) { } } } catch (Exception) { ErrorHandler.ErrorPage(); } return("MDE_TrainAppView.aspx?TrainApps=active&cgi=" + cgi + ""); }
public static string Disapprove(string cgi) { CryptoJS objcryptoJS = new CryptoJS(); string strURL = string.Empty; string ContractorAppId = string.Empty; try { ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString(); if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0) { ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString(); } List <clsInspector_RiskAssessor> objSPCont = new List <clsInspector_RiskAssessor>(); objSPCont = Inspector_RiskAssessorDAL.SelectDynamicInspector_RiskAssessor("InspectorRiskAssId = " + ContractorAppId + "", "InspectorRiskAssId"); if (objSPCont != null) { objSPCont[0].IsActive = 0; if (Inspector_RiskAssessorDAL.UpdateInspector_RiskAssessor(objSPCont[0])) { List <clsUserRole> lstURole = new List <clsUserRole>(); lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 15 and AuthorizedUserId = " + objSPCont[0].CreatedBy + "", "UserRoleId"); if (lstURole != null) { if (lstURole.Count > 0) { // It should get only one record per ROle. if (!UserRoleDAL.DeleteUserRole(lstURole[0].UserRoleId)) { } } } } } } catch (Exception) { ErrorHandler.ErrorPage(); } return("MDE_TrainAppView.aspx?TrainApps=active&cgi=" + cgi + ""); }
public static string Approve(string cgi) { CryptoJS objcryptoJS = new CryptoJS(); string strURL = string.Empty; string ContractorAppId = string.Empty; try { ContractorAppId = cgi.ToString() == null ? string.Empty : cgi.ToString(); if (GlobalMethods.ValueIsNull(ContractorAppId).Length > 0) { ContractorAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(cgi), AppConstants.secretKey, AppConstants.initVec).ToString(); } List <clsInspector_RiskAssessor> objSPCont = new List <clsInspector_RiskAssessor>(); objSPCont = Inspector_RiskAssessorDAL.SelectDynamicInspector_RiskAssessor("InspectorRiskAssId = " + ContractorAppId + "", "InspectorRiskAssId"); if (objSPCont != null) { objSPCont[0].IsActive = 1; if (Inspector_RiskAssessorDAL.UpdateInspector_RiskAssessor(objSPCont[0])) { List <clsUserRole> lstURole = new List <clsUserRole>(); lstURole = UserRoleDAL.SelectDynamicUserRole("RoleId = 15 and AuthorizedUserId = " + objSPCont[0].CreatedBy + "", "UserRoleId"); if (lstURole != null) { if (lstURole.Count > 0) { //ROLE HAS BEEN ASSIGNED. THEREFORE, DONT ADD ANOTHER ROLE. } else { clsUserRole objURole = new clsUserRole(); objURole.RoleId = 15; objURole.AuthorizedUserId = Convert.ToInt32(objSPCont[0].CreatedBy); objURole.IsActive = 1; objURole.CreatedDate = DateTime.Now; objURole.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objURole.UpdatedDate = Convert.ToDateTime("1/1/1900"); objURole.UpdatedBy = ""; objURole.Notes = ""; if (!UserRoleDAL.InsertUserRole(objURole)) { } } } else { clsUserRole objURole = new clsUserRole(); objURole.RoleId = 15; objURole.AuthorizedUserId = Convert.ToInt32(objSPCont[0].CreatedBy); objURole.IsActive = 1; objURole.CreatedDate = DateTime.Now; objURole.CreatedBy = HttpContext.Current.Session["UserAuthId"].ToString(); objURole.UpdatedDate = Convert.ToDateTime("1/1/1900"); objURole.UpdatedBy = ""; objURole.Notes = ""; if (!UserRoleDAL.InsertUserRole(objURole)) { } } } } } catch (Exception) { ErrorHandler.ErrorPage(); } return("MDE_TrainAppView.aspx?TrainApps=active&cgi=" + cgi + ""); }