Exemplo n.º 1
0
 public List <EmployeeViewModel> Read(EmployeeBindingModel model)
 {
     if (model.Id.HasValue)
     {
         return(new List <EmployeeViewModel> {
             _employeeStorage.GetElement(model)
         });
     }
     return(_employeeStorage.GetFullList());
 }
Exemplo n.º 2
0
 public List <EmployeeVM> Read(EmployeeBM model)
 {
     if (model == null)
     {
         return(_employeeStorage.GetFullList());
     }
     if (model.Id.HasValue)
     {
         return(new List <EmployeeVM> {
             _employeeStorage.GetElement(model)
         });
     }
     return(_employeeStorage.GetFilteredList(model));
 }
 private void buttonToPdf_Click(object sender, RoutedEventArgs e)
 {
     if (datePickerFrom.SelectedDate >= datePickerTo.SelectedDate)
     {
         MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     try
     {
         logic.SaveCosmeticsToPdfFile(new ReportBindingModelEmployee
         {
             FileName   = "D:\\Otchet.pdf",
             DateFrom   = datePickerFrom.SelectedDate,
             DateTo     = datePickerTo.SelectedDate,
             EmployeeId = id
         });
         MailLogic.MailSendAsync(new MailSendInfo
         {
             MailAddress = _employeeStorage.GetElement(new EmployeeBindingModel {
                 Id = id
             })?.EMail,
             Subject = $"Отчет",
             Text    = "Отчет по косметике за период c " + datePickerFrom.SelectedDate.Value.ToShortDateString() +
                       " по " + datePickerTo.SelectedDate.Value.ToShortDateString(),
             File = "D:\\Otchet.pdf"
         });
         MessageBox.Show("Сообщение отправлено", "Успех", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Получение списка косметики за определенный период
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <ReportCosmeticsViewModel> GetCosmetics(ReportBindingModel model)
        {
            var listReceipts = _receiptStorage.GetFilteredList(new ReceiptBindingModel {
                DateFrom = model.DateFrom, DateTo = model.DateTo
            });
            var listAll = new List <ReportCosmeticsViewModel>();

            foreach (var receipt in listReceipts)
            {
                foreach (var rc in receipt.ReceiptCosmetics)
                {
                    var employee = _employeeStorage.GetElement(new EmployeeBindingModel {
                        Id = receipt.EmployeeId
                    });
                    listAll.Add(new ReportCosmeticsViewModel
                    {
                        TypeOfService = "Чек",
                        DateOfService = receipt.PurchaseDate,
                        CosmeticName  = rc.Value.Item1,
                        Count         = rc.Value.Item2,
                        EmployeeName  = employee.F_Name + " " + employee.L_Name
                    });
                }
            }
            var listDistributions = _distributionStorage.GetFilteredList(new DistributionBindingModel {
                DateFrom = model.DateFrom, DateTo = model.DateTo
            });

            foreach (var distribution in listDistributions)
            {
                foreach (var dc in distribution.DistributionCosmetics)
                {
                    var employee = _employeeStorage.GetElement(new EmployeeBindingModel {
                        Id = distribution.EmployeeId
                    });
                    listAll.Add(new ReportCosmeticsViewModel
                    {
                        TypeOfService = "Выдача",
                        DateOfService = distribution.IssueDate,
                        CosmeticName  = dc.Value.Item1,
                        Count         = dc.Value.Item2,
                        EmployeeName  = employee.F_Name + " " + employee.L_Name
                    });
                }
            }
            return(listAll);
        }
Exemplo n.º 5
0
        public IActionResult Update(int id)
        {
            var model = _storage.GetElement(id);

            return(View(model));
        }