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);
        }
예제 #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)
     });
 }
예제 #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"));
        }
예제 #5
0
        private void tsbExp_Click(object sender, EventArgs e)
        {
            DataTable table = gcPointValue.DataSource as DataTable;

            string[] title = { "抽检时间", "站点", "机台", "参数", "序号", "值" };
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                //获得文件路径
                string strinlocalFilePath = saveFileDialog1.FileName.ToString();

                //获取文件名,不带路径
                string fileNameExt = strinlocalFilePath.Substring(strinlocalFilePath.LastIndexOf("\\") + 1);
                //获取文件路径,不带文件名
                string FilePath    = strinlocalFilePath.Substring(0, strinlocalFilePath.LastIndexOf("\\"));
                string newFileName = fileNameExt + DateTime.Now.ToString("yyyyMMdd");

                SaveToExcel.SaveExcel(table, newFileName, FilePath, "抽检点数据", title);
            }
            else
            {
                //这里放对取消的处理
            }
        }
예제 #6
0
        private void btnSaveProducts_Click(object sender, EventArgs e)
        {
            SaveToExcel se = new SaveToExcel();

            se.ExportToExcel(dgvReportProductYear);
        }