Beispiel #1
0
        /// <summary>
        /// Получаем сумму других доходов в казну
        /// </summary>
        /// <param name="cashBox">операции по казне</param>
        /// <returns>другие доходы в казну</returns>
        public int GetOtherIncomes(CashBox cashBox)
        {
            var otherIncomes = ParseInt("Введите сумму других доходов");

            Console.WriteLine($"Сумма других доходов {otherIncomes} грн");
            var newOperation = new CashBox {
                OtherIncomes = otherIncomes, CurrentDate = DateTime.Now
            };

            using (var db = new CashBoxDatabase())
            {
                db.CashBoxOperations.Add(newOperation);
                db.SaveChanges();
            }
            return(cashBox.OtherIncomes);
        }
Beispiel #2
0
        /// <summary>
        /// Получаем проплату за мастерской
        /// </summary>
        /// <param name="cashBox">операции по казне</param>
        /// <returns>проплата за аренду мастерской</returns>
        public int WorkshopRentalPayment(CashBox cashBox)
        {
            int monthRentalSum     = 1000;
            int totalRentalDebtSum = monthRentalSum * (MonthDifference(DateTime.Now) + 1);

            int workshopRentalPayment = ParseInt("Введите суму оплаты за аренду мастерской");

            var newOperation = new CashBox {
                WorkshopRental = workshopRentalPayment, CurrentDate = DateTime.Now
            };

            using (var db = new CashBoxDatabase())
            {
                db.CashBoxOperations.Add(newOperation);
                db.SaveChanges();

                var workshopRentalPaymentSum = db.CashBoxOperations.Sum(p => p.WorkshopRental);
                RentalPaymentsReport(workshopRentalPaymentSum, totalRentalDebtSum, "мастерской");
            }
            return(cashBox.WorkshopRental);
        }
Beispiel #3
0
        /// <summary>
        /// Получаем проплату за аренду общинного дома
        /// </summary>
        /// <param name="cashBox">операции по казне</param>
        /// <returns>проплата за аренду общинного дом</returns>
        public int CommunityHouseRentalPayment(CashBox cashBox)
        {
            int monthRentalSum     = 800;
            int totalRentalDebtSum = monthRentalSum * (MonthDifference(DateTime.Now) + 1);

            int communityHouseRentalPayment = ParseInt("Введите суму оплаты за аренду общинного дома");

            var newOperation = new CashBox {
                CommunityHouseRental = communityHouseRentalPayment, CurrentDate = DateTime.Now
            };

            using (var db = new CashBoxDatabase())
            {
                db.CashBoxOperations.Add(newOperation);
                db.SaveChanges();

                var communityHouseRentalPaymentSum = db.CashBoxOperations.Sum(p => p.CommunityHouseRental);
                RentalPaymentsReport(communityHouseRentalPaymentSum, totalRentalDebtSum, "общинного дома");
            }
            return(cashBox.CommunityHouseRental);
        }
Beispiel #4
0
 /// <summary>
 /// общая текущая сумма в казне
 /// </summary>
 /// <param name="monthPaymentOperations">месячные клубные взносы</param>
 /// <param name="cashBox">операции по кассе</param>
 /// <param name="cashBoxPaymentsOperation">операции с БД по кассе</param>
 public void TotalSumInCashBox(BerserkMembersMonthPaymentOperations monthPaymentOperations, CashBox cashBox, CashBoxPaymentsOperation cashBoxPaymentsOperation)
 {
     using (var db = new CashBoxDatabase())
     {
         var monthDifference = cashBoxPaymentsOperation.MonthDifference(DateTime.Now);
         if (monthDifference > 0)
         {
             var previousMonthCashBoxSum = PreviousMonthCashBoxSum(monthPaymentOperations, cashBox.BaseCashBoxSum);
             CurrentMonthCashBoxSum(monthPaymentOperations, previousMonthCashBoxSum);
         }
         else
         {
             CurrentMonthCashBoxSum(monthPaymentOperations, cashBox.BaseCashBoxSum);
         }
     }
 }
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            var cashBox = new CashBox()
            {
                BaseCashBoxSum = 2500
            };
            var cashBoxReport             = new CashBoxReport();
            var cashBoxPaymentsOperation  = new CashBoxPaymentsOperation();
            var berserkMembersMonthReport = new BerserkMembersMonthReport();
            var berserkMembers            = new List <BerserkMembers>();

            var monthPaymentOperations   = new BerserkMembersMonthPaymentOperations();
            var add_RemoveBerserksMember = new Add_RemoveBerserkMembers();

            #region Инициализация объектами
            berserkMembers.Add(new BerserkMembers {
                BerserksName = "Ragnar", StartDebt = 250, CurrentDate = DateTime.Now, StartDate = DateTime.Now
            });
            berserkMembers.Add(new BerserkMembers {
                BerserksName = "Ottar", StartDebt = 250, CurrentDate = DateTime.Now, StartDate = DateTime.Now
            });
            berserkMembers.Add(new BerserkMembers {
                BerserksName = "Torbiorn", StartDebt = 250, CurrentDate = DateTime.Now, StartDate = DateTime.Now
            });
            berserkMembers.Add(new BerserkMembers {
                BerserksName = "Eivar", StartDebt = 150, CurrentDate = DateTime.Now, StartDate = DateTime.Now
            });
            using (var db = new BerserkMembersDatabase())
            {
                if (db.BerserkMembers.Count() == 0)
                {
                    db.BerserkMembers.AddRange(berserkMembers);
                    db.SaveChanges();
                }
            }
            #endregion

            bool flag = true;
            while (flag)
            {
                ConsoleColor color = Console.ForegroundColor;
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine("1.Ежемесячный взнос  \t 2. Оплата мастерской  \t 3. Оплата общинного дома");
                Console.WriteLine("4. Другие расходы \t 5. Другие доходы \t 6. Баланс по людям");
                Console.WriteLine("7. Баланс по кассе \t 8. Добавить/удалить члена клуба \t 9. Выйти из программы");
                Console.WriteLine("--------------------------------");
                Console.WriteLine("Введите номер пункта:");
                Console.ForegroundColor = color;
                try
                {
                    int number = Convert.ToInt32(Console.ReadLine());

                    switch (number)
                    {
                    case 1:
                        monthPaymentOperations.GetMonthPayment(berserkMembers);
                        berserkMembersMonthReport.MembersPaymentsMonthReport(berserkMembers);
                        break;

                    case 2:
                        cashBoxPaymentsOperation.WorkshopRentalPayment(cashBox);
                        break;

                    case 3:
                        cashBoxPaymentsOperation.CommunityHouseRentalPayment(cashBox);
                        break;

                    case 4:
                        cashBoxPaymentsOperation.GetOtherExpenses(cashBox);
                        break;

                    case 5:
                        cashBoxPaymentsOperation.GetOtherIncomes(cashBox);
                        break;

                    case 6:
                        berserkMembersMonthReport.MembersPaymentsMonthReport(berserkMembers);
                        break;

                    case 7:
                        cashBoxReport.TotalSumInCashBox(monthPaymentOperations, cashBox, cashBoxPaymentsOperation);
                        break;

                    case 8:
                        add_RemoveBerserksMember.AddAndRemoveMembers(berserkMembers);
                        break;

                    case 9:
                        flag = false;
                        continue;
                    }
                }
                catch (Exception ex)
                {
                    color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(ex.Message);
                    Console.ForegroundColor = color;
                }
            }
        }