/// <summary> /// Processes the edit type of exit information. /// </summary> /// <param name="typeOfExitInfo">The type of exit information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">typeOfExitInfo</exception> public string ProcessEditTypeOfExitInfo(ITypeOfExitView typeOfExitInfo) { if (typeOfExitInfo == null) { throw new ArgumentNullException(nameof(typeOfExitInfo)); } var processingMessage = string.Empty; bool isData = true; isData = ((this.typeOfExitRepository.GetTypeOfExitByName(typeOfExitInfo.TypeOfExitName)) == null) ? true : false; if (!isData) { processingMessage = Messages.ExitTypeAlreayExist; return(processingMessage); } processingMessage = this.typeOfExitRepository.SaveEditTypeOfExitInfo(typeOfExitInfo); return(processingMessage); }
/// <summary> /// Saves the edit type of exit information. /// </summary> /// <param name="typeOfExitInfo">The type of exit information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">typeOfExitInfo</exception> public string SaveEditTypeOfExitInfo(ITypeOfExitView typeOfExitInfo) { if (typeOfExitInfo == null) { throw new ArgumentNullException(nameof(typeOfExitInfo)); } string result = string.Empty; try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { var modelInfo = dbContext.TypeOfExits.SingleOrDefault(p => p.TypeOFExitId == typeOfExitInfo.TypeOfExitId); modelInfo.TypeOFExitName = typeOfExitInfo.TypeOfExitName; dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("Save Edit TypeOfExit Info - {0}, {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } return(result); }
/// <summary> /// </summary> /// <param name="typeOfExitInfo"></param> /// <returns></returns> /// <exception cref="ArgumentNullException">typeOfExitInfo</exception> public string SaveTypeOfExitInfo(ITypeOfExitView typeOfExitInfo) { if (typeOfExitInfo == null) { throw new ArgumentNullException(nameof(typeOfExitInfo)); } var result = string.Empty; var newTypeOfExit = new TypeOfExit { CompanyId = typeOfExitInfo.CompanyId, TypeOFExitId = typeOfExitInfo.TypeOfExitId, TypeOFExitName = typeOfExitInfo.TypeOfExitName, IsActive = true, }; try { using ( var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS)) { dbContext.TypeOfExits.Add(newTypeOfExit); dbContext.SaveChanges(); } } catch (Exception e) { result = string.Format("SaveRegistrationInfo - {0} , {1}", e.Message, e.InnerException != null ? e.InnerException.Message : ""); } var typeOfExitID = newTypeOfExit.TypeOFExitId; return(result); }
/// <summary> /// Creates the type of exit view. /// </summary> /// <param name="typeOfExitView">The type of exit view.</param> /// <param name="employeeCollection">The employee collection.</param> /// <param name="typeOfExitCollection">The type of exit collection.</param> /// <returns></returns> /// <exception cref="ArgumentNullException"> /// typeOfExitView /// or /// employeeCollection /// or /// typeOfExitCollection /// </exception> public ITypeOfExitView CreateTypeOfExitView(ITypeOfExitView typeOfExitView, IList <IEmployee> employeeCollection, IList <ITypeOfExit> typeOfExitCollection) { if (typeOfExitView == null) { throw new ArgumentNullException(nameof(typeOfExitView)); } if (employeeCollection == null) { throw new ArgumentNullException(nameof(employeeCollection)); } if (typeOfExitCollection == null) { throw new ArgumentNullException(nameof(typeOfExitCollection)); } var employeeDDL = GetDropDownList.EmployeeListitems(employeeCollection, typeOfExitView.EmployeeId); var typeOfExitDDL = GetDropDownList.TypeOfExitListItems(typeOfExitCollection, typeOfExitView.TypeOfExitId); var interViewerDDL = GetDropDownList.EmployeeListitems(employeeCollection, typeOfExitView.EmployeeId); typeOfExitView.EmployeeDropDown = employeeDDL; typeOfExitView.TypeOfExitDropDown = typeOfExitDDL; typeOfExitView.InterViewerDropDown = interViewerDDL; return(typeOfExitView); }
/// <summary> /// Gets the type of exit update view. /// </summary> /// <param name="TypeOfExit">The type of exit.</param> /// <param name="processingMessage">The processing message.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">TypeOfExit</exception> public ITypeOfExitView GetTypeOfExitUpdateView(ITypeOfExitView TypeOfExit, string processingMessage) { if (TypeOfExit == null) { throw new ArgumentNullException(nameof(TypeOfExit)); } var viewModel = this.typeOfExitViewModelFactory.CreateTypeOfExitUpdateView(TypeOfExit, processingMessage); return(viewModel); }
/// <summary> /// Creates the type of exit update view. /// </summary> /// <param name="TypeOfExit">The type of exit.</param> /// <param name="processingMessage">The processing message.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">TypeOfExit</exception> public ITypeOfExitView CreateTypeOfExitUpdateView(ITypeOfExitView TypeOfExit, string processingMessage) { if (TypeOfExit == null) { throw new ArgumentNullException(nameof(TypeOfExit)); } TypeOfExit.ProcessingMessage = processingMessage; return(TypeOfExit); }