コード例 #1
0
        public CapexCost UpdateCapexCost(CapexCost capexCost)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ICapexCostRepository capexCostRepository = _DataRepositoryFactory.GetDataRepository <ICapexCostRepository>();

                CapexCost updatedEntity = null;

                if (capexCost.CapexCostId == 0)
                {
                    updatedEntity = capexCostRepository.Add(capexCost);
                }
                else
                {
                    updatedEntity = capexCostRepository.Update(capexCost);
                }

                return updatedEntity;
            }));
        }
コード例 #2
0
        public void DeleteCapexCost(int capexCostId)
        {
            ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ICapexCostRepository capexCostRepository = _DataRepositoryFactory.GetDataRepository <ICapexCostRepository>();

                capexCostRepository.Remove(capexCostId);
            });
        }
コード例 #3
0
        public CapexCost[] GetAllCapexCosts()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ICapexCostRepository capexCostRepository = _DataRepositoryFactory.GetDataRepository <ICapexCostRepository>();

                IEnumerable <CapexCost> capexCost = capexCostRepository.Get().ToArray();

                return capexCost.ToArray();
            }));
        }
コード例 #4
0
        public CapexCostData[] GetCapexCosts(string year, string reviewCode)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ICapexCostRepository capexCategoryRepository = _DataRepositoryFactory.GetDataRepository <ICapexCostRepository>();

                List <CapexCostData> capexCategory = new List <CapexCostData>();
                IEnumerable <CapexCostInfo> capexCategoryInfos = capexCategoryRepository.GetCapexCosts(year, reviewCode).ToArray();

                foreach (var capexCategoryInfo in capexCategoryInfos)
                {
                    capexCategory.Add(
                        new CapexCostData
                    {
                        CapexCostId = capexCategoryInfo.CapexCost.EntityId,
                        Year = capexCategoryInfo.CapexCost.Year,
                        ReviewCode = capexCategoryInfo.CapexCost.ReviewCode,
                        Cost = capexCategoryInfo.CapexCost.Cost,
                        CenterType = capexCategoryInfo.CapexCost.CenterType,
                        CurrencyCode = capexCategoryInfo.CapexCost.CurrencyCode,
                        CurrencyName = capexCategoryInfo.Currency.Name,
                        DefintionCode = capexCategoryInfo.TeamDefinition.Code,
                        DefintionName = capexCategoryInfo.TeamDefinition.Name,
                        ItemCode = capexCategoryInfo.CapexItem.Code,
                        ItemName = capexCategoryInfo.CapexItem.Name,
                        MisCode = capexCategoryInfo.Team.Code,
                        MisName = capexCategoryInfo.Team.Name,
                        Active = capexCategoryInfo.CapexCost.Active
                    });
                }

                return capexCategory.ToArray();
            }));
        }
コード例 #5
0
        public CapexCost GetCapexCost(int capexCostId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ICapexCostRepository capexCostRepository = _DataRepositoryFactory.GetDataRepository <ICapexCostRepository>();

                CapexCost capexCostEntity = capexCostRepository.Get(capexCostId);
                if (capexCostEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format(" CapexCost with ID of {0} is not in database", capexCostId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return capexCostEntity;
            }));
        }