public ActionResult Search() { try { string strErrorMessage = string.Empty; BLSkills _objBLSkills = new BLSkills(); DOADM_SkillMasterExtended objDOADM_SkillMasterExtended = new DOADM_SkillMasterExtended(); objDOADM_SkillMasterExtended.lstRoles = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Role); objDOADM_SkillMasterExtended.lstBusinessSegment = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.BusinessSegment); objDOADM_SkillMasterExtended.lstDepartment = GetERSDepartments(); objDOADM_SkillMasterExtended.lstWorkBasket = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.WorkBasket); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); objDOADM_SkillsMaster.IsActive = true; long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; ExceptionTypes result = _objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out strErrorMessage); objDOADM_SkillMasterExtended.lstSkillsMaster = lstDOADM_SkillsMaster; return(View(objDOADM_SkillMasterExtended)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }
public ActionResult Add(DOADM_SkillsMaster objDOADM_SkillsMaster) { string errorMessage = string.Empty; string returnMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); try { string sreturnMessage = string.Empty; if (objDOADM_SkillsMaster.ADM_SkillsMasterId > 0) { BLCommon objCommon = new BLCommon(); if (!objCommon.ValidateLockBeforeSave(currentUser.ADM_UserMasterId, (long)ScreenType.Skills, objDOADM_SkillsMaster.ADM_SkillsMasterId)) { errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } objDOADM_SkillsMaster.LastUpdatedByRef = currentUser.ADM_UserMasterId; sreturnMessage = "Record updated successfully."; } else { objDOADM_SkillsMaster.CreatedByRef = currentUser.ADM_UserMasterId; sreturnMessage = "Record saved successfully."; } BLSkills _objBLSkills = new BLSkills(); if (Session[ConstantTexts.SkillWorkQueueSessionKey] != null) { objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation = Session[ConstantTexts.SkillWorkQueueSessionKey] as List <DOADM_SkillWorkQueuesCorrelation>; } result = _objBLSkills.SaveSkills(objDOADM_SkillsMaster, currentUser.ADM_UserMasterId, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } Session[ConstantTexts.SkillWorkQueueSessionKey] = null; return(Json(new { ID = result, Message = sreturnMessage })); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } }
public ActionResult Add(long ADM_AccessGroupMasterId = 0, bool isActive = true) { try { long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; Session[ConstantTexts.AccessGroupSkillSessionKey] = null; Session[ConstantTexts.AccessGroupReportSessionKey] = null; ViewBag.RoleList = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Role); ViewBag.WorkBasketList = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.WorkBasket); ViewBag.Reports = ViewBag.Reports = CacheUtility.GetAllReportsFromCache(null, ""); UIDOAccessGroup objUIDOAccessGroup = new UIDOAccessGroup(); objUIDOAccessGroup.IsActive = true; objUIDOAccessGroup.lstDOADM_AccessGroupSkillsCorrelation = new List <DOADM_AccessGroupSkillsCorrelation>(); objUIDOAccessGroup.lstDOADM_AccessGroupReportCorrelation = new List <DOADM_AccessGroupReportCorrelation>(); if (ADM_AccessGroupMasterId != 0) { DOADM_AccessGroupMaster objDOADM_AccessGroupMaster = new DOADM_AccessGroupMaster(); BLAccessGroup objBLAccessGroup = new BLAccessGroup(); objDOADM_AccessGroupMaster.ADM_AccessGroupMasterId = ADM_AccessGroupMasterId; objDOADM_AccessGroupMaster.IsActive = isActive; ExceptionTypes result = objBLAccessGroup.GetAccessGroupForEdit(objDOADM_AccessGroupMaster, out objUIDOAccessGroup); Session[ConstantTexts.AccessGroupSkillSessionKey] = objUIDOAccessGroup.lstDOADM_AccessGroupSkillsCorrelation; Session[ConstantTexts.AccessGroupReportSessionKey] = objUIDOAccessGroup.lstDOADM_AccessGroupReportCorrelation; DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); BLSkills objBLSkills = new BLSkills(); objDOADM_SkillsMaster.IsActive = true; objDOADM_SkillsMaster.WorkBasketLkup = objUIDOAccessGroup.WorkBasketLkup; objDOADM_SkillsMaster.RoleLkup = objUIDOAccessGroup.RoleLkup; ExceptionTypes result1 = objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out string errorMesssage); ViewBag.Skills = lstDOADM_SkillsMaster.Where(x => x.IsActive == true).ToList(); } return(View(objUIDOAccessGroup)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageAccessGroups, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); return(RedirectToAction("Maintenance", "Error", new { Error = MethodBase.GetCurrentMethod().Name + " Action terminated and redirected to Maintenance. Error:" + ex.ToString() })); } }
private static void GetAllSkillsIfNoCache() { long?TimeZone = (long)DefaultTimeZone.CentralStandardTime; if (System.Web.HttpContext.Current.Cache[ConstantTexts.SkillCacheKey] == null) { BLSkills objBLSkills = new BLSkills(); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); objDOADM_SkillsMaster.IsActive = true; string errorMessage; ExceptionTypes skillResult = objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out errorMessage); if (skillResult != ExceptionTypes.Success) { //Log } AddToCache(ConstantTexts.SkillCacheKey, lstDOADM_SkillsMaster); } }
public ActionResult Search(string SkillsName = "", long RoleLkup = 0, long BusinessSegmentLkup = 0, long CMN_DepartmentRef = 0, long WorkBasketLkup = 0, bool isActive = true) { try { BLSkills _objBLSkills = new BLSkills(); DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster; string errorMessage = string.Empty; objDOADM_SkillsMaster.IsActive = isActive; objDOADM_SkillsMaster.SkillsName = SkillsName; objDOADM_SkillsMaster.RoleLkup = RoleLkup; objDOADM_SkillsMaster.BusinessSegmentLkup = BusinessSegmentLkup; objDOADM_SkillsMaster.CMN_DepartmentRef = CMN_DepartmentRef; objDOADM_SkillsMaster.WorkBasketLkup = WorkBasketLkup; long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; ExceptionTypes result = _objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, "error while retriving search results", "error while retriving search results"); } else if (result == ExceptionTypes.ZeroRecords) { lstDOADM_SkillsMaster.Add(objDOADM_SkillsMaster); lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); } DOADM_SkillMasterExtended objDOADM_SkillMasterExtended = new DOADM_SkillMasterExtended(); objDOADM_SkillMasterExtended.lstRoles = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Role); objDOADM_SkillMasterExtended.lstBusinessSegment = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.BusinessSegment); objDOADM_SkillMasterExtended.lstDepartment = GetERSDepartments(); objDOADM_SkillMasterExtended.lstWorkBasket = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.WorkBasket); objDOADM_SkillMasterExtended.lstSkillsMaster = lstDOADM_SkillsMaster; return(PartialView("_SearchResults", objDOADM_SkillMasterExtended)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }
public ActionResult CheckSkillExistsUsingSkillName(string skillsName) { long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; string strErrorMessage = string.Empty; string strMessage = string.Empty; bool skillExists = false; try { BLSkills _objBLSkills = new BLSkills(); DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); objDOADM_SkillsMaster.SkillsName = skillsName; objDOADM_SkillsMaster.IsActive = true; List <DOADM_SkillsMaster> lstDOADM_SkillsMaster; ExceptionTypes result = _objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out strErrorMessage); if (lstDOADM_SkillsMaster.Count > 0) { skillExists = true; } else { objDOADM_SkillsMaster.IsActive = false;//search again to check for not active records result = _objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out strErrorMessage); if (lstDOADM_SkillsMaster.Count > 0) { skillExists = true; } else { skillExists = false; } } } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); return(RedirectToAction("Maintenance", "Error", new { Error = MethodBase.GetCurrentMethod().Name + " Action terminated and redirected to Maintenance. Error:" + ex.ToString() })); } return(Json(new { skillExists = skillExists, strMessage = strMessage }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetSkillsBasedOnRoleAndWB(long lWorkBasketLkup, long lRoleLkup) { long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; string errorMessage = string.Empty; try { DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); BLSkills objBLSkills = new BLSkills(); objDOADM_SkillsMaster.WorkBasketLkup = lWorkBasketLkup; objDOADM_SkillsMaster.RoleLkup = lRoleLkup; objDOADM_SkillsMaster.IsActive = true; objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out errorMessage); return(Json(lstDOADM_SkillsMaster)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageAccessGroups, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }
public ActionResult AddSkillsToSession(DOADM_AccessGroupSkillsCorrelation objDOADM_AccessGroupSkillsCorrelation, long lPreviousSkill = 0, long lWorkBasketLkup = 0, long lRoleLkup = 0, int mode = 0) { long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; List <DOADM_AccessGroupSkillsCorrelation> lstDOADM_AccessGroupSkillsCorrelation = new List <DOADM_AccessGroupSkillsCorrelation>(); try { DOADM_AccessGroupSkillsCorrelation objOldDOADM_AccessGroupSkillsCorrelation = new DOADM_AccessGroupSkillsCorrelation(); if (Session[ConstantTexts.AccessGroupSkillSessionKey] != null) { lstDOADM_AccessGroupSkillsCorrelation = Session[ConstantTexts.AccessGroupSkillSessionKey] as List <DOADM_AccessGroupSkillsCorrelation>; } switch (mode) { case 0: //Add new skill to the list if (lstDOADM_AccessGroupSkillsCorrelation.Where(xx => xx.ADM_SkillsMasterRef == objDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef).Count() == 0) { objDOADM_AccessGroupSkillsCorrelation.IsActive = true; objDOADM_AccessGroupSkillsCorrelation.CreatedByRef = currentUser.ADM_UserMasterId; objDOADM_AccessGroupSkillsCorrelation.CreatedByName = currentUser.FullName; objDOADM_AccessGroupSkillsCorrelation.UTCCreatedOn = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone); objDOADM_AccessGroupSkillsCorrelation.LastUpdatedByRef = currentUser.ADM_UserMasterId; objDOADM_AccessGroupSkillsCorrelation.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone); objDOADM_AccessGroupSkillsCorrelation.LastUpdatedByName = currentUser.FullName; lstDOADM_AccessGroupSkillsCorrelation.Add(objDOADM_AccessGroupSkillsCorrelation); } else { objOldDOADM_AccessGroupSkillsCorrelation = lstDOADM_AccessGroupSkillsCorrelation.Where(xx => xx.ADM_SkillsMasterRef == objDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef).FirstOrDefault(); objOldDOADM_AccessGroupSkillsCorrelation.CanCreate = objDOADM_AccessGroupSkillsCorrelation.CanCreate; objOldDOADM_AccessGroupSkillsCorrelation.CanClone = objDOADM_AccessGroupSkillsCorrelation.CanClone; objOldDOADM_AccessGroupSkillsCorrelation.CanHistory = objDOADM_AccessGroupSkillsCorrelation.CanHistory; objOldDOADM_AccessGroupSkillsCorrelation.CanMassUpdate = objDOADM_AccessGroupSkillsCorrelation.CanMassUpdate; objOldDOADM_AccessGroupSkillsCorrelation.CanModify = objDOADM_AccessGroupSkillsCorrelation.CanModify; objOldDOADM_AccessGroupSkillsCorrelation.CanReassign = objDOADM_AccessGroupSkillsCorrelation.CanReassign; objOldDOADM_AccessGroupSkillsCorrelation.CanReopen = objDOADM_AccessGroupSkillsCorrelation.CanReopen; objOldDOADM_AccessGroupSkillsCorrelation.CanSearch = objDOADM_AccessGroupSkillsCorrelation.CanSearch; objOldDOADM_AccessGroupSkillsCorrelation.CanUnlock = objDOADM_AccessGroupSkillsCorrelation.CanUnlock; objOldDOADM_AccessGroupSkillsCorrelation.CanUpload = objDOADM_AccessGroupSkillsCorrelation.CanUpload; objOldDOADM_AccessGroupSkillsCorrelation.CanView = objDOADM_AccessGroupSkillsCorrelation.CanView; objOldDOADM_AccessGroupSkillsCorrelation.LastUpdatedByRef = currentUser.ADM_UserMasterId; objOldDOADM_AccessGroupSkillsCorrelation.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone); objDOADM_AccessGroupSkillsCorrelation.LastUpdatedByName = currentUser.FullName; objOldDOADM_AccessGroupSkillsCorrelation.IsActive = true; } break; case 1: //delete skill from added list if (lstDOADM_AccessGroupSkillsCorrelation.Where(xx => xx.ADM_SkillsMasterRef == objDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef).Count() > 0) { objDOADM_AccessGroupSkillsCorrelation = lstDOADM_AccessGroupSkillsCorrelation.Where(xx => xx.ADM_SkillsMasterRef == objDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef).FirstOrDefault(); objDOADM_AccessGroupSkillsCorrelation.LastUpdatedByRef = currentUser.ADM_UserMasterId; objDOADM_AccessGroupSkillsCorrelation.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone); objDOADM_AccessGroupSkillsCorrelation.IsActive = false; } break; case 2: //update existing skill objOldDOADM_AccessGroupSkillsCorrelation = lstDOADM_AccessGroupSkillsCorrelation.Where(x => x.ADM_SkillsMasterRef == lPreviousSkill).FirstOrDefault(); if (objOldDOADM_AccessGroupSkillsCorrelation.ADM_AccessGroupSkillsCorrelationId == 0) //updating a queue for new record { objOldDOADM_AccessGroupSkillsCorrelation.CreatedByRef = currentUser.ADM_UserMasterId; } objOldDOADM_AccessGroupSkillsCorrelation.CanCreate = objDOADM_AccessGroupSkillsCorrelation.CanCreate; objOldDOADM_AccessGroupSkillsCorrelation.CanClone = objDOADM_AccessGroupSkillsCorrelation.CanClone; objOldDOADM_AccessGroupSkillsCorrelation.CanHistory = objDOADM_AccessGroupSkillsCorrelation.CanHistory; objOldDOADM_AccessGroupSkillsCorrelation.CanMassUpdate = objDOADM_AccessGroupSkillsCorrelation.CanMassUpdate; objOldDOADM_AccessGroupSkillsCorrelation.CanModify = objDOADM_AccessGroupSkillsCorrelation.CanModify; objOldDOADM_AccessGroupSkillsCorrelation.CanReassign = objDOADM_AccessGroupSkillsCorrelation.CanReassign; objOldDOADM_AccessGroupSkillsCorrelation.CanReopen = objDOADM_AccessGroupSkillsCorrelation.CanReopen; objOldDOADM_AccessGroupSkillsCorrelation.CanSearch = objDOADM_AccessGroupSkillsCorrelation.CanSearch; objOldDOADM_AccessGroupSkillsCorrelation.CanUnlock = objDOADM_AccessGroupSkillsCorrelation.CanUnlock; objOldDOADM_AccessGroupSkillsCorrelation.CanUpload = objDOADM_AccessGroupSkillsCorrelation.CanUpload; objOldDOADM_AccessGroupSkillsCorrelation.CanView = objDOADM_AccessGroupSkillsCorrelation.CanView; objOldDOADM_AccessGroupSkillsCorrelation.LastUpdatedByRef = currentUser.ADM_UserMasterId; objOldDOADM_AccessGroupSkillsCorrelation.UTCLastUpdatedOn = ZoneLookupUI.ConvertToTimeZone(DateTime.UtcNow, TimeZone); objOldDOADM_AccessGroupSkillsCorrelation.LastUpdatedByName = currentUser.FullName; objOldDOADM_AccessGroupSkillsCorrelation.IsActive = true; objOldDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef = objDOADM_AccessGroupSkillsCorrelation.ADM_SkillsMasterRef; break; case 3: //removing all the lists from Session foreach (var item in lstDOADM_AccessGroupSkillsCorrelation) { item.LastUpdatedByRef = currentUser.ADM_UserMasterId; item.UTCLastUpdatedOn = DateTime.UtcNow; item.IsActive = false; } break; } DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); BLSkills objBLSkills = new BLSkills(); objDOADM_SkillsMaster.WorkBasketLkup = lWorkBasketLkup; objDOADM_SkillsMaster.RoleLkup = lRoleLkup; objDOADM_SkillsMaster.IsActive = true; objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out string errorMessage); ViewBag.Skills = lstDOADM_SkillsMaster; Session[ConstantTexts.AccessGroupSkillSessionKey] = lstDOADM_AccessGroupSkillsCorrelation; return(PartialView("_Skills", lstDOADM_AccessGroupSkillsCorrelation.Where(xx => xx.IsActive == true).ToList())); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageAccessGroups, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }