Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
17e83effce
@ -131,6 +131,20 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
Debiting = GetDebitings(model)
|
||||
}, OfficeOperationEnum.Для_кассира);
|
||||
|
||||
byte[] word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по зявкам на снятие.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по зявкам на снятие.docx");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToString()}",
|
||||
File = word,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.WORD
|
||||
});
|
||||
}
|
||||
|
||||
//Сохранение заготовок с указаеним изделий в файл-Excel
|
||||
@ -144,6 +158,20 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
Debiting = GetDebitings(model)
|
||||
}, OfficeOperationEnum.Для_кассира);
|
||||
|
||||
byte[] excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по зявкам на снятие.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по зявкам на снятие.xlsx");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToString()}",
|
||||
File = excel,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.EXCEL
|
||||
});
|
||||
}
|
||||
|
||||
//Сохранение заказов в файл-Pdf
|
||||
@ -164,16 +192,19 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
ReportCashWithdrawal = listCashWithdrawals
|
||||
});
|
||||
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт_по_счетам.pdf");
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт_по_счетам.pdf");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт_по_счетам.pdf");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
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,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по переводам.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по переводам.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
@ -169,6 +175,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по пополнениям.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по пополнениям.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
@ -179,11 +189,27 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по снятиям денежных средств",
|
||||
Debiting = GetExcelDebiting(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по снятиям.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по снятиям.xlsx");
|
||||
}
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по картам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToString()}",
|
||||
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 +218,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по переводам.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по переводам.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
@ -202,6 +232,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по пополнениям.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по пополнениям.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
@ -212,7 +246,21 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Title = "Отчёт по снятиям денежных средств",
|
||||
Debiting = GetExcelDebiting(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по снятиям.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по снятиям.docx");
|
||||
}
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по картам",
|
||||
Text = $"Отчёт по состоянию на {DateTime.Now.ToString()}",
|
||||
File = word,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.WORD
|
||||
});
|
||||
}
|
||||
|
||||
//отчёт в формате PDF для клиента
|
||||
@ -231,7 +279,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
ReportDebiting = listDebitings
|
||||
});
|
||||
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("C:\\Users\\Programmist73\\Desktop\\Практика\\2-й курс\\4-й семестр\\CourseWork_BankYouBankrupt\\BankYouBankrupt\\BankYouBankruptRestAPI\\Отчёт_по_картам.pdf");
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт_по_картам.pdf");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
@ -240,11 +288,14 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = pdf,
|
||||
Role = model.Role
|
||||
});
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.PDF
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportClientViewModelForHTML
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт_по_картам.pdf");
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportClientViewModelForHTML
|
||||
{
|
||||
ReportCrediting = listCreditings,
|
||||
|
||||
|
@ -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("ReportSuccess");
|
||||
@ -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("ReportSuccess");
|
||||
|
@ -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("ReportSuccess");
|
||||
@ -357,7 +358,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("ReportSuccess");
|
||||
@ -374,7 +376,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("ReportSuccess");
|
||||
@ -395,7 +398,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("ReportSuccess");
|
||||
@ -412,7 +416,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("ReportSuccess");
|
||||
@ -429,7 +434,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("ReportSuccess");
|
||||
|
@ -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…
Reference in New Issue
Block a user