Exemplo n.º 1
0
 private Decimal TakeSumOfCost(int number)
 {
     using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
     {
         if (number == 1)
         {
             List <Cost> costs     = context.cost.Where(w => w.Month == monthValue).Where(w => w.Status == "company").ToList();
             Decimal     sumOfCost = 0m;
             foreach (Cost c in costs)
             {
                 sumOfCost += c.Amount;
             }
             return(sumOfCost);
         }
         else if (number == 2)
         {
             List <Cost> costs     = context.cost.Where(w => w.Month == monthValue).ToList();
             Decimal     sumOfCost = 0m;
             foreach (Cost c in costs)
             {
                 sumOfCost += c.Amount;
             }
             return(sumOfCost);
         }
     }
     return(0);
 }
Exemplo n.º 2
0
 private List <Cost> whichCostView(int number)
 {
     using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
     {
         if (number == 1)
         {
             List <Cost> cost = context.cost.Where(w => w.Month == monthValue).ToList();
             return(cost);
         }
         return(null);
     }
 }
Exemplo n.º 3
0
 private List <Taking> whichTakingView(int number)
 {
     using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
     {
         if (number == 1)
         {
             List <Taking> takings = context.taking.Where(w => w.Month == monthValue).ToList();
             return(takings);
         }
         return(null);
     }
 }
Exemplo n.º 4
0
        private void registerTaxPrepayment(decimal amount, string month, string description)
        {
            DateTime nowTime = DateTime.Now;

            using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
            {
                TaxPrepayment newTaxPrepayment = new TaxPrepayment()
                {
                    Amount      = amount,
                    Month       = month,
                    Description = description,
                    Data        = nowTime
                };
                context.taxPrepayment.Add(newTaxPrepayment);
                context.SaveChanges();
            }
        }
Exemplo n.º 5
0
 private Decimal TakeSumOfTaking(int number)
 {
     using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
     {
         if (number == 1)
         {
             List <Taking> takings     = context.taking.Where(w => w.Month == monthValue).ToList();
             Decimal       sumOfAmount = 0m;
             foreach (Taking t in takings)
             {
                 sumOfAmount += t.Amount;
             }
             return(sumOfAmount);
         }
     }
     return(0);
 }
Exemplo n.º 6
0
        private void registerCost(decimal amount, string month, string description, string status)
        {
            DateTime nowTime = DateTime.Now;

            using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())
            {
                Cost newCost = new Cost()
                {
                    Amount      = amount,
                    Month       = month,
                    Description = description,
                    Data        = nowTime,
                    Status      = status
                };
                context.cost.Add(newCost);
                context.SaveChanges();
            }
        }
Exemplo n.º 7
0
        private void DeleteLastButton_Click(object sender, RoutedEventArgs e)
        {
            using (FinancialSettlementAppBase context = new FinancialSettlementAppBase())

                if (operationValue == "AddTakings")
                {
                    bool oldValidateOnSaveEnabled = context.Configuration.ValidateOnSaveEnabled;

                    try
                    {
                        context.Configuration.ValidateOnSaveEnabled = false;

                        Taking takingToRemove = (Taking)DisplayGrid.SelectedItem;

                        context.Entry(takingToRemove).State = System.Data.Entity.EntityState.Deleted;
                        context.SaveChanges();
                    }
                    finally
                    {
                        context.Configuration.ValidateOnSaveEnabled = oldValidateOnSaveEnabled;
                    }
                    viewTaking(whichTakingView(1));
                }
                else if (operationValue == "AddCost")
                {
                    bool oldValidateOnSaveEnabled = context.Configuration.ValidateOnSaveEnabled;

                    try
                    {
                        context.Configuration.ValidateOnSaveEnabled = false;

                        Cost costToRemove = (Cost)DisplayGrid.SelectedItem;

                        context.Entry(costToRemove).State = System.Data.Entity.EntityState.Deleted;
                        context.SaveChanges();
                    }
                    finally
                    {
                        context.Configuration.ValidateOnSaveEnabled = oldValidateOnSaveEnabled;
                    }
                    viewCost(whichCostView(1));
                }
        }