Пример #1
0
 public IActionResult UpdateCostCenter([FromBody] CostCenters costCenter)
 {
     if (costCenter == null)
     {
         return(Ok(new APIResponse {
             status = APIStatus.FAIL.ToString(), response = $"{nameof(costCenter)} cannot be null"
         }));
     }
     try
     {
         var         rs = CostCenterHelper.UpdateCostCenter(costCenter);
         APIResponse apiResponse;
         if (rs != null)
         {
             apiResponse = new APIResponse()
             {
                 status = APIStatus.PASS.ToString(), response = rs
             };
         }
         else
         {
             apiResponse = new APIResponse()
             {
                 status = APIStatus.FAIL.ToString(), response = "Updation Failed."
             };
         }
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(Ok(new APIResponse {
             status = APIStatus.FAIL.ToString(), response = ex.Message
         }));
     }
 }
Пример #2
0
        public Collection <ListItem> GetCostCenters()
        {
            Collection <ListItem> values = new Collection <ListItem>();


            foreach (CostCenter costCenter in CostCenters.GetCostCenters())
            {
                values.Add(new ListItem(costCenter.CostCenterName, costCenter.CostCenterId.ToString(CultureInfo.InvariantCulture)));
            }

            return(values);
        }
Пример #3
0
        public static CostCenters UpdateCostCenter(CostCenters costCenters)
        {
            try
            {
                using Repository <CostCenters> repo = new Repository <CostCenters>();
                repo.CostCenters.Update(costCenters);
                if (repo.SaveChanges() > 0)
                {
                    return(costCenters);
                }

                return(null);
            }
            catch { throw; }
        }
 private void RefreshCostCenterBudget()
 {
     if (selectedCostCenter != null)
     {
         var tempRemaining = CostCenters.GetRemainingBudgetForId(selectedCostCenter.CostCenterId, Date.Year);
         if (tempRemaining == decimal.MinValue)
         {
             RemainingCostCenterBudget = CostCenters.GetBudgetForId(selectedCostCenter.CostCenterId, Date.Year);
         }
         else
         {
             RemainingCostCenterBudget = tempRemaining;
         }
     }
 }
Пример #5
0
        public static CostCenters RegisterCostCenter(CostCenters costCenter)
        {
            try
            {
                using Repository <CostCenters> repo = new Repository <CostCenters>();
                costCenter.Active = "Y";
                repo.CostCenters.Add(costCenter);
                if (repo.SaveChanges() > 0)
                {
                    return(costCenter);
                }

                return(null);
            }
            catch { throw; }
        }
Пример #6
0
        public Collection <ListItem> GetCostCenters()
        {
            Collection <ListItem> values = new Collection <ListItem>();

            using (DataTable table = CostCenters.GetCostCenterDataTable())
            {
                string displayField = ConfigurationHelper.GetDbParameter("CostCenterDisplayField");
                table.Columns.Add("cost_center", typeof(string), displayField);

                foreach (DataRow dr in table.Rows)
                {
                    values.Add(new ListItem(dr["cost_center"].ToString(), dr["cost_center_id"].ToString()));
                }
            }

            return(values);
        }
Пример #7
0
        private void DeleteProject()
        {
            if (SelectedProject == null)
            {
                return;
            }

            if (SelectedProject.ProjectId == 0)
            {
                ProjectList.Remove(SelectedProject);
                SelectedProject = null;
                return;
            }

            CostCenters.Delete(SelectedProject.ProjectId);
            ProjectList.Remove(SelectedProject);
            SelectedProject = null;
        }
Пример #8
0
        public IActionResult RegisterCostCenter([FromBody] CostCenters costCenter)
        {
            if (costCenter == null)
            {
                return(Ok(new APIResponse {
                    status = APIStatus.FAIL.ToString(), response = $"{nameof(costCenter)} cannot be null"
                }));
            }
            try
            {
                if (CostCenterHelper.IsCodeExists(costCenter.Code))
                {
                    return(Ok(new APIResponse {
                        status = APIStatus.FAIL.ToString(), response = $"Code ={costCenter.Code} Already Exists."
                    }));
                }

                var         result = CostCenterHelper.RegisterCostCenter(costCenter);
                APIResponse apiResponse;
                if (result != null)
                {
                    apiResponse = new APIResponse()
                    {
                        status = APIStatus.PASS.ToString(), response = result
                    };
                }
                else
                {
                    apiResponse = new APIResponse()
                    {
                        status = APIStatus.FAIL.ToString(), response = "Registration Failed."
                    };
                }

                return(Ok(apiResponse));
            }
            catch (Exception ex)
            {
                return(Ok(new APIResponse {
                    status = APIStatus.FAIL.ToString(), response = ex.Message
                }));
            }
        }
Пример #9
0
        private void FillPurchaseOrderLineTab()
        {
            vendorList.ItemsSource       = Vendors.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            vendorList.DisplayMemberPath = "Value";
            vendorList.SelectedValuePath = "Key";
            var fVendorSelected = Vendors.First(x => x.AdministrationCode == PO.VendorCode);

            vendorList.SelectedIndex = Vendors.IndexOf(fVendorSelected);

            //PODescription.SetBinding(PO, "Description");

            GLAccountList.ItemsSource            = GLAccounts.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            ArticleList.ItemsSource              = Articles.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            WarehouseList.ItemsSource            = Warehouses.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            VatCodeList.ItemsSource              = VatCodes.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            CostCenterList.ItemsSource           = CostCenters.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            CostUnitList.ItemsSource             = CostUnits.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            ProjectList.ItemsSource              = Projects.ToDictionary(x => x.AdministrationCode, y => $"{y.AdministrationCode} - {y.Name}");
            purchaseOrderLineGrid.ItemsSource    = PO.OrderLines;
            purchaseOrderLineGrid.CanUserAddRows = true;
        }
 private void LoadCostCenters()
 {
     CostCenterList         = CostCenters.GetAll().ToSvenTechCollection();
     CostCenterCategoryList = CostCenterCategories.GetAll().ToSvenTechCollection();
     SetupFlatStructure();
 }
Пример #11
0
 private void LoadCostCenters()
 {
     CostCenterList = CostCenters.GetAll().ToSvenTechCollection();
 }