public void SendOrderProducts(OrderViewModel order, string email, FileExtension ext)
        {
            string fileName = Directory.GetCurrentDirectory() + "\\Reports\\" + order.Id + (ext == FileExtension.Word ? ".docx" : ".xlsx");
            string subject  = "Список товаров по заказу №" + order.Id;
            var    products = new List <ProductViewModel>();

            foreach (var product in order.Products)
            {
                products.Add(productLogic.Read(new ProductBindingModel {
                    Id = product.ProductId
                }).FirstOrDefault());
            }

            if (ext == FileExtension.Word)
            {
                SaveToWord.CreateDoc(new OrderProductsInfo
                {
                    FileName = fileName,
                    Title    = subject,
                    Products = products
                });
            }
            else
            {
                SaveToExcel.CreateDoc(new OrderProductsInfo
                {
                    FileName = fileName,
                    Title    = subject,
                    Products = products
                });
            }


            SendMail(email, fileName, subject);
        }
Ejemplo n.º 2
0
 public void SaveToExcelFile(string fileName, List <MaterialViewModel> materials)
 {
     SaveToExcel.CreateDoc(new ExcelProviderInfo
     {
         FileName  = fileName,
         Title     = "Список отгрузок по материалам",
         Shipments = GetMaterialShipments(materials)
     });
 }
 public void SaveToExcelFile(string fileName, List <GarnitureViewModel> garnitures)
 {
     SaveToExcel.CreateDoc(new ExcelCustomerInfo
     {
         FileName = fileName,
         Title    = "Список поставок по гарнитурам",
         Supplys  = GetSupplyGarnitures(garnitures)
     });
 }
Ejemplo n.º 4
0
        public IActionResult ReadOfReportSpisok(ReportViewModel model)//кнопка отчет на странице клиент
        {
            string        filename = model.puth + $"ReportClientpdf{DateTime.Now.Year}-{DateTime.Now.Month}-{DateTime.Now.Day}.";
            List <string> list     = new List <string> {
                "Паспорт", "ФИО", "Номер телефона", "Email"
            };
            var clientsall = _client.Read(null);
            var clients    = _client.Read(new ClientBindingModel {
                Id = 0
            });

            foreach (var client in clientsall)
            {
                var dogovorofclient = _dogovor.Read(new DogovorBindingModel {
                    ClientId = client.Id, AgentId = (int)Program.Agent.Id
                });
                if (dogovorofclient.Count >= 0)
                {
                    clients.Add(client);
                }
            }
            SaveToPdf.CreateDoc(new Info
            {
                FileName = filename + "pdf",
                Colon    = list,
                Title    = $" Список клиентов для Агента{Program.Agent.Name}",
                Clients  = clients
            });
            Mail.SendMail(model.SendMail, $"{filename}pdf", $"Список клиентов для Агента{Program.Agent.Name}");
            SaveToExcel.CreateDoc(new Info {
                FileName = filename + "xlsx",
                Colon    = list,
                Title    = $" Список клиентов для Агента{Program.Agent.Name}",
                Clients  = clients
            }


                                  );

            Mail.SendMail(model.SendMail, $"{filename}xlsx", $"Список клиентов для Агента{Program.Agent.Name} за {DateTime.Now}");

            return(RedirectToAction("Client"));
        }