public ActionResult Save(UIDOAccessGroup objUIDOAccessGroup) { string errorMessage = string.Empty; string returnMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); try { //check if this call is to update record or save new record if (objUIDOAccessGroup.ADM_AccessGroupMasterId > 0) { //if old record is to be updated BLCommon objCommon = new BLCommon(); //check if record is locked by current user if (!objCommon.ValidateLockBeforeSave(currentUser.ADM_UserMasterId, (long)ScreenType.AccessGroup, objUIDOAccessGroup.ADM_AccessGroupMasterId)) { //if record is not locked by current user dont save record and return error. errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } returnMessage = "Record updated successfully."; } else { //If new record to be saved returnMessage = "Record saved successfully."; } objUIDOAccessGroup.lstDOADM_AccessGroupSkillsCorrelation = new List <DOADM_AccessGroupSkillsCorrelation>(); objUIDOAccessGroup.lstDOADM_AccessGroupReportCorrelation = new List <DOADM_AccessGroupReportCorrelation>(); if (Session[ConstantTexts.AccessGroupSkillSessionKey] != null) { objUIDOAccessGroup.lstDOADM_AccessGroupSkillsCorrelation = Session[ConstantTexts.AccessGroupSkillSessionKey] as List <DOADM_AccessGroupSkillsCorrelation>; } if (Session[ConstantTexts.AccessGroupReportSessionKey] != null) { objUIDOAccessGroup.lstDOADM_AccessGroupReportCorrelation = Session[ConstantTexts.AccessGroupReportSessionKey] as List <DOADM_AccessGroupReportCorrelation>; } BLAccessGroup objBLAccessGroup = new BLAccessGroup(); result = objBLAccessGroup.AddEditAccessGroup(currentUser.ADM_UserMasterId, objUIDOAccessGroup, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageAccessGroups, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } Session[ConstantTexts.AccessGroupSkillSessionKey] = null; Session[ConstantTexts.AccessGroupReportSessionKey] = null; return(Json(new { ID = result, Message = returnMessage })); } 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() })); } }
public ActionResult Add(DOCMN_Department Department) { string errorMessage = string.Empty; string returnMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); try { long loginUserId = currentUser.ADM_UserMasterId; BLDepartment objBLDepartment = new BLDepartment(); DOCMN_Department objDOCMN_Department = new DOCMN_Department(); objDOCMN_Department.CMN_DepartmentId = Department.CMN_DepartmentId; if (objDOCMN_Department.CMN_DepartmentId > 0) // Edit Mode { BLCommon objCommon = new BLCommon(); if (!objCommon.ValidateLockBeforeSave(loginUserId, (long)ScreenType.Department, objDOCMN_Department.CMN_DepartmentId)) { errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } objDOCMN_Department.CreatedByRef = loginUserId; returnMessage = "Record updated successfully."; } else { objDOCMN_Department.CreatedByRef = loginUserId; //Add Mode returnMessage = "Record saved successfully."; } objDOCMN_Department.ERSDepartmentName = Department.ERSDepartmentName; objDOCMN_Department.BusinessSegmentLkup = Department.BusinessSegmentLkup; objDOCMN_Department.DepartmentLkup = Department.DepartmentLkup; objDOCMN_Department.EffectiveDate = Department.EffectiveDate; objDOCMN_Department.InactivationDate = Department.InactivationDate; objDOCMN_Department.IsActive = Department.IsActive; objDOCMN_Department.UTCCreatedOn = Department.UTCCreatedOn; result = objBLDepartment.SaveDepartment(objDOCMN_Department, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Department, (long)ExceptionTypes.Uncategorized, errorMessage.ToString(), errorMessage.ToString()); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } return(Json(new { ID = result, Message = returnMessage })); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Department, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(Json(new { ID = result, Message = "An error occured while performing Save action." })); } }
public ActionResult Add(DOMGR_ConfigMaster ConfigMaster) { string errorMessage = string.Empty; string returnMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); try { long loginUserId = currentUser.ADM_UserMasterId; BLConfigurations objBLConfigurations = new BLConfigurations(); DOMGR_ConfigMaster objDOMGR_ConfigMaster = new DOMGR_ConfigMaster(); objDOMGR_ConfigMaster.MGR_ConfigMasterId = ConfigMaster.MGR_ConfigMasterId; if (objDOMGR_ConfigMaster.MGR_ConfigMasterId > 0) // Edit Mode { BLCommon objCommon = new BLCommon(); if (!objCommon.ValidateLockBeforeSave(loginUserId, (long)ScreenType.Configuration, objDOMGR_ConfigMaster.MGR_ConfigMasterId)) { errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } objDOMGR_ConfigMaster.CreatedByRef = loginUserId; returnMessage = "Record updated successfully."; } else { objDOMGR_ConfigMaster.CreatedByRef = loginUserId; //Add Mode returnMessage = "Record saved successfully."; } objDOMGR_ConfigMaster.ConfigName = ConfigMaster.ConfigName; objDOMGR_ConfigMaster.ConfigValue = ConfigMaster.ConfigValue; objDOMGR_ConfigMaster.StartDate = ConfigMaster.StartDate; objDOMGR_ConfigMaster.EndDate = ConfigMaster.EndDate; objDOMGR_ConfigMaster.IsActive = ConfigMaster.IsActive; result = objBLConfigurations.SaveConfigMaster(objDOMGR_ConfigMaster, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Configurations, (long)ExceptionTypes.Uncategorized, errorMessage.ToString(), errorMessage.ToString()); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } return(Json(new { ID = result, Message = returnMessage })); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Configurations, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(Json(new { ID = result, Message = "An error occured while performing Save action." })); } }
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(DOADM_ResourceDetails objDOADM_ResourceDetails) { string errorMessage = string.Empty; long loginUserId = currentUser.ADM_UserMasterId; string returnMessage = ""; ExceptionTypes result = new ExceptionTypes(); try { //check if this call is to update record or save new record if (objDOADM_ResourceDetails.ADM_ResourceDetailsId > 0) { //if old record is to be updated BLCommon objCommon = new BLCommon(); //check if record is locked by current user if (!objCommon.ValidateLockBeforeSave(loginUserId, (long)ScreenType.Resources, objDOADM_ResourceDetails.ADM_ResourceDetailsId)) { //if record is not locked by current user dont save record and return error. errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } returnMessage = "Record updated successfully."; } else { //If new record to be saved returnMessage = "Record saved successfully."; } objDOADM_ResourceDetails.LoginUserId = loginUserId; result = _objBLResources.SaveResource(objDOADM_ResourceDetails, out errorMessage); //check result for DB action if (result != (long)ExceptionTypes.Success) { //if not success BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Resources, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } return(Json(new { ID = result, Message = returnMessage })); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Resources, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } }
/// <summary> /// Save / Modify lookup Type /// </summary> /// <param name="objDOCMN_LookupType"></param> /// <returns></returns> public ActionResult SaveLookupType(DOCMN_LookupType objDOCMN_LookupType) { errorMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); try { long loginUserId = currentUser.ADM_UserMasterId; string returnMessage = string.Empty; if (objDOCMN_LookupType.CMN_LookupTypeId > 0) //Edit Mode { BLCommon objCommon = new BLCommon(); if (!objCommon.ValidateLockBeforeSave(loginUserId, (long)ScreenType.LookupType, objDOCMN_LookupType.CMN_LookupTypeId)) { errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } objDOCMN_LookupType.LastUpdatedByRef = loginUserId; returnMessage = "Record updated successfully."; } else { objDOCMN_LookupType.CreatedByRef = loginUserId; //Add Mode returnMessage = "Record saved successfully."; } result = _objBLLookup.SaveLookupType(objDOCMN_LookupType, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Lookups, (long)ExceptionTypes.Uncategorized, string.Empty, errorMessage); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } return(Json(new { ID = result, Message = returnMessage })); } catch (Exception ex) { ViewBag.ErrorMessage = ex.ToString(); BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Lookups, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } }
public ActionResult Add(DOADM_UserMaster objDOADM_UserMaster) { string errorMessage = string.Empty; ExceptionTypes result = new ExceptionTypes(); string returnMessage = string.Empty; try { //check if this call is to update record or save new record if (objDOADM_UserMaster.ADM_UserMasterId > 0) { //if old record is to be updated BLCommon objCommon = new BLCommon(); //check if record is locked by current user if (!objCommon.ValidateLockBeforeSave(currentUser.ADM_UserMasterId, (long)ScreenType.UserAdmin, objDOADM_UserMaster.ADM_UserMasterId)) { //if record is not locked by current user dont save record and return error. errorMessage = "Record not locked, please reload the page."; result = ExceptionTypes.UnknownError; return(Json(new { ID = result, Message = errorMessage })); } returnMessage = "Record updated successfully."; } else { objDOADM_UserMaster.CreatedByRef = currentUser.ADM_UserMasterId; //If new record to be saved returnMessage = "Record saved successfully."; } objDOADM_UserMaster.FullName = objDOADM_UserMaster.FirstName != null ? objDOADM_UserMaster.LastName + ", " + objDOADM_UserMaster.FirstName : objDOADM_UserMaster.LastName; objDOADM_UserMaster.SpecialistFax = String.IsNullOrEmpty(objDOADM_UserMaster.SpecialistFax) ? "" : String.Join("", objDOADM_UserMaster.SpecialistFax.Split('-')); objDOADM_UserMaster.SpecialistPhone = String.IsNullOrEmpty(objDOADM_UserMaster.SpecialistPhone) ? "" : String.Join("", objDOADM_UserMaster.SpecialistPhone.Split('-')); objDOADM_UserMaster.UserZip = String.IsNullOrEmpty(objDOADM_UserMaster.UserZip) ? "" : String.Join("", objDOADM_UserMaster.UserZip.Split('-')); objDOADM_UserMaster.IsActive = objDOADM_UserMaster.IsActive; objDOADM_UserMaster.IsManager = objDOADM_UserMaster.IsManager; objDOADM_UserMaster.CreatedByRoleLkup = currentUser.RoleLkup; objDOADM_UserMaster.UpdatedByRoleLkup = currentUser.RoleLkup; objDOADM_UserMaster.LastUpdatedByRef = currentUser.ADM_UserMasterId; if (Session[ConstantTexts.UserAccessGroupSessionKey] != null) { objDOADM_UserMaster.lstDOADM_AccessGroupUserCorrelation = Session[ConstantTexts.UserAccessGroupSessionKey] as List <DOADM_AccessGroupUserCorrelation>; } BLUserAdministration objBLUserAdministration = new BLUserAdministration(); result = objBLUserAdministration.SaveUser(objDOADM_UserMaster, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (long)ExceptionTypes.Uncategorized, string.Empty, "error occured while saving data"); return(Json(new { ID = result, Message = "An error occured while updating DB." })); } return(Json(new { ID = result, Message = returnMessage })); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageUsers, (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() })); } }