public StaffCost UpdateStaffCost(StaffCost staffCost) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); StaffCost updatedEntity = null; if (staffCost.StaffCostId == 0) { updatedEntity = staffCostRepository.Add(staffCost); } else { updatedEntity = staffCostRepository.Update(staffCost); } return updatedEntity; })); }
public void DeleteStaffCost(int staffCostId) { ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); staffCostRepository.Remove(staffCostId); }); }
public StaffCost[] GetAllStaffCosts() { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); IEnumerable <StaffCost> staffCosts = staffCostRepository.Get().ToArray(); return staffCosts.ToArray(); })); }
public StaffCostData[] GetStaffCosts(string year, string reviewCode, string definitionCode, string misCode, CenterTypeEnum center) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); List <StaffCostData> staffCost = new List <StaffCostData>(); IEnumerable <StaffCostInfo> staffCostInfos = staffCostRepository.GetStaffCosts(year, reviewCode, definitionCode, misCode, center).ToArray(); foreach (var staffCostInfo in staffCostInfos) { staffCost.Add( new StaffCostData { StaffCostId = staffCostInfo.StaffCost.EntityId, Year = staffCostInfo.StaffCost.Year, ClassificationCode = staffCostInfo.StaffCost.ClassificationCode, ClassificationName = staffCostInfo.PayClassification.Name, GradeCode = staffCostInfo.Grade.Code, GradeName = staffCostInfo.Grade.Name, CenterType = staffCostInfo.StaffCost.CenterType, CurrencyCode = staffCostInfo.StaffCost.CurrencyCode, DefintionCode = staffCostInfo.TeamDefinition.Code, DefintionName = staffCostInfo.TeamDefinition.Name, MisCode = staffCostInfo.Team.Code, MisName = staffCostInfo.Team.Name, TransactionType = staffCostInfo.StaffCost.TransactionType, ReviewCode = staffCostInfo.StaffCost.ReviewCode, Active = staffCostInfo.StaffCost.Active }); } return staffCost.ToArray(); })); }
public StaffCost GetStaffCost(int staffCostId) { return(ExecuteFaultHandledOperation(() => { var groupNames = new List <string>() { BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS }; AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames); IStaffCostRepository staffCostRepository = _DataRepositoryFactory.GetDataRepository <IStaffCostRepository>(); StaffCost staffCostEntity = staffCostRepository.Get(staffCostId); if (staffCostEntity == null) { NotFoundException ex = new NotFoundException(string.Format("StaffCost with ID of {0} is not in database", staffCostId)); throw new FaultException <NotFoundException>(ex, ex.Message); } return staffCostEntity; })); }