Отчёты отсылаются.
This commit is contained in:
parent
3cc984e5da
commit
81ce6109a2
@ -131,6 +131,19 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
Debiting = GetDebitings(model)
|
||||
}, OfficeOperationEnum.Для_кассира);
|
||||
|
||||
byte[] word = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по зявкам на снятие.docx");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = word,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.WORD
|
||||
});
|
||||
}
|
||||
|
||||
//Сохранение заготовок с указаеним изделий в файл-Excel
|
||||
@ -144,6 +157,19 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
Debiting = GetDebitings(model)
|
||||
}, OfficeOperationEnum.Для_кассира);
|
||||
|
||||
byte[] excel = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по зявкам на снятие.xlsx");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = excel,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.EXCEL
|
||||
});
|
||||
}
|
||||
|
||||
//Сохранение заказов в файл-Pdf
|
||||
@ -173,7 +199,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = pdf,
|
||||
Role = model.Role
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.PDF
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
|
@ -151,7 +151,9 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
public void SaveToExcelFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
if(operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
byte[] excel = Array.Empty<byte>();
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
@ -159,6 +161,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по переводам.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
@ -169,6 +173,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по пополнениям.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
@ -179,11 +185,25 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по снятиям денежных средств",
|
||||
Debiting = GetExcelDebiting(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по снятиям.xlsx");
|
||||
}
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по картам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToShortTimeString}",
|
||||
File = excel,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.EXCEL
|
||||
});
|
||||
}
|
||||
|
||||
public void SaveToWordFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
byte[] word = Array.Empty<byte>();
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
@ -192,6 +212,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по переводам.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
@ -202,6 +224,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по пополнениям.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
@ -212,7 +236,19 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по снятиям денежных средств",
|
||||
Debiting = GetExcelDebiting(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт по снятиям.docx");
|
||||
}
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по картам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToShortTimeString}",
|
||||
File = word,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.WORD
|
||||
});
|
||||
}
|
||||
|
||||
//отчёт в формате PDF для клиента
|
||||
@ -240,8 +276,9 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = pdf,
|
||||
Role = model.Role
|
||||
});
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.PDF
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportClientViewModelForHTML
|
||||
|
@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
||||
using MailKit.Net.Pop3;
|
||||
using MailKit.Security;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.MailWorker
|
||||
{
|
||||
@ -58,12 +59,38 @@ namespace BankYouBankruptBusinessLogic.MailWorker
|
||||
|
||||
if(info.Role == MailsEnum.Клиент)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_по_картам.pdf", "application/pdf"));
|
||||
}
|
||||
if(info.TypeDoc == TypeDocEnum.PDF)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.pdf", "application/pdf"));
|
||||
}
|
||||
|
||||
if (info.TypeDoc == TypeDocEnum.EXCEL)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.xlsx", "application/xlsx"));
|
||||
}
|
||||
|
||||
if (info.TypeDoc == TypeDocEnum.WORD)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.docx", "application/docx"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_по_счетам.pdf", "application/pdf"));
|
||||
}
|
||||
if (info.TypeDoc == TypeDocEnum.PDF)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_кассира.pdf", "application/pdf"));
|
||||
}
|
||||
|
||||
if (info.TypeDoc == TypeDocEnum.EXCEL)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_кассира.xlsx", "application/xlsx"));
|
||||
}
|
||||
|
||||
if (info.TypeDoc == TypeDocEnum.WORD)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_кассира.docx", "application/docx"));
|
||||
}
|
||||
}
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
|
@ -506,7 +506,8 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
APICashier.PostRequest("api/Report/CreateExcelCashier", new ReportSupportBindingModel()
|
||||
{
|
||||
AccountId = int.Parse(accountId)
|
||||
AccountId = int.Parse(accountId),
|
||||
Email = APICashier.Cashier.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -523,7 +524,8 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
APICashier.PostRequest("api/Report/CreateWordCashier", new ReportSupportBindingModel()
|
||||
{
|
||||
AccountId = int.Parse(accountId)
|
||||
AccountId = int.Parse(accountId),
|
||||
Email = APICashier.Cashier.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
|
@ -337,7 +337,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelClient", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -354,7 +355,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelCrediting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -371,7 +373,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelDebiting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -392,7 +395,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordClient", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -409,7 +413,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordCrediting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
@ -426,7 +431,8 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordDebiting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
|
@ -20,5 +20,7 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
public byte[] File { get; set; } = Array.Empty<byte>();
|
||||
|
||||
public MailsEnum Role { get; set; }
|
||||
|
||||
public TypeDocEnum TypeDoc { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptDataModels.Enums
|
||||
{
|
||||
public enum TypeDocEnum
|
||||
{
|
||||
PDF = 0,
|
||||
|
||||
EXCEL = 1,
|
||||
|
||||
WORD = 2
|
||||
}
|
||||
}
|
@ -99,7 +99,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по переводам.xlsx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Между_cчетами);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -118,7 +119,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по пополнениям.xlsx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Пополнение_карт);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -137,7 +139,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по снятиям.xlsx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Cнятие_с_карты);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -156,7 +159,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportCashierLogic.SaveAccountsToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по зявкам на снятие.xlsx",
|
||||
AccountId = model.AccountId
|
||||
AccountId = model.AccountId,
|
||||
Email = model.Email
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -179,7 +183,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по переводам.docx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Между_cчетами);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -198,7 +203,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по пополнениям.docx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Пополнение_карт);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -217,7 +223,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по снятиям.docx",
|
||||
CardList = model.CardList
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Cнятие_с_карты);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -236,7 +243,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportCashierLogic.SaveAccountsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по зявкам на снятие.docx",
|
||||
AccountId = model.AccountId
|
||||
AccountId = model.AccountId,
|
||||
Email = model.Email
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user