public ActionResult Add(long ResourceId = 0, bool isActive = true) { long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; DOADM_ResourceDetails objDOADM_ResourceDetails = new DOADM_ResourceDetails(); objDOADM_ResourceDetails.IsActive = true; string errorMessage = string.Empty; try { ExceptionTypes result; //get list of Depatments for Department drop down List <DOCMN_Department> lstCMN_Department; BLDepartment objBLDepartment = new BLDepartment(); DOCMN_Department objDOCMN_Department = new DOCMN_Department(); objDOCMN_Department.IsActive = true; result = objBLDepartment.SearchDepartment(TimeZone, objDOCMN_Department, out lstCMN_Department, out errorMessage); //check result for DB action if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Resources, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); } //sort list by Depatment name lstCMN_Department = lstCMN_Department.OrderBy(x => x.ERSDepartmentName).ToList(); if (ResourceId != 0) { //temporary list to hold search Resource results List <DOADM_ResourceDetails> lstDOADM_ResourceDetails = new List <DOADM_ResourceDetails>(); //temporary object for search resources function DOADM_ResourceDetails objDOADM_ResourceDetails_Find = new DOADM_ResourceDetails(); objDOADM_ResourceDetails_Find.ADM_ResourceDetailsId = ResourceId; objDOADM_ResourceDetails_Find.IsActive = isActive; result = _objBLResources.SearchResources(TimeZone, objDOADM_ResourceDetails_Find, out lstDOADM_ResourceDetails, out errorMessage); //check result for DB action if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Resources, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); } if (lstDOADM_ResourceDetails.Count > 0) { objDOADM_ResourceDetails = lstDOADM_ResourceDetails.FirstOrDefault(); } } //Alert Time Zone lookup from Cache objDOADM_ResourceDetails.lstTimeZone = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Timezone); objDOADM_ResourceDetails.lstCMN_Department = lstCMN_Department; return(View(objDOADM_ResourceDetails)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Resources, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", ex.ToString())); } }
private List <DOADM_ResourceDetails> GetResources() { long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; ExceptionTypes result; List <DOADM_ResourceDetails> lstDOADM_ResourceDetails; BLResources objBLResources = new BLResources(); DOADM_ResourceDetails objDOADM_ResourceDetails = new DOADM_ResourceDetails(); objDOADM_ResourceDetails.IsActive = true; objDOADM_ResourceDetails.ConsiderDates = true; result = objBLResources.SearchResources(TimeZone, objDOADM_ResourceDetails, out lstDOADM_ResourceDetails, out string strErrorMessage); //check result for DB action if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Home, (long)ExceptionTypes.Uncategorized, strErrorMessage, strErrorMessage); } return(lstDOADM_ResourceDetails); }