Example #1
0
 public void SaveFixedCostAllocation()
 {
     if (SelectedFixedCostAllocation.FixedCostAllocationId > 0)
     {
         FixedCostAllocations.Update(SelectedFixedCostAllocation);
         foreach (FixedCostAllocationDetail item in SelectedFixedCostAllocation.FixedCostAllocationDetails)
         {
             if (item.RefFixedCostAllocationId == 0)
             {
                 item.RefFixedCostAllocationId = SelectedFixedCostAllocation.FixedCostAllocationId;
                 FixedCostAllocationDetails.Insert(item);
             }
             else
             {
                 FixedCostAllocationDetails.Update(item);
             }
         }
     }
     else
     {
         int id = FixedCostAllocations.Insert(SelectedFixedCostAllocation);
         foreach (FixedCostAllocationDetail item in SelectedFixedCostAllocation.FixedCostAllocationDetails)
         {
             item.RefFixedCostAllocationId = id;
             FixedCostAllocationDetails.Insert(item);
         }
     }
 }
Example #2
0
 public void DeleteFixedCostAllocationDetail()
 {
     try
     {
         FixedCostAllocationDetail itemToRemove = SelectedFixedCostAllocation?.FixedCostAllocationDetails.Single(x => x.CostCenter == SelectedFixedCostAllocationDetail.CostCenter);
         SelectedFixedCostAllocation?.FixedCostAllocationDetails.Remove(itemToRemove);
         if (itemToRemove.FixedCostAllocationDetailId != 0)
         {
             FixedCostAllocationDetails.Delete(itemToRemove.FixedCostAllocationDetailId);
         }
     }
     catch (Exception)
     {
         // TODO Error Message
     }
 }
Example #3
0
        public void SaveFixedCostAllocationDetail()
        {
            if (DoesCostCenterAlreadyExist(SelectedCostCenter.CostCenterId))
            {
                Messenger.Default.Send(new OpenDialogWindowMessage("Fehler", "Kostenstelle ist bereits enhalten.", MessageBoxImage.Asterisk));
                return;
            }

            SelectedFixedCostAllocationDetail.CostCenter      = SelectedCostCenter;
            SelectedFixedCostAllocationDetail.RefCostCenterId = SelectedCostCenter.CostCenterId;
            SelectedFixedCostAllocationDetail.CostCenter.CostCenterCategory = SelectedCostCenterCategory;
            SelectedFixedCostAllocationDetail.Shares = Shares;

            if (SelectedFixedCostAllocationDetail.FixedCostAllocationDetailId > 0)
            {
                FixedCostAllocationDetails.Update(SelectedFixedCostAllocationDetail);
            }
        }