Merge branch 'main' of http://student.git.athene.tech/shadowik/CourseWork_BankYouBankrupt
This commit is contained in:
commit
8478717df1
@ -149,7 +149,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
Dictionary<(int, int), int> cashWithdrawals = _cashWithdrawalLogic.ReadList(new CashWithdrawalSearchModel()
|
||||
{
|
||||
AccountId = AccountId,
|
||||
}).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
||||
}).Where(x => x.DebitingStatus == StatusEnum.Закрыта ).GroupBy(x => new { x.DateOperation.Month, x.DateOperation.Year })
|
||||
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
||||
|
||||
Dictionary<(int, int), int> moneyTransfers = _moneyTransferLogic.ReadList(new MoneyTransferSearchModel()
|
||||
@ -168,7 +168,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
int sum = 0;
|
||||
|
||||
foreach (var key in cashWithdrawals.Keys.Union(moneyTransfers.Keys).Union(moneyTransfers.Keys))
|
||||
foreach (var key in cashWithdrawals.Keys.Union(moneyTransfers.Keys).Union(moneyTransfers.Keys).OrderBy(x => x.Item1 * 12 + x.Item2))
|
||||
{
|
||||
if (cashWithdrawals.ContainsKey(key)) sum += cashWithdrawals.GetValueOrDefault(key);
|
||||
if (moneyTransfers.ContainsKey(key)) sum += moneyTransfers.GetValueOrDefault(key);
|
||||
@ -198,8 +198,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
throw new ArgumentNullException("Отсутствие номера у счёта", nameof(model.AccountNumber));
|
||||
}
|
||||
|
||||
//проверка на наличие id владельца
|
||||
if (model.CashierId < 0)
|
||||
//проверка на наличие id владельца
|
||||
if (model.CashierId < 0)
|
||||
{
|
||||
throw new ArgumentNullException("Некорректный Id владельца счёта", nameof(model.CashierId));
|
||||
}
|
||||
@ -211,11 +211,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
}
|
||||
|
||||
//проверка на наличие пароля счёта
|
||||
if (string.IsNullOrEmpty(model.PasswordAccount))
|
||||
if (string.IsNullOrEmpty(model.PasswordAccount) )
|
||||
{
|
||||
throw new ArgumentNullException("Некорректный пароль счёта", nameof(model.PasswordAccount));
|
||||
}
|
||||
|
||||
if (model.Balance < 0) {
|
||||
throw new ArgumentNullException("Изначальный баланс аккаунта не может быть < 0", nameof(model.Balance));
|
||||
}
|
||||
|
||||
//проверка на корректную дату открытия счёта
|
||||
if (model.DateOpen > DateTime.Now)
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
.Select(x => new { x.Key.Month, x.Key.Year, Sum = x.Select(y => y.Sum).Sum() }).ToDictionary(x => (x.Month, x.Year), x => (x.Sum));
|
||||
|
||||
List<ClientDiagramElementsViewModel> result = new();
|
||||
foreach (var key in debitings.Keys.Union(creditings.Keys)) {
|
||||
foreach (var key in debitings.Keys.Union(creditings.Keys).OrderBy(x => x.Item1 * 12 + x.Item2)) {
|
||||
int sum = 0;
|
||||
if (debitings.ContainsKey(key)) sum -= debitings.GetValueOrDefault(key);
|
||||
if (creditings.ContainsKey(key)) sum += creditings.GetValueOrDefault(key);
|
||||
@ -131,13 +131,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Number))
|
||||
if (string.IsNullOrEmpty(model.Number) || model.Number.Length != 16)
|
||||
{
|
||||
throw new ArgumentNullException("Нет номера карты", nameof(model.Number));
|
||||
throw new ArgumentNullException("Неправильный номер карты", nameof(model.Number));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.CVC))
|
||||
if (string.IsNullOrEmpty(model.CVC) || model.CVC.Length != 3)
|
||||
{
|
||||
throw new ArgumentNullException("Нет СVC карты", nameof(model.CVC));
|
||||
throw new ArgumentNullException("Неправильный СVC карты", nameof(model.CVC));
|
||||
}
|
||||
if (model.Period < DateTime.Now)
|
||||
{
|
||||
|
@ -21,7 +21,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
|
||||
private readonly IDebitingStorage _debitingStorage;
|
||||
|
||||
public CashWithdrawalLogic(ILogger<CashWithdrawalLogic> logger, ICashWithdrawalStorage cashWithdrawalStorage, IDebitingStorage debitingStorage)
|
||||
public CashWithdrawalLogic(ILogger<CashWithdrawalLogic> logger, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||
IDebitingStorage debitingStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||
|
@ -9,6 +9,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -16,16 +17,27 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICreditingStorage _creditingStorage;
|
||||
private readonly ICardStorage _cardStorage;
|
||||
|
||||
public CreditingLogic(ILogger<CreditingLogic> logger, ICreditingStorage creditingStorage) {
|
||||
public CreditingLogic(ILogger<CreditingLogic> logger, ICreditingStorage creditingStorage, ICardStorage cardStorage) {
|
||||
_logger = logger;
|
||||
_creditingStorage = creditingStorage;
|
||||
_cardStorage = cardStorage;
|
||||
}
|
||||
|
||||
public bool Create(CreditingBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
|
||||
if (!CheckCardPeriod(model))
|
||||
{
|
||||
model.Status = StatusEnum.Карта_просрочена;
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Status = StatusEnum.Открыта;
|
||||
}
|
||||
|
||||
if (_creditingStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
@ -111,5 +123,23 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
_logger.LogInformation("Crediting. Sum:{Sum}.CardId:{CardId}.Date:{date}.Id:{Id}",
|
||||
model.Sum, model.CardId, model.DateOpen.ToString(), model.Id);
|
||||
}
|
||||
}
|
||||
|
||||
//проверка карты на просроченность
|
||||
bool CheckCardPeriod(CreditingBindingModel model)
|
||||
{
|
||||
var card = _cardStorage.GetElement(new CardSearchModel
|
||||
{
|
||||
Id = model.CardId
|
||||
});
|
||||
|
||||
//если карта просрочена
|
||||
if (card.Period < DateTime.Now)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,27 +9,43 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class DebitingLogic : IDebitingLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IDebitingStorage _debitingStorage;
|
||||
|
||||
public DebitingLogic(ILogger<DebitingLogic> logger, IDebitingStorage debitingStorage) {
|
||||
private readonly ICardStorage _cardStorage;
|
||||
|
||||
public DebitingLogic(ILogger<DebitingLogic> logger, IDebitingStorage debitingStorage, ICardStorage cardStorage) {
|
||||
_logger = logger;
|
||||
_debitingStorage = debitingStorage;
|
||||
_cardStorage = cardStorage;
|
||||
}
|
||||
|
||||
public bool Create(DebitingBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_debitingStorage.Insert(model) == null)
|
||||
|
||||
if (!CheckCardPeriod(model))
|
||||
{
|
||||
model.Status = StatusEnum.Карта_просрочена;
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Status = StatusEnum.Открыта;
|
||||
}
|
||||
|
||||
if (_debitingStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -111,5 +127,22 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
_logger.LogInformation("Debiting. Sum:{Sum}.CardId:{CardId}.DateOpen:{DateOpen}.DateOpen:{DateOpen}.Id:{Id}",
|
||||
model.Sum, model.CardId, model.DateOpen.ToString(), model.DateClose.ToString(), model.Id);
|
||||
}
|
||||
}
|
||||
|
||||
//проверка карты на просроченность
|
||||
bool CheckCardPeriod(DebitingBindingModel model)
|
||||
{
|
||||
var card = _cardStorage.GetElement(new CardSearchModel
|
||||
{
|
||||
Id = model.CardId
|
||||
});
|
||||
|
||||
//если карта просрочена
|
||||
if (card.Period < DateTime.Now)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class MessageInfoLogic : IMessageInfoLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
//private readonly IMessageInfoStorage _messageInfoStorage;
|
||||
|
||||
public MessageInfoLogic(ILogger<MessageInfoLogic> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool Create(MessageInfoBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Update(MessageInfoBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,13 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage;
|
||||
using BankYouBankruptBusinessLogic.MailWorker;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||
using BankYouBankruptContracts.SearchModels;
|
||||
using BankYouBankruptContracts.StoragesContracts;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -16,21 +19,22 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
public class ReportCashierLogic : IReportCashierLogic
|
||||
{
|
||||
private readonly IMoneyTransferStorage _moneyTransferStorage;
|
||||
|
||||
private readonly ICashWithdrawalStorage _cashWithdrawalStorage;
|
||||
|
||||
private readonly IClientStorage _clientStorage;
|
||||
private readonly IDebitingStorage _debitingStorage;
|
||||
private readonly ICardStorage _cardStorage;
|
||||
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
|
||||
private readonly AbstractSaveToWordCashier _saveToWord;
|
||||
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
|
||||
//инициализируем поля класса через контейнер
|
||||
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||
private readonly MailKitWorker _mailKitWorker;
|
||||
|
||||
//инициализируем поля класса через контейнер
|
||||
public ReportCashierLogic(IMoneyTransferStorage moneyTransferStorage, ICashWithdrawalStorage cashWithdrawalStorage,
|
||||
IClientStorage clientStorage, AbstractSaveToExcel saveToExcel,
|
||||
AbstractSaveToWordCashier saveToWord, AbstractSaveToPdf saveToPdf)
|
||||
AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf,
|
||||
IDebitingStorage debitingStorage, ICardStorage cardStorage, MailKitWorker mailKitWorker)
|
||||
{
|
||||
_moneyTransferStorage = moneyTransferStorage;
|
||||
_cashWithdrawalStorage = cashWithdrawalStorage;
|
||||
@ -39,6 +43,10 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
_clientStorage = clientStorage;
|
||||
_debitingStorage = debitingStorage;
|
||||
_cardStorage = cardStorage;
|
||||
|
||||
_mailKitWorker = mailKitWorker;
|
||||
}
|
||||
|
||||
//формирование списка переводов между счетами за период
|
||||
@ -71,6 +79,36 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//формирование списка выдаци наличных со счёта за период
|
||||
public List<DebitingViewModel>? GetDebitings(ReportBindingModel model)
|
||||
{
|
||||
List<int> CardIdList = new();
|
||||
|
||||
var list = _cardStorage.GetFilteredList(new CardSearchModel
|
||||
{
|
||||
AccountId = model.AccountId
|
||||
});
|
||||
|
||||
foreach(var index in list)
|
||||
{
|
||||
CardIdList.Add(index.Id);
|
||||
}
|
||||
|
||||
List<DebitingViewModel> totalList = new();
|
||||
|
||||
foreach(var index in CardIdList)
|
||||
{
|
||||
var result = _debitingStorage.GetFilteredList(new DebitingSearchModel
|
||||
{
|
||||
CardId = index
|
||||
});
|
||||
|
||||
totalList.AddRange(result);
|
||||
}
|
||||
|
||||
return totalList;
|
||||
}
|
||||
|
||||
//формирование полного имени клиента для отчёта
|
||||
public string GetFullName(ReportBindingModel model)
|
||||
{
|
||||
@ -82,16 +120,58 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
return client.Surname + " " + client.Name + " " + client.Patronymic;
|
||||
}
|
||||
|
||||
//Сохранение мороженных в файл-Word
|
||||
public void SaveAccountsToWordFile(ReportBindingModel model)
|
||||
//Сохранение мороженных в файл-Word
|
||||
public void SaveAccountsToWordFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
|
||||
Title = "Заявки на снятия со счёта",
|
||||
|
||||
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
|
||||
public void SaveAccountsToExcelFile(ReportBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
|
||||
Title = "Заявки на счёт",
|
||||
|
||||
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
|
||||
@ -105,15 +185,30 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
ForClient = false,
|
||||
FileName = model.FileName,
|
||||
FullClientName = GetFullName(model),
|
||||
Title = "Отчёт по операциям начислений и переводов между счетами",
|
||||
Title = "Отчёт по операциям списаний со счёта и переводов между счетами",
|
||||
DateFrom = model.DateFrom!.Value,
|
||||
DateTo = model.DateTo!.Value,
|
||||
ReportMoneyTransfer = listMoneyTransfers,
|
||||
ReportCashWithdrawal = listCashWithdrawals
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportCashierViewModelForHTML
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт_по_счетам.pdf");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт_по_счетам.pdf");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по счетам",
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = pdf,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.PDF
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportCashierViewModelForHTML
|
||||
{
|
||||
ReportCashWithdrawal = listCashWithdrawals,
|
||||
|
||||
|
@ -11,6 +11,14 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using System.Net.Mail;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using Spire.Pdf.Graphics;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using BankYouBankruptBusinessLogic.MailWorker;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
@ -20,23 +28,30 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
private readonly IDebitingStorage _debitingStorage;
|
||||
private readonly ICardStorage _cardStorage;
|
||||
private readonly IMoneyTransferStorage _moneyTransferStorage;
|
||||
private readonly IClientStorage _clientStorage;
|
||||
|
||||
private readonly AbstractSaveToExcel _saveToExcel;
|
||||
private readonly AbstractSaveToWordClient _saveToWord;
|
||||
private readonly AbstractSaveToWord _saveToWord;
|
||||
private readonly AbstractSaveToPdf _saveToPdf;
|
||||
|
||||
private readonly MailKitWorker _mailKitWorker;
|
||||
|
||||
public ReportClientLogic(ICreditingStorage creditingStorage, IDebitingStorage debitingStorage,
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWordClient saveToWord, AbstractSaveToPdf saveToPdf,
|
||||
ICardStorage cardStorage, IMoneyTransferStorage moneyTransferStorage)
|
||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf,
|
||||
ICardStorage cardStorage, IMoneyTransferStorage moneyTransferStorage,
|
||||
MailKitWorker mailKitWorker, IClientStorage clientStorage)
|
||||
{
|
||||
_creditingStorage = creditingStorage;
|
||||
_debitingStorage = debitingStorage;
|
||||
_cardStorage = cardStorage;
|
||||
_moneyTransferStorage = moneyTransferStorage;
|
||||
_clientStorage = clientStorage;
|
||||
|
||||
_saveToExcel = saveToExcel;
|
||||
_saveToWord = saveToWord;
|
||||
_saveToPdf = saveToPdf;
|
||||
|
||||
_mailKitWorker = mailKitWorker;
|
||||
}
|
||||
|
||||
public List<ReportClientViewModel>? GetCrediting(ReportBindingModel model)
|
||||
@ -69,6 +84,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
//для excel отчёта по переводам между счетов
|
||||
public List<MoneyTransferViewModel>? GetMoneyTransfer(ReportBindingModel model)
|
||||
{
|
||||
//список счетов по выбранным картам
|
||||
@ -91,26 +107,161 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
AccountPayeeId = index
|
||||
}).OrderBy(x => x.AccountSenderId).ToList();
|
||||
|
||||
totalList.Union(result);
|
||||
totalList.AddRange(result);
|
||||
}
|
||||
|
||||
return totalList;
|
||||
}
|
||||
|
||||
public void SaveToExcelFile(ReportBindingModel model)
|
||||
//для excel отчёта по пополнениям карты
|
||||
public List<CreditingViewModel> GetExcelCrediting(ReportBindingModel model)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
List<CreditingViewModel> totalList = new();
|
||||
|
||||
foreach (var index in model.CardList)
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Список переводов денег",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
var result = _creditingStorage.GetFilteredList(new CreditingSearchModel
|
||||
{
|
||||
CardId = index
|
||||
});
|
||||
|
||||
totalList.AddRange(result);
|
||||
}
|
||||
|
||||
return totalList;
|
||||
}
|
||||
|
||||
//для excel отчёта по снятиям с карты
|
||||
public List<DebitingViewModel> GetExcelDebiting(ReportBindingModel model)
|
||||
{
|
||||
List<DebitingViewModel> totalList = new();
|
||||
|
||||
foreach (var index in model.CardList)
|
||||
{
|
||||
var result = _debitingStorage.GetFilteredList(new DebitingSearchModel
|
||||
{
|
||||
CardId = index
|
||||
});
|
||||
|
||||
totalList.AddRange(result);
|
||||
}
|
||||
|
||||
return totalList;
|
||||
}
|
||||
|
||||
public void SaveToExcelFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
byte[] excel = Array.Empty<byte>();
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по переводам.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по переводам.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
excel = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по пополнениям.xlsx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по пополнениям.xlsx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
{
|
||||
_saveToExcel.CreateReport(new ExcelInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
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)
|
||||
public void SaveToWordFile(ReportBindingModel model, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
byte[] word = Array.Empty<byte>();
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по переводам",
|
||||
MoneyTransfer = GetMoneyTransfer(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по переводам.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по переводам.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
Title = "Отчёт по пополнениям (переводам из налички на карту)",
|
||||
Crediting = GetExcelCrediting(model)
|
||||
}, operationEnum);
|
||||
|
||||
word = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт по пополнениям.docx");
|
||||
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт по пополнениям.docx");
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
{
|
||||
_saveToWord.CreateDoc(new WordInfo
|
||||
{
|
||||
FileName = model.FileName,
|
||||
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 для клиента
|
||||
public ReportClientViewModelForHTML SaveClientReportToPdfFile(ReportBindingModel model)
|
||||
@ -126,10 +277,25 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
DateTo = model.DateTo!.Value,
|
||||
ReportCrediting = listCreditings,
|
||||
ReportDebiting = listDebitings
|
||||
});
|
||||
|
||||
byte[] pdf = System.IO.File.ReadAllBytes("../BankYouBankruptRestAPI/Отчёт_по_картам.pdf");
|
||||
|
||||
_mailKitWorker.SendMailAsync(new()
|
||||
{
|
||||
MailAddress = model.Email,
|
||||
Subject = "Отчёт по картам",
|
||||
Text = $"За период с {model.DateFrom} " +
|
||||
$"по {model.DateTo}.",
|
||||
File = pdf,
|
||||
Role = model.Role,
|
||||
TypeDoc = TypeDocEnum.PDF
|
||||
});
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportClientViewModelForHTML
|
||||
File.Delete("../BankYouBankruptRestAPI/Отчёт_по_картам.pdf");
|
||||
|
||||
//возврат полученных списков для отображения на вебе
|
||||
return new ReportClientViewModelForHTML
|
||||
{
|
||||
ReportCrediting = listCreditings,
|
||||
|
||||
|
@ -1,107 +0,0 @@
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.MailWorker
|
||||
{
|
||||
public abstract class AbstractMailWorker
|
||||
{
|
||||
protected string _mailLogin = string.Empty;
|
||||
|
||||
protected string _mailPassword = string.Empty;
|
||||
|
||||
protected string _smtpClientHost = string.Empty;
|
||||
|
||||
protected int _smtpClientPort;
|
||||
|
||||
protected string _popHost = string.Empty;
|
||||
|
||||
protected int _popPort;
|
||||
|
||||
private readonly IMessageInfoLogic _messageInfoLogic;
|
||||
|
||||
private readonly IClientLogic _clientLogic;
|
||||
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public AbstractMailWorker(ILogger<AbstractMailWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
_messageInfoLogic = messageInfoLogic;
|
||||
_clientLogic = clientLogic;
|
||||
}
|
||||
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
{
|
||||
_mailLogin = config.MailLogin;
|
||||
_mailPassword = config.MailPassword;
|
||||
_smtpClientHost = config.SmtpClientHost;
|
||||
_smtpClientPort = config.SmtpClientPort;
|
||||
_popHost = config.PopHost;
|
||||
_popPort = config.PopPort;
|
||||
|
||||
_logger.LogDebug("Config: {login}, {password}, {clientHost}, {clientPOrt}, { popHost}, { popPort}",
|
||||
_mailLogin, _mailPassword, _smtpClientHost, _smtpClientPort, _popHost, _popPort);
|
||||
}
|
||||
|
||||
public async void MailSendAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_smtpClientHost) || _smtpClientPort == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.MailAddress) || string.IsNullOrEmpty(info.Subject) || string.IsNullOrEmpty(info.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("Send Mail: {To}, {Subject}", info.MailAddress, info.Subject);
|
||||
|
||||
await SendMailAsync(info);
|
||||
}
|
||||
|
||||
public async void MailCheck()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_mailLogin) || string.IsNullOrEmpty(_mailPassword))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(_popHost) || _popPort == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_messageInfoLogic == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var list = await ReceiveMailAsync();
|
||||
|
||||
_logger.LogDebug("Check Mail: {Count} new mails", list.Count);
|
||||
|
||||
foreach (var mail in list)
|
||||
{
|
||||
mail.ClientId = _clientLogic.ReadElement(new() { Email = mail.SenderName })?.Id;
|
||||
|
||||
_messageInfoLogic.Create(mail);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Task SendMailAsync(MailSendInfoBindingModel info);
|
||||
|
||||
protected abstract Task<List<MessageInfoBindingModel>> ReceiveMailAsync();
|
||||
}
|
||||
}
|
@ -10,82 +10,99 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MailKit.Net.Pop3;
|
||||
using MailKit.Security;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.MailWorker
|
||||
{
|
||||
public class MailKitWorker : AbstractMailWorker
|
||||
//класс, отвечающий за отправку письма
|
||||
public class MailKitWorker
|
||||
{
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger, IMessageInfoLogic messageInfoLogic, IClientLogic clientLogic)
|
||||
: base(logger, messageInfoLogic, clientLogic) { }
|
||||
private string _mailLogin = string.Empty;
|
||||
|
||||
protected override async Task SendMailAsync(MailSendInfoBindingModel info)
|
||||
private string _mailPassword = string.Empty;
|
||||
|
||||
private string _smtpClientHost = string.Empty;
|
||||
|
||||
private int _smtpClientPort;
|
||||
|
||||
private readonly ILogger logger;
|
||||
|
||||
public MailKitWorker(ILogger<MailKitWorker> logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void MailConfig(MailConfigBindingModel config)
|
||||
{
|
||||
_mailLogin = config.MailLogin;
|
||||
_mailPassword = config.MailPassword;
|
||||
_smtpClientHost = config.SmtpClientHost;
|
||||
_smtpClientPort = config.SmtpClientPort;
|
||||
}
|
||||
|
||||
public async void SendMailAsync(MailSendInfoBindingModel info)
|
||||
{
|
||||
using var objMailMessage = new MailMessage();
|
||||
using var objMailMessage = new MailMessage();
|
||||
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
|
||||
|
||||
using var objSmtpClient = new SmtpClient(_smtpClientHost, _smtpClientPort);
|
||||
try
|
||||
{
|
||||
objMailMessage.From = new MailAddress(_mailLogin);
|
||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
||||
objMailMessage.Subject = info.Subject;
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
objMailMessage.From = new MailAddress(_mailLogin);
|
||||
objMailMessage.To.Add(new MailAddress(info.MailAddress));
|
||||
objMailMessage.Subject = info.Subject;
|
||||
objMailMessage.Body = info.Text;
|
||||
objMailMessage.SubjectEncoding = Encoding.UTF8;
|
||||
objMailMessage.BodyEncoding = Encoding.UTF8;
|
||||
MemoryStream ms = new(info.File);
|
||||
|
||||
objSmtpClient.UseDefaultCredentials = false;
|
||||
objSmtpClient.EnableSsl = true;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
||||
if(info.Role == MailsEnum.Клиент)
|
||||
{
|
||||
if(info.TypeDoc == TypeDocEnum.PDF)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.pdf", "application/pdf"));
|
||||
}
|
||||
|
||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task<List<MessageInfoBindingModel>> ReceiveMailAsync()
|
||||
{
|
||||
var list = new List<MessageInfoBindingModel>();
|
||||
|
||||
using var client = new Pop3Client();
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
client.Connect(_popHost, _popPort, SecureSocketOptions.SslOnConnect);
|
||||
|
||||
client.Authenticate(_mailLogin, _mailPassword);
|
||||
|
||||
for (int i = 0; i < client.Count; i++)
|
||||
if (info.TypeDoc == TypeDocEnum.EXCEL)
|
||||
{
|
||||
var message = client.GetMessage(i);
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.xlsx", "application/xlsx"));
|
||||
}
|
||||
|
||||
foreach (var mail in message.From.Mailboxes)
|
||||
{
|
||||
list.Add(new MessageInfoBindingModel
|
||||
{
|
||||
DateDelivery = message.Date.DateTime,
|
||||
MessageId = message.MessageId,
|
||||
SenderName = mail.Address,
|
||||
Subject = message.Subject,
|
||||
Body = message.TextBody
|
||||
});
|
||||
}
|
||||
if (info.TypeDoc == TypeDocEnum.WORD)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_клиента.docx", "application/docx"));
|
||||
}
|
||||
}
|
||||
catch (AuthenticationException)
|
||||
{ }
|
||||
finally
|
||||
{
|
||||
client.Disconnect(true);
|
||||
}
|
||||
});
|
||||
else
|
||||
{
|
||||
if (info.TypeDoc == TypeDocEnum.PDF)
|
||||
{
|
||||
objMailMessage.Attachments.Add(new Attachment(ms, "Отчёт_для_кассира.pdf", "application/pdf"));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
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;
|
||||
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
|
||||
objSmtpClient.Credentials = new NetworkCredential(_mailLogin, _mailPassword);
|
||||
|
||||
await Task.Run(() => objSmtpClient.Send(objMailMessage));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -11,28 +12,51 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
public abstract class AbstractSaveToExcel
|
||||
{
|
||||
//Создание отчета. Описание методов ниже
|
||||
public void CreateReport(ExcelInfo info)
|
||||
public void CreateReport(ExcelInfo info, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
CreateExcel(info);
|
||||
if(operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
CreateMoneyTransferExcel(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
{
|
||||
CreateCreditingExcel(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
{
|
||||
CreateDebitingExcel(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Для_кассира)
|
||||
{
|
||||
CreateCashierExcel(info);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateMoneyTransferExcel(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
//вставляет заголовок
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
//соединяет 3 ячейки для заголовка
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
//номер строчки в докуметне
|
||||
uint rowIndex = 2;
|
||||
uint rowIndex = 2;
|
||||
|
||||
foreach (var mt in info.MoneyTransfer)
|
||||
{
|
||||
@ -41,7 +65,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Перевод №" + mt.Id,
|
||||
Text = "Перевод №" + mt.Id,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
@ -106,13 +130,495 @@ namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//Вставляет слово "Сумма перевода"
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Дата операции: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
//подсчитывает общее кол-во заготовок в изделии
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = mt.DateOperation.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
rowIndex++;
|
||||
|
||||
//Создание excel-файла
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Суммарный объём переводов: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A" + rowIndex.ToString(),
|
||||
CellToName = "B" + rowIndex.ToString()
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = info.MoneyTransfer.Sum(x => x.Sum).ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
private void CreateCreditingExcel(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
//вставляет заголовок
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
//соединяет 3 ячейки для заголовка
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "E2"
|
||||
});
|
||||
|
||||
//номер строчки в докуметне
|
||||
uint rowIndex = 3;
|
||||
|
||||
//string supportNumber = string.Empty;
|
||||
|
||||
foreach (var cr in info.Crediting)
|
||||
{
|
||||
//вставляет номер перевода
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Пополнение №" + cr.Id,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Номер карты: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.CardNumber,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Сумма пополнения: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.Sum.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//формирование списка поступления по каждой карте
|
||||
var dict = new Dictionary<string, int>();
|
||||
|
||||
foreach(var elem in info.Crediting)
|
||||
{
|
||||
if (dict.ContainsKey(elem.CardNumber))
|
||||
{
|
||||
dict[elem.CardNumber] += elem.Sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict[elem.CardNumber] = elem.Sum;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var elem in dict)
|
||||
{
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Сумма пополнения на карту №" + elem.Key + ":",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = elem.Value.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Суммарный объём пополнений: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A" + rowIndex.ToString(),
|
||||
CellToName = "B" + rowIndex.ToString()
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = info.Crediting.Sum(x => x.Sum).ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
private void CreateDebitingExcel(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
//вставляет заголовок
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
//соединяет 3 ячейки для заголовка
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "E2"
|
||||
});
|
||||
|
||||
//номер строчки в докуметне
|
||||
uint rowIndex = 3;
|
||||
|
||||
foreach (var cr in info.Debiting)
|
||||
{
|
||||
//вставляет номер перевода
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Снятие №" + cr.Id,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Номер карты: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.CardNumber,
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Сумма снятия: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.Sum.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//формирование списка поступления по каждой карте
|
||||
var dict = new Dictionary<string, int>();
|
||||
|
||||
foreach (var elem in info.Debiting)
|
||||
{
|
||||
if (dict.ContainsKey(elem.CardNumber))
|
||||
{
|
||||
dict[elem.CardNumber] += elem.Sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict[elem.CardNumber] = elem.Sum;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Сумма снятия с карты №" + elem.Key + ":",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = elem.Value.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Суммарный объём снятий: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A" + rowIndex.ToString(),
|
||||
CellToName = "B" + rowIndex.ToString()
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = info.Debiting.Sum(x => x.Sum).ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
private void CreateCashierExcel(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
//вставляет заголовок
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
//соединяет 3 ячейки для заголовка
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "E2"
|
||||
});
|
||||
|
||||
//номер строчки в докуметне
|
||||
uint rowIndex = 3;
|
||||
|
||||
foreach (var cr in info.Debiting)
|
||||
{
|
||||
//вставляет номер перевода
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Заявка №" + cr.Id,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Сумма заявки: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка суммы заявки
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.Sum.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Статус: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.Status.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
|
||||
//строчка с номером счёта получателя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Дата: ",
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
//вставка номера отправителя
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = cr.DateClose == null ? "В обработке" : cr.DateClose.ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||
});
|
||||
|
||||
rowIndex++;
|
||||
}
|
||||
|
||||
rowIndex++;
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Суммарный объём открытых заявок на снятие: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A" + rowIndex.ToString(),
|
||||
CellToName = "C" + rowIndex.ToString()
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "D",
|
||||
RowIndex = rowIndex,
|
||||
Text = info.Debiting.Where(x => x.Status == StatusEnum.Открыта).Sum(x => x.Sum).ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
rowIndex += 2;
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = "Суммарный объём закртытых заявок на снятие: ",
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A" + rowIndex.ToString(),
|
||||
CellToName = "C" + rowIndex.ToString()
|
||||
});
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "D",
|
||||
RowIndex = rowIndex,
|
||||
Text = info.Debiting.Where(x => x.Status == StatusEnum.Закрыта).Sum(x => x.Sum).ToString(),
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
//Создание excel-файла
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
|
||||
//Добавляем новую ячейку в лист
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
@ -1,51 +0,0 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToExcelCashier
|
||||
{
|
||||
//Создание отчета. Описание методов ниже
|
||||
public void CreateReport(ExcelInfo info)
|
||||
{
|
||||
CreateExcel(info);
|
||||
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = 1,
|
||||
Text = info.Title,
|
||||
StyleInfo = ExcelStyleInfoType.Title
|
||||
});
|
||||
|
||||
MergeCells(new ExcelMergeParameters
|
||||
{
|
||||
CellFromName = "A1",
|
||||
CellToName = "C1"
|
||||
});
|
||||
|
||||
uint rowIndex = 2;
|
||||
|
||||
///TODO
|
||||
|
||||
SaveExcel(info);
|
||||
}
|
||||
|
||||
//Создание excel-файла
|
||||
protected abstract void CreateExcel(ExcelInfo info);
|
||||
|
||||
//Добавляем новую ячейку в лист
|
||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||
|
||||
//Объединение ячеек
|
||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||
|
||||
//Сохранение файла
|
||||
protected abstract void SaveExcel(ExcelInfo info);
|
||||
}
|
||||
}
|
@ -0,0 +1,353 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWord
|
||||
{
|
||||
//метод создания документа
|
||||
public void CreateDoc(WordInfo info, OfficeOperationEnum operationEnum)
|
||||
{
|
||||
if (operationEnum == OfficeOperationEnum.Между_cчетами)
|
||||
{
|
||||
CreateMoneyTransferWord(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Пополнение_карт)
|
||||
{
|
||||
CreateCreditingWord(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Cнятие_с_карты)
|
||||
{
|
||||
CreateDebitingWord(info);
|
||||
}
|
||||
|
||||
if (operationEnum == OfficeOperationEnum.Для_кассира)
|
||||
{
|
||||
CreateCashierWord(info);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateMoneyTransferWord(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var transfer in info.MoneyTransfer)
|
||||
{
|
||||
List<List<(string, WordTextProperties)>> rowList = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
new("Номер счёта отправителя", new WordTextProperties { Bold = true, Size = "20" } ),
|
||||
new("Номер счёта получателя", new WordTextProperties { Bold = true, Size = "20" } ),
|
||||
new("Сумма операции", new WordTextProperties { Bold = true, Size = "20" } ),
|
||||
new("Дата перевода", new WordTextProperties { Bold = true, Size = "20" } )
|
||||
}
|
||||
};
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Перевод №" + transfer.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
List<(string, WordTextProperties)> cellList = new()
|
||||
{
|
||||
new(transfer.AccountSenderNumber, new WordTextProperties { Size = "20" }),
|
||||
new(transfer.AccountPayeeNumber, new WordTextProperties { Size = "20" }),
|
||||
new(transfer.Sum.ToString(), new WordTextProperties { Size = "20"}),
|
||||
new(transfer.DateOperation.ToString(), new WordTextProperties { Size = "20"}),
|
||||
};
|
||||
|
||||
rowList.Add(cellList);
|
||||
|
||||
CreateTable(new WordParagraph
|
||||
{
|
||||
RowTexts = rowList,
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Суммарный объём переводов: " + info.MoneyTransfer.Sum(x => x.Sum).ToString(),
|
||||
new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
private void CreateCreditingWord(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var crediting in info.Crediting)
|
||||
{
|
||||
List<List<(string, WordTextProperties)>> rowList = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
new("Номер карты", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Сумма пополнения", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Дата выполнения", new WordTextProperties { Bold = true, Size = "24" } )
|
||||
}
|
||||
};
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Пополнение №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
List<(string, WordTextProperties)> cellList = new()
|
||||
{
|
||||
new(crediting.CardNumber, new WordTextProperties { Size = "24" }),
|
||||
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
|
||||
new(crediting.DateClose == null ? "В обработке" : crediting.DateClose.ToString(), new WordTextProperties { Size = "24" })
|
||||
};
|
||||
|
||||
rowList.Add(cellList);
|
||||
|
||||
CreateTable(new WordParagraph
|
||||
{
|
||||
RowTexts = rowList,
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//формирование списка поступления по каждой карте
|
||||
var dict = new Dictionary<string, int>();
|
||||
|
||||
foreach (var elem in info.Crediting)
|
||||
{
|
||||
if (dict.ContainsKey(elem.CardNumber))
|
||||
{
|
||||
dict[elem.CardNumber] += elem.Sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict[elem.CardNumber] = elem.Sum;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Суммарное пополнение на карту №" + elem.Key + ": " + elem.Value.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
private void CreateDebitingWord(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var crediting in info.Debiting)
|
||||
{
|
||||
List<List<(string, WordTextProperties)>> rowList = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
new("Номер карты", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Сумма снятия", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Дата выполнения", new WordTextProperties { Bold = true, Size = "24" } )
|
||||
}
|
||||
};
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Снятие №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
List<(string, WordTextProperties)> cellList = new()
|
||||
{
|
||||
new(crediting.CardNumber, new WordTextProperties { Size = "24" }),
|
||||
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
|
||||
new(crediting.DateClose == null ? "В обработке" : crediting.DateClose.ToString(), new WordTextProperties { Size = "24" })
|
||||
};
|
||||
|
||||
rowList.Add(cellList);
|
||||
|
||||
CreateTable(new WordParagraph
|
||||
{
|
||||
RowTexts = rowList,
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//формирование списка поступления по каждой карте
|
||||
var dict = new Dictionary<string, int>();
|
||||
|
||||
foreach (var elem in info.Debiting)
|
||||
{
|
||||
if (dict.ContainsKey(elem.CardNumber))
|
||||
{
|
||||
dict[elem.CardNumber] += elem.Sum;
|
||||
}
|
||||
else
|
||||
{
|
||||
dict[elem.CardNumber] = elem.Sum;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Суммарное снятие с карты №" + elem.Key + ": " + elem.Value.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Both
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
private void CreateCashierWord(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var crediting in info.Debiting)
|
||||
{
|
||||
List<List<(string, WordTextProperties)>> rowList = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
new("Сумма заявки", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Дата открытия", new WordTextProperties { Bold = true, Size = "24" } ),
|
||||
new("Статус", new WordTextProperties { Bold = true, Size = "24" } )
|
||||
}
|
||||
};
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { ("Заявка №" + crediting.Id.ToString(), new WordTextProperties { Bold = true, Size = "24" }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
List<(string, WordTextProperties)> cellList = new()
|
||||
{
|
||||
new(crediting.Sum.ToString(), new WordTextProperties { Size = "24" }),
|
||||
new(crediting.DateOpen.ToString(), new WordTextProperties { Size = "24" }),
|
||||
new(crediting.Status.ToString(), new WordTextProperties { Size = "24" })
|
||||
};
|
||||
|
||||
rowList.Add(cellList);
|
||||
|
||||
CreateTable(new WordParagraph
|
||||
{
|
||||
RowTexts = rowList,
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
// Создание doc-файла
|
||||
protected abstract void CreateWord(WordInfo info);
|
||||
|
||||
// Создание абзаца с текстом
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
|
||||
//Создание таблицы
|
||||
protected abstract void CreateTable(WordParagraph paragraph);
|
||||
|
||||
// Сохранение файла
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWordCashier
|
||||
{
|
||||
//метод создания документа
|
||||
public void CreateDoc(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
//создание ряда абзацев
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
//TODO
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
// Создание doc-файла
|
||||
protected abstract void CreateWord(WordInfo info);
|
||||
|
||||
// Создание абзаца с текстом
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
|
||||
// Сохранение файла
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperEnums;
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage
|
||||
{
|
||||
public abstract class AbstractSaveToWordClient
|
||||
{
|
||||
//метод создания документа
|
||||
public void CreateDoc(WordInfo info)
|
||||
{
|
||||
CreateWord(info);
|
||||
|
||||
//создание ряда абзацев
|
||||
CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
|
||||
//TODO
|
||||
|
||||
SaveWord(info);
|
||||
}
|
||||
|
||||
// Создание doc-файла
|
||||
protected abstract void CreateWord(WordInfo info);
|
||||
|
||||
// Создание абзаца с текстом
|
||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||
|
||||
// Сохранение файла
|
||||
protected abstract void SaveWord(WordInfo info);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,10 +18,12 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
||||
//заголовок
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
//список для отчёта клиента
|
||||
//списки для отчёта клиента
|
||||
public List<MoneyTransferViewModel> MoneyTransfer { get; set; } = new();
|
||||
|
||||
//список для отчёта кассира
|
||||
public List<DebitingViewModel> Debiting { get; set; } = new();
|
||||
public List<CreditingViewModel> Crediting { get; set; } = new();
|
||||
|
||||
//список для отчёта кассира и клиента
|
||||
public List<DebitingViewModel> Debiting { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,7 +15,12 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
//списки для формирования отчёта клиента
|
||||
public List<AccountViewModel> Accounts { get; set; } = new();
|
||||
}
|
||||
//списки для отчёта клиента
|
||||
public List<MoneyTransferViewModel> MoneyTransfer { get; set; } = new();
|
||||
|
||||
public List<CreditingViewModel> Crediting { get; set; } = new();
|
||||
|
||||
//список для отчёта кассира и клиента
|
||||
public List<DebitingViewModel> Debiting { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.HelperModels
|
||||
|
||||
//свойства параграфа, если они есть
|
||||
public WordTextProperties? TextProperties { get; set; }
|
||||
}
|
||||
|
||||
public List<List<(string, WordTextProperties)>> RowTexts { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using DocumentFormat.OpenXml.Wordprocessing;
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
//реализация абстрактного класса сохранения в word
|
||||
public class SaveToWord : AbstractSaveToWordClient
|
||||
public class SaveToWord : AbstractSaveToWord
|
||||
{
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
|
||||
@ -135,8 +135,79 @@ namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
|
||||
//метод сохранения документа
|
||||
protected override void SaveWord(WordInfo info)
|
||||
//метод, отвечающий за создание таблицы
|
||||
protected override void CreateTable(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Table table = new Table();
|
||||
|
||||
var tableProp = new TableProperties();
|
||||
|
||||
tableProp.AppendChild(new TableLayout { Type = TableLayoutValues.Fixed });
|
||||
tableProp.AppendChild(new TableBorders(
|
||||
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 },
|
||||
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Single), Size = 4 }
|
||||
));
|
||||
tableProp.AppendChild(new TableWidth { Type = TableWidthUnitValues.Auto });
|
||||
|
||||
table.AppendChild(tableProp);
|
||||
|
||||
TableGrid tableGrid = new TableGrid();
|
||||
|
||||
for (int j = 0; j < paragraph.RowTexts[0].Count; ++j)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn() { Width = "2500" });
|
||||
}
|
||||
|
||||
table.AppendChild(tableGrid);
|
||||
|
||||
for (int i = 0; i < paragraph.RowTexts.Count; ++i)
|
||||
{
|
||||
TableRow docRow = new TableRow();
|
||||
|
||||
for (int j = 0; j < paragraph.RowTexts[i].Count; ++j)
|
||||
{
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.RowTexts[i][j].Item2));
|
||||
|
||||
var docRun = new Run();
|
||||
|
||||
var properties = new RunProperties();
|
||||
|
||||
properties.AppendChild(new FontSize { Val = paragraph.RowTexts[i][j].Item2.Size });
|
||||
|
||||
if (paragraph.RowTexts[i][j].Item2.Bold)
|
||||
{
|
||||
properties.AppendChild(new Bold());
|
||||
}
|
||||
|
||||
docRun.AppendChild(properties);
|
||||
|
||||
docRun.AppendChild(new Text { Text = paragraph.RowTexts[i][j].Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||
|
||||
docParagraph.AppendChild(docRun);
|
||||
TableCell docCell = new TableCell();
|
||||
docCell.AppendChild(docParagraph);
|
||||
docRow.AppendChild(docCell);
|
||||
}
|
||||
|
||||
table.AppendChild(docRow);
|
||||
}
|
||||
|
||||
_docBody.AppendChild(table);
|
||||
}
|
||||
|
||||
//метод сохранения документа
|
||||
protected override void SaveWord(WordInfo info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
|
@ -1,27 +0,0 @@
|
||||
using BankYouBankruptBusinessLogic.OfficePackage.HelperModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptBusinessLogic.OfficePackage.Implements
|
||||
{
|
||||
public class SaveToWordCashier : AbstractSaveToWordCashier
|
||||
{
|
||||
protected override void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void CreateWord(WordInfo info)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void SaveWord(WordInfo info)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -10,8 +10,10 @@ namespace BankYouBankruptCashierApp
|
||||
{
|
||||
private static readonly HttpClient _client = new();
|
||||
|
||||
//Вью-модели, необходимые для дальнейшего генерирования запросов к апишке
|
||||
public static CashierViewModel? Cashier { get; set; } = null;
|
||||
public static string ErrorMessage = string.Empty;
|
||||
|
||||
//Вью-модели, необходимые для дальнейшего генерирования запросов к апишке
|
||||
public static CashierViewModel? Cashier { get; set; } = null;
|
||||
|
||||
public static CreditingViewModel? Crediting { get; set; } = null;
|
||||
|
||||
@ -28,8 +30,13 @@ namespace BankYouBankruptCashierApp
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
//Get-запрос
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
public static void SetErrorMessage(string error)
|
||||
{
|
||||
ErrorMessage = error;
|
||||
}
|
||||
|
||||
//Get-запрос
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
var response = _client.GetAsync(requestUrl);
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
|
@ -14,4 +14,14 @@
|
||||
<ProjectReference Include="..\BankYouBankruptContracts\BankYouBankruptContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Views\Home\ErrorPage.cshtml">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\css\site1.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,6 +3,7 @@ using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Default;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Diagram;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics;
|
||||
@ -51,7 +52,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
//изменение данных Post-ом
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone, string email)
|
||||
public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
@ -60,7 +61,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name)
|
||||
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic)
|
||||
|| string.IsNullOrEmpty(telephone) || string.IsNullOrEmpty(email))
|
||||
|| string.IsNullOrEmpty(telephone))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль, ФИО и телефон");
|
||||
}
|
||||
@ -82,16 +83,51 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
APICashier.Cashier.Email = login;
|
||||
APICashier.Cashier.Password = password;
|
||||
APICashier.Cashier.Telephone = telephone;
|
||||
APICashier.Cashier.Email = email;
|
||||
|
||||
Response.Redirect("Index");
|
||||
Response.Redirect("Enter");
|
||||
}
|
||||
|
||||
#endregion
|
||||
[HttpGet]
|
||||
public IActionResult Login()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
#region Вывод ошибок
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[HttpPost]
|
||||
public IActionResult Login(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо заполнить оба поля");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.Cashier = APICashier.GetRequest<CashierViewModel>($"api/Cashier/Login?login={login}&password={password}");
|
||||
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Неверный логин или пароль");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return Redirect("Enter");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Logout()
|
||||
{
|
||||
APICashier.Cashier = null;
|
||||
|
||||
return Redirect("Enter");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Вывод ошибок
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel
|
||||
@ -100,6 +136,13 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ErrorPage()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Вход в приложение
|
||||
@ -113,21 +156,25 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
//отсылаем указанные данные на проверку
|
||||
[HttpPost]
|
||||
public void Enter(string login, string password)
|
||||
public IActionResult Enter(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
APICashier.SetErrorMessage("Введите логин и пароль");
|
||||
|
||||
APICashier.Cashier = APICashier.GetRequest<CashierViewModel>($"/api/Cashier/Login?login={login}&password={password}");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
APICashier.Cashier = APICashier.GetRequest<CashierViewModel>($"/api/Cashier/Login?login={login}&password={password}");
|
||||
|
||||
Response.Redirect("Index");
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Неверный логин или пароль");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return Redirect("Index");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -151,7 +198,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
throw new Exception("Введите логин, пароль, ФИО и телефон");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("/api/Cashier/Register", new CashierBindingModel
|
||||
APICashier.PostRequest("/api/Cashier/Register", new CashierBindingModel
|
||||
{
|
||||
Name = name,
|
||||
Surname = surname,
|
||||
@ -192,26 +239,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
//создание заказа Post-запросом
|
||||
[HttpPost]
|
||||
public void CreateAccount(int clientId, string accountNumber, string password, int balance)
|
||||
public IActionResult CreateAccount(int clientId, string accountNumber, string password, int balance)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
if (clientId <= 0)
|
||||
{
|
||||
throw new Exception("Некоректный ID клиента!");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(accountNumber) && accountNumber.Length < 8)
|
||||
{
|
||||
throw new Exception("Некорректный номер счёта");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(password) && password.Length < 6)
|
||||
if (clientId <= 0 || string.IsNullOrEmpty(accountNumber) || string.IsNullOrEmpty(password) || balance < 0)
|
||||
{
|
||||
throw new Exception("Некорректный пароль");
|
||||
APICashier.SetErrorMessage("Проверьте корректность вводимых данных");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("/api/Account/Register", new AccountBindingModel
|
||||
@ -224,7 +265,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
DateOpen = DateTime.Now
|
||||
});
|
||||
|
||||
Response.Redirect("Index");
|
||||
return Redirect("Index");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -237,7 +278,9 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return View(APICashier.GetRequest<List<CreditingViewModel>>($"/api/Account/FindOpenCrediting"));
|
||||
@ -261,21 +304,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
//одобрения заявки на зачисление Post-запросом
|
||||
[HttpPost]
|
||||
public void CloseCrediting(int creditingId, int accountPayeeId)
|
||||
public IActionResult CloseCrediting(int creditingId, int accountPayeeId)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if(creditingId < 0)
|
||||
{
|
||||
throw new Exception("Некорректный номер заявки на зачисление");
|
||||
}
|
||||
|
||||
if (accountPayeeId < 0)
|
||||
if (creditingId <= 0 || accountPayeeId <= 0)
|
||||
{
|
||||
throw new Exception("Некорректный id счёта для зацисления средств");
|
||||
APICashier.SetErrorMessage("Проверьте коректность передавваемых значений");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
//получаем необходимые данные для запроса
|
||||
@ -295,7 +337,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
APICashier.Crediting = null;
|
||||
APICashier.Card = null;
|
||||
|
||||
Response.Redirect("Crediting");
|
||||
return Redirect("Crediting");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -308,9 +350,12 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
|
||||
return View(APICashier.GetRequest<List<DebitingViewModel>>($"/api/Account/FindOpenDebiting"));
|
||||
}
|
||||
|
||||
@ -318,12 +363,15 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult CloseDebiting()
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
ViewBag.Debitings = APICashier.GetRequest<List<DebitingViewModel>>("/api/Account/FindOpenDebiting");
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
|
||||
ViewBag.Debitings = APICashier.GetRequest<List<DebitingViewModel>>("/api/Account/FindOpenDebiting");
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>("/api/Account/GetAllAccounts");
|
||||
|
||||
@ -332,21 +380,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
//одобрения заявки на снятие Post-запросом
|
||||
[HttpPost]
|
||||
public void CloseDebiting(int debitingId, int accountId)
|
||||
public IActionResult CloseDebiting(int debitingId, int accountId)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (debitingId < 0)
|
||||
if (debitingId <= 0 || accountId <= 0)
|
||||
{
|
||||
throw new Exception("Некорректный номер заявки на снятие");
|
||||
}
|
||||
APICashier.SetErrorMessage("Проверьте корректность передаваемых значений");
|
||||
|
||||
if (accountId < 0)
|
||||
{
|
||||
throw new Exception("Некорректный номер заявки на снятие");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
//получаем необходимые данные для запроса
|
||||
@ -365,7 +412,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
APICashier.Debiting = null;
|
||||
APICashier.Card = null;
|
||||
|
||||
Response.Redirect("Debiting");
|
||||
return Redirect("Debiting");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -374,14 +421,16 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
[HttpPost]
|
||||
public string GetAccountNumber(int id)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={id}");
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindDebiting?id={id}");
|
||||
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={id}");
|
||||
|
||||
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindCrediting?id={id}");
|
||||
|
||||
if(APICashier.Debiting == null)
|
||||
{
|
||||
@ -419,21 +468,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void MoneyTransfers(int accountSenderId, int accountPayeeId, int sumMoneyTransfer)
|
||||
public IActionResult MoneyTransfers(int accountSenderId, int accountPayeeId, int sumMoneyTransfer)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (accountSenderId < 0)
|
||||
if (accountPayeeId <= 0 || accountSenderId <= 0 || sumMoneyTransfer <= 0)
|
||||
{
|
||||
throw new Exception("Некорректный id счёта отправителя");
|
||||
}
|
||||
APICashier.SetErrorMessage("Проверьте корректность передаваемых значений");
|
||||
|
||||
if (accountPayeeId < 0)
|
||||
{
|
||||
throw new Exception("Некорректный id счёта получателя");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("/api/Account/CloseCrediting", new MoneyTransferBindingModel
|
||||
@ -444,7 +492,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
AccountSenderId = accountSenderId
|
||||
});
|
||||
|
||||
Response.Redirect("Index");
|
||||
return Redirect("Index");
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -464,15 +512,78 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
return View(new List<ReportCashierAccountsViewModel>());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//создание excel отчёта у касира
|
||||
[HttpPost]
|
||||
public IActionResult CreateCashierExcelReport(string accountId)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(accountId))
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо выбрать счёт для создания отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("api/Report/CreateExcelCashier", new ReportSupportBindingModel()
|
||||
{
|
||||
AccountId = int.Parse(accountId),
|
||||
Email = APICashier.Cashier.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
//создание excel отчёта у касира
|
||||
[HttpPost]
|
||||
public IActionResult CreateCashierWordReport(string accountId)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(accountId))
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо выбрать счёт для создания отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APICashier.PostRequest("api/Report/CreateWordCashier", new ReportSupportBindingModel()
|
||||
{
|
||||
AccountId = int.Parse(accountId),
|
||||
Email = APICashier.Cashier.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult ReportWithAccounts(string accountId)
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>("/api/Account/GetAllAccounts");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(accountId))
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо выбрать счёт для создания отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>("/api/Account/GetAllAccounts");
|
||||
var cashWithdrawals = APICashier.GetRequest<List<CashWithdrawalViewModel>>("api/Account/FindAllCashWithdrawal").Where(x => x.AccountId == int.Parse(accountId))
|
||||
.Select(x => new ReportCashierAccountsViewModel
|
||||
{
|
||||
@ -524,7 +635,16 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (clientId <= 0 || dateFrom == dateTo || dateFrom > dateTo || dateFrom.Year == 0001 || dateTo.Year == 0001)
|
||||
{
|
||||
APICashier.SetErrorMessage("Пожалуйста, установите корректные границы периода для отчёта и выберите счёт");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
//запрашиваем список в формате вспомогательной вьюшки из-за работы select в asp net
|
||||
@ -537,6 +657,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
return View(APICashier.PostRequestReport<ReportCashierViewModelForHTML, ReportSupportBindingModel>("api/Report/CreateCashierReport", new ReportSupportBindingModel()
|
||||
{
|
||||
ClientId = clientId,
|
||||
Email = APICashier.Cashier.Email,
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
}));
|
||||
@ -556,7 +677,6 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>($"api/Account/GetAllAccounts");
|
||||
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -568,7 +688,14 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>($"api/Account/GetAllAccounts");
|
||||
if (accountId <= 0)
|
||||
{
|
||||
APICashier.SetErrorMessage("Для построения диаграммы необходимо выбрать счёт");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>($"api/Account/GetAllAccounts");
|
||||
|
||||
|
||||
return View(new CashierDiagramViewModel()
|
||||
@ -578,6 +705,19 @@ namespace BankYouBankruptCashierApp.Controllers
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ReportSuccess()
|
||||
{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
APICashier.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
<h2 class="display-4">Зачисление</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер запроса на зачисление:</div>
|
||||
<div class="col-8">
|
||||
<select id="creditigId" name="creditingId" class="form-control" asp-items="@(new SelectList( @ViewBag.Creditings, "Id", "Id"))">
|
||||
@ -14,25 +14,22 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Запрашиваемый счёт для зачисления:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="accountNumber" name="accountNumber" readonly />
|
||||
<input type="text" id="accountNumber" class="form-control" name="accountNumber" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер счёта для зачисления:</div>
|
||||
<div class="col-8">
|
||||
<select id="accountPayeeId" name="accountPayeeId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
<select id="accountPayeeId" name="accountPayeeId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))" required>
|
||||
<option disabled selected>Выберите счёт</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Начислить" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" style="width: 100%" value="Начислить" class="btn btn-dark" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<h2 class="display-4">Снятие</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-4">
|
||||
<div class="col-4">Номер запроса на снятие:</div>
|
||||
<div class="col-8">
|
||||
<select id="debitingId" name="debitingId" class="form-control" asp-items="@(new SelectList( @ViewBag.Debitings, "Id", "Id"))">
|
||||
@ -14,25 +14,22 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-4">
|
||||
<div class="col-4">Запрашиваемый счёт для перевода:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="accountNumber" name="accountNumber" readonly />
|
||||
<input type="text" class="form-control" id="accountNumber" name="accountNumber" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-4">
|
||||
<div class="col-4">Номер счёта для снятия:</div>
|
||||
<div class="col-8">
|
||||
<select id="accountId" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
<select id="accountId" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))" required>
|
||||
<option disabled selected>Выберите счёт</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Снять" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<input type="submit" style="width: 100%" value="Снять" class="btn btn-dark" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -6,34 +6,49 @@
|
||||
<h2 class="display-4">Открытие счёта</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Клиент:</div>
|
||||
<div class="col-8">
|
||||
<select id="client" name="clientId" class="form-control" asp-items="@(new SelectList( @ViewBag.Clients, "Id", "FullName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер счёта:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="accountNumber" name="accountNumber" />
|
||||
<input type="text" id="accountNumber" class="form-control" name="accountNumber" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="password" name="password" />
|
||||
<input type="text" id="password" class="form-control" name="password" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Баланс:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="balance" name="balance" />
|
||||
<input type="number" id="balance" class="form-control" name="balance" value=0 required min=0/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создать" class="btn btn-primary" />
|
||||
<input type="submit" value="Создать" class="form-control" class="btn btn-dark" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function createNum(len) {
|
||||
chrs = '0123456789';
|
||||
var str = '';
|
||||
for (var i = 0; i < len; i++) {
|
||||
var pos = Math.floor(Math.random() * chrs.length);
|
||||
str += chrs.substring(pos, pos + 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
document.getElementById("accountNumber").value = createNum(16);
|
||||
document.getElementById("password").value = createNum(4);
|
||||
</script>
|
@ -10,34 +10,33 @@
|
||||
<h2 class="display-4">Отчёт по счетам за выбранный период</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Клиент:</div>
|
||||
<div class="col-8">
|
||||
<select id="clientId" name="clientId" class="form-control" asp-items="@(new SelectList( @ViewBag.Clients, "Id", "FullName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Дата начала периода:</div>
|
||||
<div class="col-8">
|
||||
<input id="dateFrom" name="dateFrom" class="form-control" type="date" />
|
||||
<input id="dateFrom" name="dateFrom" class="form-control" type="date" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Дата конца периода:</div>
|
||||
<div class="col-8">
|
||||
<input id="dateTo" name="dateTo" class="form-control" type="date" />
|
||||
<input id="dateTo" name="dateTo" class="form-control" type="date" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сформировать отчёт" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" style="width:100%" value="Сформировать отчёт" class="btn btn-dark" />
|
||||
</div>
|
||||
<hr class="mt-5 mb-3" />
|
||||
@if (Model != null)
|
||||
{
|
||||
<div class="row p-3 text-center">
|
||||
<h3>Отчет отправлен на почту @APICashier.Cashier.Email</h3>
|
||||
<hr class="mt-5 mb-3" />
|
||||
<h4>Отчёт по выдаче наличных со счёта</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -7,21 +7,18 @@
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Диаграмма по месяцам</h1>
|
||||
<h1 class="display-4">Диаграмма суммарных поступлений на счёт по месяцам</h1>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="row">Номер счета:</div>
|
||||
<select id="accountId" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
<option disabled selected>Выберите счёт</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Выбрать" class="btn btn-primary"/>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input style="width:100%;" type="submit" value="Выбрать" class="btn btn-dark" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -67,7 +64,8 @@
|
||||
datasets: [{
|
||||
label: 'Денег в этом месяце',
|
||||
data: data,
|
||||
borderWidth: 1
|
||||
borderWidth: 1,
|
||||
backgroundColor: 'rgb(33, 37, 41)'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
|
@ -1,27 +1,21 @@
|
||||
@{
|
||||
ViewData["Title"] = "Авторизация";
|
||||
ViewData["Title"] = "Страница кассира";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в приложение</h2>
|
||||
<h1 class="display-4">Страница кассира</h1>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="login" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8">
|
||||
<input type="password" name="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Вход" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
<img src="~/lib/logo.png" style="width: 700px"/>
|
||||
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
<h3 class="display-4">Сначала авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<h3 class="display-4">Здравствуйтe, @APICashier.Cashier.Name @APICashier.Cashier.Patronymic</h3>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,10 @@
|
||||
@using BankYouBankruptCashierApp
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Отправка отчета";
|
||||
}
|
||||
|
||||
<div class="text-center p-5">
|
||||
<h3 class="display-4">Упс, что-то пошло не так...</h3>
|
||||
<h3 class="display-4">Ошибка: @APICashier.ErrorMessage</h3>
|
||||
</div>
|
@ -0,0 +1,14 @@
|
||||
@{
|
||||
ViewData["Title"] = "Авторизация";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Вход в приложение</h2>
|
||||
</div>
|
||||
|
||||
<form class="form-signin text-center" method="post">
|
||||
<h1 class="h3 mb-3 font-weight-normal">Логин</h1>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" required autofocus>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" required>
|
||||
<button class="btn btn-lg btn-dark btn-block" type="submit" asp-controller="Home" asp-action="Login">Войти</button>
|
||||
</form>
|
@ -3,10 +3,10 @@
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Перевод меджу счетами</h2>
|
||||
<h2 class="display-4">Перевод между счетами</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер счёта для снятия:</div>
|
||||
<div class="col-8">
|
||||
<select id="accountSenderId" name="accountSenderId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
@ -14,7 +14,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер счёта для начисления:</div>
|
||||
<div class="col-8">
|
||||
<select id="accountPayeeId" name="accountPayeeId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
@ -22,16 +22,13 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Сумма перевода:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" id="sumMoneyTransfer" name="sumMoneyTransfer" />
|
||||
<input type="number" id="sumMoneyTransfer" class="form-control" name="sumMoneyTransfer" required min=1 value=1/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Перевести" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" style="width: 100%" value="Перевести" class="btn btn-dark" />
|
||||
</div>
|
||||
</form>
|
||||
|
@ -9,29 +9,29 @@
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Личные данные</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<form method="post" class="form-signin">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8"><input type="text" name="login" value=@Html.DisplayFor(modelItem => Model.Email) /></div>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" value=@Html.DisplayFor(modelItem => Model.Email) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8"><input type="password" name="password" value=@Html.DisplayFor(modelItem => Model.Password) /></div>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" value=@Html.DisplayFor(modelItem => Model.Password) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Имя:</div>
|
||||
<div class="col-8"><input type="text" name="name" value=@Html.DisplayFor(modelItem => Model.Name) /></div>
|
||||
<input type="text" id="name" name="name" class="form-control" placeholder="Имя" value=@Html.DisplayFor(modelItem => Model.Name) required>
|
||||
<div class="col-4">Фамилия:</div>
|
||||
<div class="col-8"><input type="text" name="surname" value=@Html.DisplayFor(modelItem => Model.Surname) /></div>
|
||||
<input type="text" id="surname" name="surname" class="form-control" placeholder="Фамилия" value=@Html.DisplayFor(modelItem => Model.Surname) required>
|
||||
<div class="col-4">Отчество:</div>
|
||||
<div class="col-8"><input type="text" name="patronymic" value=@Html.DisplayFor(modelItem => Model.Patronymic) /></div>
|
||||
<input type="text" id="patronymic" name="patronymic" class="form-control" placeholder="Отчество" value=@Html.DisplayFor(modelItem => Model.Patronymic) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Телефон:</div>
|
||||
<div class="col-8"><input type="text" name="telephone" value=@Html.DisplayFor(modelItem => Model.Telephone) /></div>
|
||||
<input type="text" id="telephone" name="telephone" class="form-control" placeholder="Телефон" value=@Html.DisplayFor(modelItem => Model.Telephone) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
|
||||
<div class="row mb-2">
|
||||
<button class="btn btn-lg btn-dark btn-block mb-2" type="submit" asp-controller="Home" asp-action="Privacy">Coхранить</button>
|
||||
<button class="btn btn-lg btn-dark btn-block" type="submit" asp-controller="Home" asp-action="Logout">Выйти из аккаунта</button>
|
||||
</div>
|
||||
</form>
|
@ -5,47 +5,14 @@
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Регистрация</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Почта:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="login" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8">
|
||||
<input type="password" name="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Имя:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Фамилия:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="surname" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Отчество:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="patronymic" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Телефон:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="telephone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Регистрация" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
<form class="form-signin text-center" method="post">
|
||||
<h1 class="h3 mb-3 font-weight-normal">Регистрация</h1>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" required>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" required>
|
||||
<input type="text" id="name" name="name" class="form-control" placeholder="Имя" required>
|
||||
<input type="text" id="surname" name="surname" class="form-control" placeholder="Фамилия" required>
|
||||
<input type="text" id="patronymic" name="patronymic" class="form-control" placeholder="Отчество" required>
|
||||
<input type="text" id="telephone" name="telephone" class="form-control" placeholder="Телефон" required>
|
||||
|
||||
<button class="btn btn-lg btn-dark btn-block" type="submit" asp-controller="Home" asp-action="Register">Регистрация</button>
|
||||
</form>
|
@ -0,0 +1,15 @@
|
||||
@{
|
||||
ViewData["Title"] = "Отправка отчета";
|
||||
}
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
<h3 class="display-4">Сначала авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
}
|
||||
<h3 class="display-4">Отчeт был отправлен на почту @APICashier.Cashier.Email</h3>
|
||||
</div>
|
@ -16,11 +16,17 @@
|
||||
<div class="mb-4 mb-md-0 aos-init aos-animate col-md-3" sf-type="container" sf-label="Column" sf-anim-delay="1.5" data-aos="fade-down" data-aos-delay="400" sf-uid="4">
|
||||
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="5">
|
||||
<form method="post">
|
||||
<select id="accountId" name="accountId" class="form-control" asp-items="@(new SelectList(ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
<select id="accountId" name="accountId" class="form-control mb-2" asp-items="@(new SelectList(ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||
<option disabled selected>Выберите счёт</option>
|
||||
</select>
|
||||
<div>
|
||||
<input class="btn btn-primary mt-3" type="submit" value="Submit" />
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-lg btn-dark btn-block" style="width: 100%;" type="submit" asp-controller="Home" asp-action="ReportWithAccounts">Создать отчёт по аккаунтам</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-lg btn-dark btn-block" style="width: 100%;" type="submit" asp-controller="Home" asp-action="CreateCashierExcelReport">Создать отчёт по заявкам снятия (EXCEL)</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button class="btn btn-lg btn-dark btn-block" style="width: 100%;" type="submit" asp-controller="Home" asp-action="CreateCashierWordReport">Создать отчёт по заявкам снятия (WORD</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -14,60 +14,151 @@
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
background-color: #f1b21c;
|
||||
}
|
||||
|
||||
.nav-main a {
|
||||
position: relative;
|
||||
color: #FFFFFF;
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-main a:after {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0px;
|
||||
width: 0;
|
||||
height: 1px;
|
||||
background-color: #FFFFFF;
|
||||
content: "";
|
||||
transition: width 0.3s ease-out;
|
||||
}
|
||||
|
||||
.nav-main a:hover:after,
|
||||
.nav-main a:focus:after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.nav-main .dropdown:hover .dropdown-menu {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #212529
|
||||
}
|
||||
|
||||
.form-signin {
|
||||
width: 100%;
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
||||
.form-signin .form-control {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-signin .form-control:focus {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.form-signin input[type="email"] {
|
||||
margin-bottom: -1px;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.form-signin input[type="password"] {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
table.table tbody tr td,
|
||||
table.table thead tr th,
|
||||
table.table thead {
|
||||
border-left: solid;
|
||||
border-right: solid;
|
||||
border-width: 4px;
|
||||
border-color: #212529;
|
||||
}
|
||||
|
||||
table {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #212529;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="MyBody">
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">
|
||||
Банк "Вы банкрот"
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
@{
|
||||
if (authenticated)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Счета</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Debiting">Заявки на снятие</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Crediting">Заявки на начисление</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="MoneyTransfers">Переводы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="ReportWithAccounts">Отчёт по аккаунтам</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="CreateReport">Отчёт</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Diagram">Диаграмма</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Privacy">Личный кабинет</a>
|
||||
</li>
|
||||
|
||||
}
|
||||
}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<header class="d-flex flex-wrap align-items-center justify-content-center justify-content-md-between py-3 px-4 mg-5 mb-4 border-bottom bg-dark ">
|
||||
<div class="col-md-3 mb-2 mb-md-0">
|
||||
<a asp-controller="Home" asp-action="Enter" class="d-inline-flex link-body-emphasis text-decoration-none">
|
||||
<span class="fs-4 text-light ">Банк "Вы банкрот"</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<ul class="nav col-12 col-md-auto mb-2 justify-content-center mb-md-0 nav-main">
|
||||
<li>
|
||||
<a class="nav-link px-2 link-light" asparea="" asp-controller="Home" asp-action="Index">Счета</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="nav-link px-2 link-light">Операции</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-action="Debiting">Заявки на снятие</a></li>
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-action="Crediting">Заявки на начисление</a></li>
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="MoneyTransfers">Заявки на перевод</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="nav-link px-2 link-light">Отчеты</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="ReportWithAccounts">Отчёт по аккаунтам</a></li>
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="CreateReport">Отчёт за период</a></li>
|
||||
<li><a class="dropdown-item" asp-controller="Home" asp-controller="Home" asp-action="Diagram">Диаграмма</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@{
|
||||
if (APICashier.Cashier == null)
|
||||
{
|
||||
<div class="col-md-3 text-end">
|
||||
<a class="btn btn-warning me-2" asp-controller="Home" asp-action="Login">Войти</a>
|
||||
<a class="btn btn-warning" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-md-3 text-end">
|
||||
<a class="btn btn-warning me-2" id="exit" name="exit" asp-controller="Home" asp-action="Privacy">@APICashier.Cashier.Surname @APICashier.Cashier.Name</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@ -75,7 +166,7 @@
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<footer class="border-top bg-dark border-dark footer text-light">
|
||||
<div class="container">
|
||||
© 2023 - BankYouBankruptCashierApp
|
||||
</div>
|
||||
|
@ -1,22 +0,0 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.MyBody{
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 19px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
BankYouBankrupt/BankYouBankruptCashierApp/wwwroot/lib/logo.png
Normal file
BIN
BankYouBankrupt/BankYouBankruptCashierApp/wwwroot/lib/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
@ -11,6 +11,8 @@ namespace BankYouBankruptСlientApp
|
||||
|
||||
public static ClientViewModel? Client { get; set; } = null;
|
||||
|
||||
public static string ErrorMessage = string.Empty;
|
||||
|
||||
public static void Connect(IConfiguration configuration)
|
||||
{
|
||||
_client.BaseAddress = new Uri(configuration["IPAddress"]);
|
||||
@ -18,6 +20,11 @@ namespace BankYouBankruptСlientApp
|
||||
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
public static void SetErrorMessage(string error)
|
||||
{
|
||||
ErrorMessage = error;
|
||||
}
|
||||
|
||||
//Get-запрос
|
||||
public static T? GetRequest<T>(string requestUrl)
|
||||
{
|
||||
|
@ -16,4 +16,10 @@
|
||||
<ProjectReference Include="..\BankYouBankruptContracts\BankYouBankruptContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\css\site.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -14,7 +14,6 @@ using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace BankYouBankruptClientApp.Controllers
|
||||
{
|
||||
@ -28,14 +27,13 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
}
|
||||
|
||||
#region Профиль, вход и регистрация
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
@ -51,23 +49,32 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult ErrorPage()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Login(string login, string password)
|
||||
[HttpPost]
|
||||
public IActionResult Login(string login, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.SetErrorMessage("Введите логин и пароль");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.Client = APIClient.GetRequest<ClientViewModel>($"api/Client/Login?login={login}&password={password}");
|
||||
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
}
|
||||
APIClient.SetErrorMessage("Неверный логин или пароль");
|
||||
|
||||
Response.Redirect("Enter");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return Redirect("Enter");
|
||||
}
|
||||
|
||||
|
||||
@ -84,8 +91,10 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name)
|
||||
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic) || string.IsNullOrEmpty(telephone))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль, ФИО и телефон");
|
||||
}
|
||||
APIClient.SetErrorMessage("Проверьте правильность заполнения полей");
|
||||
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Client/Register", new ClientBindingModel
|
||||
{
|
||||
@ -101,6 +110,64 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Logout()
|
||||
{
|
||||
APIClient.Client = null;
|
||||
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
|
||||
return View(APIClient.Client);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Privacy(string login, string password, string name, string surname, string patronymic, string telephone)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(name)
|
||||
|| string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(patronymic)
|
||||
|| string.IsNullOrEmpty(telephone))
|
||||
{
|
||||
APIClient.SetErrorMessage("Проверьте правильность заполнения полей");
|
||||
|
||||
Response.Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("/api/Client/UpdateData", new ClientBindingModel
|
||||
{
|
||||
Id = APIClient.Client.Id,
|
||||
Name = name,
|
||||
Surname = surname,
|
||||
Patronymic = patronymic,
|
||||
Telephone = telephone,
|
||||
Email = login,
|
||||
Password = password
|
||||
});
|
||||
|
||||
APIClient.Client.Name = name;
|
||||
APIClient.Client.Surname = surname;
|
||||
APIClient.Client.Patronymic = patronymic;
|
||||
APIClient.Client.Email = login;
|
||||
APIClient.Client.Password = password;
|
||||
APIClient.Client.Telephone = telephone;
|
||||
|
||||
Response.Redirect("Enter");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Карты
|
||||
@ -127,18 +194,28 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult CreateCard(string accountId, string number, string cvc, string period) {
|
||||
public IActionResult CreateCard(string accountId, string number, string cvc, DateTime period) {
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
APIClient.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if(string.IsNullOrEmpty(accountId) || string.IsNullOrEmpty(number) || string.IsNullOrEmpty(cvc)
|
||||
|| period.Year == 0001 || period <= DateTime.Now)
|
||||
{
|
||||
APIClient.SetErrorMessage("Проверьте корректность параметров создаваемой карты");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Card/CreateCard", new CardBindingModel {
|
||||
ClientID = APIClient.Client.Id,
|
||||
AccountId = int.Parse(accountId),
|
||||
Number = number,
|
||||
CVC = cvc,
|
||||
Period = DateTime.Parse(period)
|
||||
Period = period
|
||||
});
|
||||
|
||||
return Redirect("~/Home/CardsList");
|
||||
@ -176,8 +253,17 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
APIClient.SetErrorMessage("Необходимо авторизоваться");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if(string.IsNullOrEmpty(cardId) || sum <= 0)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо ввести корректную сумму для снятия");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Card/CreateDebitingRequest", new DebitingBindingModel()
|
||||
{
|
||||
@ -225,7 +311,14 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Card/CreateCreditingOperation", new CreditingBindingModel()
|
||||
if (string.IsNullOrEmpty(cardId) || sum <= 0)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо ввести корректную сумму для пополнения");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Card/CreateCreditingOperation", new CreditingBindingModel()
|
||||
{
|
||||
CardId = int.Parse(cardId),
|
||||
Sum = sum,
|
||||
@ -259,34 +352,190 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
throw new Exception("Не авторизованы");
|
||||
}
|
||||
|
||||
//ViewBag.DataOfClientReport = APIClient.GetRequest<ReportClientViewModelForHTML>($"api/Report/GetDataOfClientReport");
|
||||
if (dateFrom == dateTo || dateFrom > dateTo || dateFrom.Year == 0001 || dateTo.Year == 0001)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо задать корректные границы периода");
|
||||
|
||||
return View(APIClient.PostRequestReport<ReportClientViewModelForHTML, ReportSupportBindingModel>("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return View(APIClient.PostRequestReport<ReportClientViewModelForHTML, ReportSupportBindingModel>("api/Report/CreateClientReport", new ReportSupportBindingModel()
|
||||
{
|
||||
DateFrom = dateFrom,
|
||||
DateTo = dateTo
|
||||
DateTo = dateTo,
|
||||
Email = APIClient.Client.Email
|
||||
}));
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Excel отчёт
|
||||
#region Excel отчёты
|
||||
|
||||
//отчёт клиента по переводам
|
||||
[HttpPost]
|
||||
public IActionResult CreateExcelReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelClient", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
//отчёт клиента по пополнениям
|
||||
[HttpPost]
|
||||
public IActionResult CreateCreditingExcelReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelCrediting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
//отчёт клиента по снятиям
|
||||
[HttpPost]
|
||||
public void CreateExcelReport(List<CheckboxViewModel> cards)
|
||||
public IActionResult CreateDebitingExcelReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
throw new Exception("Не авторизованы");
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelClient", new ReportSupportBindingModel()
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList()
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateExcelDebiting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
||||
}
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Word отчёты клиента
|
||||
|
||||
//отчёт клиента по переводам
|
||||
[HttpPost]
|
||||
public IActionResult CreateWordReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordClient", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
//отчёт клиента по пополнениям
|
||||
[HttpPost]
|
||||
public IActionResult CreateCreditingWordReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordCrediting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
//отчёт клиента по снятиям
|
||||
[HttpPost]
|
||||
public IActionResult CreateDebitingWordReport(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
APIClient.PostRequest("api/Report/CreateWordDebiting", new ReportSupportBindingModel()
|
||||
{
|
||||
CardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList(),
|
||||
Email = APIClient.Client.Email
|
||||
});
|
||||
|
||||
return Redirect("ReportSuccess");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -312,12 +561,21 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult ReportWithCards(List<CheckboxViewModel> cards)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
List<int> cardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList();
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
if (cards.Count == 0 || cards.Count == cards.Where(x => x.IsChecked == false).ToList().Count)
|
||||
{
|
||||
APIClient.SetErrorMessage("Необходимо выбрать хотя-бы 1 карту для отчёта");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
List<int> cardList = cards.Where(x => x.IsChecked).Select(x => x.Id).ToList();
|
||||
|
||||
List<ReportViewModel> creditings = APIClient.GetRequest<List<CreditingViewModel>>($"api/Client/getUsersCreditings?userId={APIClient.Client.Id}")
|
||||
.Where(x => cardList.Contains(x.CardId)).Select(x => new ReportViewModel() {
|
||||
@ -352,9 +610,11 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
Operations = result,
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
[HttpGet]
|
||||
#region Диаграмма
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Diagram() {
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
@ -369,18 +629,35 @@ namespace BankYouBankruptClientApp.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult Diagram(int cardId)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
ViewBag.Cards = APIClient.GetRequest<List<CardViewModel>>($"api/Card/GetUsersCardsList?id={APIClient.Client.Id}");
|
||||
|
||||
return View(new ClientDiagramViewModel() {
|
||||
DiagramName = "Hello World",
|
||||
Elements = APIClient.GetRequest<List<ClientDiagramElementsViewModel>>($"api/Card/getCardMonthResult?cardId={cardId}")
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//сообщение об успешной отправке отчёта на почту
|
||||
[HttpGet]
|
||||
public IActionResult ReportSuccess()
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
APIClient.SetErrorMessage("Не авторизованы");
|
||||
|
||||
return Redirect("ErrorPage");
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер счёта
|
||||
Номер карты
|
||||
</th>
|
||||
<th>
|
||||
Баланс
|
||||
</th>
|
||||
<th>
|
||||
CVC
|
||||
@ -41,6 +44,9 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Number)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Sum)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CVC)
|
||||
</td>
|
||||
|
@ -6,34 +6,50 @@
|
||||
<h2 class="display-4">Создание карты</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер счета:</div>
|
||||
<div class="col-8">
|
||||
<select id="accountId" name="accountId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер карты:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="number" />
|
||||
<input type="text" class="form-control" name="number" id="number" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">CVC:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="cvc" />
|
||||
<input type="text" class="form-control" name="cvc" id="cvc" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Срок действия:</div>
|
||||
<div class="col-8">
|
||||
<input type="date" name="period" />
|
||||
<input type="date" class="form-control" name="period" id="period" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создание" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" value="Создание" style="width: 100%" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
function createNum(len) {
|
||||
chrs = '0123456789';
|
||||
var str = '';
|
||||
for (var i = 0; i < len; i++) {
|
||||
var pos = Math.floor(Math.random() * chrs.length);
|
||||
str += chrs.substring(pos, pos + 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
document.getElementById("number").value = createNum(16);
|
||||
document.getElementById("cvc").value = createNum(3);
|
||||
let year = new Date();
|
||||
year.setFullYear(year.getFullYear() + 5)
|
||||
document.getElementById("period").valueAsDate = new Date(year);
|
||||
</script>
|
@ -6,22 +6,19 @@
|
||||
<h2 class="display-4">Создание операции</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Номер счета:</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер карты:</div>
|
||||
<div class="col-8">
|
||||
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Cумма операции:</div>
|
||||
<div class="col-8">
|
||||
<input type="number" name="sum" />
|
||||
<input type="number" class="form-control" name="sum" required autofocus/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создание" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" value="Создание" style="width: 100%" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
@ -6,22 +6,19 @@
|
||||
<h2 class="display-4">Создание операции</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Номер счета:</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Номер карты:</div>
|
||||
<div class="col-8">
|
||||
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Cумма операции:</div>
|
||||
<div class="col-8">
|
||||
<input type="number" name="sum" />
|
||||
<input type="number" name="sum" class="form-control" required autofocus />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создание" class="btn btn-primary" />
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<input type="submit" style="width: 100%" value="Создание" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
@ -14,7 +14,7 @@
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Создание" class="btn btn-primary" />
|
||||
<input type="submit" value="Создание" class="btn btn-warning" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -1,4 +1,5 @@
|
||||
@using BankYouBankruptContracts.ViewModels;
|
||||
@using BankYouBankruptСlientApp
|
||||
|
||||
@model ReportClientViewModelForHTML
|
||||
|
||||
@ -10,28 +11,28 @@
|
||||
<h2 class="display-4">Отчёт по картам за выбранный период</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Дата начала периода:</div>
|
||||
<div class="col-8">
|
||||
<input id="dateFrom" name="dateFrom" class="form-control" type="date" />
|
||||
<input id="dateFrom" name="dateFrom" class="form-control" type="date" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Дата конца периода:</div>
|
||||
<div class="col-8">
|
||||
<input id="dateTo" name="dateTo" class="form-control" type="date" />
|
||||
<input id="dateTo" name="dateTo" class="form-control" type="date" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input id="createReport" type="submit" value="Сформировать отчёт" class="btn btn-primary" />
|
||||
</div>
|
||||
<input id="createReport" style="width:100%;" type="submit" value="Сформировать отчёт" class="btn btn-warning" />
|
||||
</div>
|
||||
|
||||
<hr class="mt-5 mb-3" />
|
||||
@if (Model != null)
|
||||
{
|
||||
<div class="row text-center">
|
||||
<h3>Отчет отправлен на почту @APIClient.Client.Email</h3>
|
||||
<hr class="mt-5 mb-3" />
|
||||
<p>Отчёт по пополнениям</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -1,4 +1,5 @@
|
||||
@using BankYouBankruptContracts.ViewModels.Client.Default
|
||||
@using BankYouBankruptDataModels.Enums;
|
||||
|
||||
@model List<CreditingViewModel>
|
||||
|
||||
@ -51,7 +52,7 @@
|
||||
@Html.DisplayFor(modelItem => item.Sum)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Status)
|
||||
@item.Status.ToString().Replace("_", " ")
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateOpen)
|
||||
|
@ -51,7 +51,7 @@
|
||||
@Html.DisplayFor(modelItem => item.Sum)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Status)
|
||||
@item.Status.ToString().Replace("_", " ")
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateOpen)
|
||||
|
@ -7,20 +7,19 @@
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Диаграмма по месяцам</h1>
|
||||
<h1 class="display-4">Диаграмма финансов на карте по месяцам</h1>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="row">Номер счета:</div>
|
||||
<div class="col-8">
|
||||
<div class="row mb-2">
|
||||
<div class="row">Номер карты:</div>
|
||||
<div class="col">
|
||||
<select id="cardId" name="cardId" class="form-control" asp-items="@(new SelectList( @ViewBag.Cards, "Id", "Number"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Выбрать" class="btn btn-primary"/>
|
||||
<div class="row mb-2">
|
||||
<div class="col">
|
||||
<input style="width: 100%" type="submit" value="Выбрать" class="btn btn-warning"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -67,13 +66,17 @@
|
||||
datasets: [{
|
||||
label: 'Денег в этом месяце',
|
||||
data: data,
|
||||
borderWidth: 1
|
||||
borderWidth: 6,
|
||||
backgroundColor: 'rgb(255, 165, 0)'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
customCanvasBackgroundColor: {
|
||||
color: 'white',
|
||||
}
|
||||
},
|
||||
scales: {
|
||||
|
@ -1,6 +1,5 @@
|
||||
@using BankYouBankruptСlientApp
|
||||
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Страница пользователя";
|
||||
}
|
||||
@ -11,12 +10,14 @@
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
<img src="~/lib/logo.png" style="width: 80%"/>
|
||||
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
<h3 class="display-4">Сначала авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>Здравствуйтe, @APIClient.Client.Name @APIClient.Client.Patronymic</p>
|
||||
<h3 class="display-4">Здравствуйтe, @APIClient.Client.Name @APIClient.Client.Patronymic</h3>
|
||||
}
|
||||
</div>
|
@ -0,0 +1,10 @@
|
||||
@using BankYouBankruptСlientApp
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Отправка отчета";
|
||||
}
|
||||
|
||||
<div class="text-center p-5">
|
||||
<h3 class="display-4">Упс, что-то пошло не так...</h3>
|
||||
<h3 class="display-4">Ошибка: @APIClient.ErrorMessage</h3>
|
||||
</div>
|
@ -10,5 +10,5 @@
|
||||
<h1 class="h3 mb-3 font-weight-normal">Логин</h1>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" required autofocus>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" required>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit" asp-controller="Home" asp-action="Login">Войти</button>
|
||||
<button class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="Login">Войти</button>
|
||||
</form>
|
@ -0,0 +1,37 @@
|
||||
@using BankYouBankruptContracts.ViewModels.Client.Default
|
||||
|
||||
@model ClientViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Личный кабинет";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Личные данные</h2>
|
||||
</div>
|
||||
<form method="post" class="form-signin">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" value=@Html.DisplayFor(modelItem => Model.Email) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" value=@Html.DisplayFor(modelItem => Model.Password) required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Имя:</div>
|
||||
<input type="text" id="name" name="name" class="form-control" placeholder="Имя" value=@Html.DisplayFor(modelItem => Model.Name) required>
|
||||
<div class="col-4">Фамилия:</div>
|
||||
<input type="text" id="surname" name="surname" class="form-control" placeholder="Фамилия" value=@Html.DisplayFor(modelItem => Model.Surname) required>
|
||||
<div class="col-4">Отчество:</div>
|
||||
<input type="text" id="patronymic" name="patronymic" class="form-control" placeholder="Отчество" value=@Html.DisplayFor(modelItem => Model.Patronymic) required>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<div class="col-4">Телефон:</div>
|
||||
<input type="text" id="telephone" name="telephone" class="form-control" placeholder="Телефон" value=@Html.DisplayFor(modelItem => Model.Telephone) required>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
<button class="btn btn-lg btn-warning btn-block mb-2" type="submit" asp-controller="Home" asp-action="Privacy">Coхранить</button>
|
||||
<button class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="Logout">Выйти из аккаунта</button>
|
||||
</div>
|
||||
</form>
|
@ -5,53 +5,15 @@
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Регистрация</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="login" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Пароль:</div>
|
||||
<div class="col-8">
|
||||
<input type="password" name="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Имя:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="name" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Фамилия:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="surname" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Отчество:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="patronymic" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Телефон:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="telephone" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Регистрация" class="btn btn-primary" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Login">Уже есть аккаунт?</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="form-signin text-center" method="post">
|
||||
<h1 class="h3 mb-3 font-weight-normal">Регистрация</h1>
|
||||
<input type="email" id="login" name="login" class="form-control" placeholder="Почта" required>
|
||||
<input type="password" id="password" name="password" class="form-control" placeholder="Пароль" required>
|
||||
<input type="text" id="name" name="name" class="form-control" placeholder="Имя" required>
|
||||
<input type="text" id="surname" name="surname" class="form-control" placeholder="Фамилия" required>
|
||||
<input type="text" id="patronymic" name="patronymic" class="form-control" placeholder="Отчество" required>
|
||||
<input type="text" id="telephone" name="telephone" class="form-control" placeholder="Телефон" required>
|
||||
|
||||
<button class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="Register">Регистрация</button>
|
||||
</form>
|
@ -0,0 +1,16 @@
|
||||
@using BankYouBankruptСlientApp
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Отправка отчета";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
<h3 class="display-4">Сначала авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
}
|
||||
<h3 class="display-4">Отчeт был отправлен на почту @APIClient.Client.Email</h3>
|
||||
</div>
|
@ -1,4 +1,6 @@
|
||||
@using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
@using Microsoft.JSInterop;
|
||||
@inject IJSRuntime JS
|
||||
|
||||
@model ReportClientCardsViewModel
|
||||
|
||||
@ -16,6 +18,7 @@
|
||||
<div class="mb-4 mb-md-0 aos-init aos-animate col-md-3" sf-type="container" sf-label="Column" sf-anim-delay="1.5" data-aos="fade-down" data-aos-delay="400" sf-uid="4">
|
||||
<div sf-type="container" sf-label="Container" class="py-15 h-100 bg-bg-2" sf-uid="5">
|
||||
<form method="post">
|
||||
<h3>Карты:</h3>
|
||||
@for (var item = 0; item < @Model.Cards.Count(); item++)
|
||||
{
|
||||
<div class="form-check form-switch">
|
||||
@ -25,11 +28,38 @@
|
||||
<input type="hidden" asp-for="@Model.Cards[item].LabelName" />
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
<input class="btn btn-primary mt-3" type="submit" value="Submit" />
|
||||
<hr>
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="ReportWithCards">Создать отчёт</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit" asp-controller="Home" asp-action="CreateExcelReport">Создать отчёт Excel</button>
|
||||
<hr/>
|
||||
<div class="mb-2">
|
||||
<button type="button" id="ExcelBut" class="btn btn-lg btn-warning btn-block">Excel отчеты</button>
|
||||
</div>
|
||||
<div id="ExcelDiv" style="display: none">
|
||||
<div class="mb-2" >
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateExcelReport">Создать отчёт по переводам (EXCEL)</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateCreditingExcelReport">Создать отчёт по пополнениям (EXCEL)</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateDebitingExcelReport">Создать отчёт по снятиям (EXCEL)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button type="button" id="WordBut" class="btn btn-lg btn-warning btn-block">Word отчеты</button>
|
||||
</div>
|
||||
<div id="WordDiv" style="display: none">
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateWordReport">Создать отчёт по переводам (WORD)</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateCreditingWordReport">Создать отчёт по пополнениям (WORD)</button>
|
||||
</div>
|
||||
<div class="mb-2">
|
||||
<button style="width:100%" class="btn btn-lg btn-warning btn-block" type="submit" asp-controller="Home" asp-action="CreateDebitingWordReport">Создать отчёт по снятиям (WORD)</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -73,7 +103,7 @@
|
||||
@Html.DisplayFor(modelItem => item.Sum)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Status)
|
||||
@item.Status.ToString().Replace("_", " ");
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateOpen)
|
||||
@ -88,4 +118,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('ExcelBut').addEventListener('click', event => {
|
||||
if (document.getElementById("ExcelDiv").style.display == "none") {
|
||||
document.getElementById("ExcelDiv").style.display = "block";
|
||||
}
|
||||
else {
|
||||
document.getElementById("ExcelDiv").style.display = "none";
|
||||
}
|
||||
|
||||
});
|
||||
document.getElementById('WordBut').addEventListener('click', event => {
|
||||
if (document.getElementById("WordDiv").style.display == "none") {
|
||||
document.getElementById("WordDiv").style.display = "block";
|
||||
}
|
||||
else {
|
||||
document.getElementById("WordDiv").style.display = "none";
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,4 +1,5 @@
|
||||
@model ErrorViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
@ -45,13 +45,13 @@
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
<div class="col-md-3 text-end">
|
||||
<a class="btn btn-primary me-2" asp-controller="Home" asp-action="Login">Войти</a>
|
||||
<a class="btn btn-primary" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
<a class="btn btn-warning me-2" asp-controller="Home" asp-action="Login">Войти</a>
|
||||
<a class="btn btn-warning" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</div>
|
||||
}
|
||||
else {
|
||||
<div class="col-md-3 text-end">
|
||||
<a class="btn btn-primary me-2" asp-controller="Home" asp-action="Enter">@APIClient.Client.Name @APIClient.Client.Surname</a>
|
||||
<a class="btn btn-warning me-2" id="exit" name="exit" asp-controller="Home" asp-action="Privacy">@APIClient.Client.Surname @APIClient.Client.Name</a>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ html {
|
||||
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
font-size: 19px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +54,7 @@ body {
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
background-color: #212529;
|
||||
}
|
||||
|
||||
.form-signin {
|
||||
@ -86,4 +87,17 @@ body {
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
table.table tbody tr td,
|
||||
table.table thead tr th,
|
||||
table.table thead {
|
||||
border-left: solid;
|
||||
border-right: solid;
|
||||
border-width: 4px;
|
||||
border-color: #ffc107
|
||||
}
|
||||
|
||||
table {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
@ -17,8 +17,10 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public int SmtpClientPort { get; set; }
|
||||
|
||||
//можно без них?
|
||||
public string PopHost { get; set; } = string.Empty;
|
||||
|
||||
//можно без них?
|
||||
public int PopPort { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -14,5 +15,12 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
||||
public string Text { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
//для отправки pdf
|
||||
public byte[] File { get; set; } = Array.Empty<byte>();
|
||||
|
||||
public MailsEnum Role { get; set; }
|
||||
|
||||
public TypeDocEnum TypeDoc { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,6 +14,8 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
public int? AccountId { get; set; }
|
||||
|
||||
public List<int>? CardList { get; set; }
|
||||
|
||||
public string? ClientFullName { get; set; } = string.Empty;
|
||||
@ -20,5 +23,9 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
public MailsEnum Role { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,17 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
//вспомогательная модель для передачи DateTime при формировании отчёта
|
||||
public class ReportSupportBindingModel
|
||||
{
|
||||
public int ClientId { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
public DateTime DateFrom { get; set; }
|
||||
public int? AccountId { get; set; }
|
||||
|
||||
public DateTime DateTo { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
//для Excel отчёта клиента
|
||||
public List<int>? CardList { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IMessageInfoLogic
|
||||
{
|
||||
//List<MessageInfoViewModel>? ReadList(MessageInfoSearchModel? model);
|
||||
|
||||
//MessageInfoViewModel? ReadElement(MessageInfoSearchModel model);
|
||||
|
||||
bool Create(MessageInfoBindingModel model);
|
||||
|
||||
bool Update(MessageInfoBindingModel model);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using BankYouBankruptContracts.SearchModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptContracts.ViewModels.Client.Reports;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,10 +18,10 @@ namespace BankYouBankruptContracts.BusinessLogicsContracts
|
||||
List<ReportClientViewModel>? GetDebiting(ReportBindingModel model);
|
||||
|
||||
//Сохранение отчёта по картам в файл-Word
|
||||
void SaveToWordFile(ReportBindingModel model);
|
||||
void SaveToWordFile(ReportBindingModel model, OfficeOperationEnum operationEnum);
|
||||
|
||||
//Сохранение отчёта по картам в файл-Excel
|
||||
void SaveToExcelFile(ReportBindingModel model);
|
||||
void SaveToExcelFile(ReportBindingModel model, OfficeOperationEnum operationEnum);
|
||||
|
||||
//Сохранение отчёта по картам в файл-Pdf
|
||||
ReportClientViewModelForHTML SaveClientReportToPdfFile(ReportBindingModel model);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -14,6 +15,8 @@ namespace BankYouBankruptContracts.ViewModels
|
||||
|
||||
public int DebitingId { get; set; }
|
||||
|
||||
public StatusEnum DebitingStatus { get; set; }
|
||||
|
||||
[DisplayName("Номер заявки на снятие средств")]
|
||||
public int DebbitingNumber { get; set; }
|
||||
|
||||
|
@ -22,6 +22,9 @@ namespace BankYouBankruptContracts.ViewModels.Client.Default
|
||||
[DisplayName("Номер карты")]
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Баланс карты")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
public string CVC { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Период действия")]
|
||||
|
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptContracts.ViewModels
|
||||
{
|
||||
public class FileViewModel
|
||||
{
|
||||
public byte[] Bytes { get; set; } = Array.Empty<byte>();
|
||||
|
||||
public int[] Test { get; set; } = Array.Empty<int>();
|
||||
|
||||
public string StringBytes { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
15
BankYouBankrupt/BankYouBankruptDataModels/Enums/MailsEnum.cs
Normal file
15
BankYouBankrupt/BankYouBankruptDataModels/Enums/MailsEnum.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptDataModels.Enums
|
||||
{
|
||||
public enum MailsEnum
|
||||
{
|
||||
Клиент = 0,
|
||||
|
||||
Кассир = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankYouBankruptDataModels.Enums
|
||||
{
|
||||
public enum OfficeOperationEnum
|
||||
{
|
||||
Между_cчетами = 0,
|
||||
|
||||
Пополнение_карт = 1,
|
||||
|
||||
Cнятие_с_карты = 2,
|
||||
|
||||
Для_кассира = 3
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@ namespace BankYouBankruptDataModels.Enums
|
||||
|
||||
Закрыта = 1,
|
||||
|
||||
Отклонено = 2
|
||||
Отклонено = 2,
|
||||
|
||||
Карта_просрочена = 3
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Account)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Number) && x.Number == model.Number) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
@ -51,7 +52,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
{
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.Number.Contains(model.Number))
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.Number.Contains(model.Number))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -60,14 +62,26 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
{
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Where(x => x.ClientID == model.ClientID)
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.ClientID == model.ClientID)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (model.AccountId.HasValue)
|
||||
{
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Account)
|
||||
.Where(x => x.AccountId == model.AccountId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.Include(x => x.Account)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@ -77,7 +91,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
|
||||
return context.Cards
|
||||
.Include(x => x.Client)
|
||||
.Select(x => x.GetViewModel)
|
||||
.Include(x => x.Account)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,15 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using var context = new BankYouBancruptDatabase();
|
||||
|
||||
//сработает для поиска почты для отправки файла
|
||||
if(model.Id.HasValue && string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return context.Clients.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
return context.Clients.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.Email) && x.Email == model.Email && !string.IsNullOrEmpty(model.Password) && x.Password == model.Password) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
|
@ -32,7 +32,6 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
|
||||
var result = context.Debitings.Include(x => x.Card).ToList();
|
||||
|
||||
|
||||
//для получения всех заявок на стнятие со статусом "Открыта"
|
||||
if (model.Status.HasValue) result = result.Where(x => x.Status == model.Status).ToList();
|
||||
|
||||
|
@ -39,7 +39,6 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
||||
{
|
||||
return result.Where(x => (x.AccountSenderId == model.AccountSenderId || x.AccountPayeeId == model.AccountPayeeId)
|
||||
&& x.AccountSender != null)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
[Required]
|
||||
public int AccountId { get; set; }
|
||||
|
||||
public virtual Account Account { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
@ -46,6 +48,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
ClientID = ClientID,
|
||||
ClientSurname = Client.Surname,
|
||||
Number = Number,
|
||||
Sum = Account.Balance,
|
||||
Period = Period,
|
||||
CVC = CVC
|
||||
};
|
||||
@ -56,6 +59,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
AccountId = model.AccountId,
|
||||
Account = context.Accounts.First(x => x.Id == model.AccountId),
|
||||
ClientID = model.ClientID,
|
||||
Client = context.Clients.First(x => x.Id == model.ClientID),
|
||||
Number = model.Number,
|
||||
|
@ -69,6 +69,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
AccountNumber = Account.AccountNumber,
|
||||
SurmaneCashier = Cashier.Surname,
|
||||
DebbitingNumber = Debiting.Id,
|
||||
DebitingStatus = Debiting.Status,
|
||||
Sum = Sum,
|
||||
DateOperation = DateOperation
|
||||
};
|
||||
|
@ -56,7 +56,8 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
CardId = model.CardId,
|
||||
Card = context.Cards.First(x => x.Id == model.CardId),
|
||||
Sum = model.Sum,
|
||||
DateOpen = model.DateOpen
|
||||
DateOpen = model.DateOpen,
|
||||
Status = model.Status
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
Card = context.Cards.First(x => x.Id == model.CardId),
|
||||
Sum = model.Sum,
|
||||
DateOpen = model.DateOpen,
|
||||
Status = StatusEnum.Открыта
|
||||
Status = model.Status
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ namespace BankYouBankruptRestApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public List<CardViewModel>? GetUsersCardsList(int id)
|
||||
{
|
||||
|
@ -140,6 +140,5 @@ namespace BankYouBankruptRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.BusinessLogicsContracts;
|
||||
using BankYouBankruptContracts.SearchModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Enums;
|
||||
using BankYouBankruptRestApi.Controllers;
|
||||
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -34,6 +35,8 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
_reportCashierLogic = reportCashierLogic;
|
||||
}
|
||||
|
||||
#region Работа с pdf
|
||||
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
[HttpPost]
|
||||
public ReportClientViewModelForHTML CreateClientReport(ReportSupportBindingModel model)
|
||||
@ -44,7 +47,9 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
{
|
||||
FileName = "Отчёт_по_картам.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
DateTo = model.DateTo,
|
||||
Role = MailsEnum.Клиент,
|
||||
Email = model.Email
|
||||
});
|
||||
|
||||
return result;
|
||||
@ -67,8 +72,10 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
FileName = "Отчёт_по_счетам.pdf",
|
||||
ClientId = model.ClientId,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
});
|
||||
DateTo = model.DateTo,
|
||||
Role = MailsEnum.Кассир,
|
||||
Email = model.Email
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -79,7 +86,11 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//передача данных из отчёта клиента
|
||||
#endregion
|
||||
|
||||
#region Работа с Excel
|
||||
|
||||
//отчёт клиента Excel по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateExcelClient(ReportSupportBindingModel model)
|
||||
{
|
||||
@ -87,9 +98,10 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
{
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_переводам",
|
||||
CardList = model.CardList
|
||||
});
|
||||
FileName = "Отчёт по переводам.xlsx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Между_cчетами);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -98,33 +110,57 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//передача данных из отчёта кассира
|
||||
[HttpGet]
|
||||
public ReportCashierViewModelForHTML GetDataOfCashierReport()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _reportCashierViewModelForHTML;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
//метод генерации отчёта за период по картам клиента
|
||||
//отчёт клиента Excel по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateClientReport(ReportSupportBindingModel model)
|
||||
public void CreateExcelCrediting(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientViewModelForHTML = _reportClientLogic.SaveClientReportToPdfFile(new ReportBindingModel
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_картам.pdf",
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
FileName = "Отчёт по пополнениям.xlsx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Пополнение_карт);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//отчёт клиента Excel по выдаче денег
|
||||
[HttpPost]
|
||||
public void CreateExcelDebiting(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientLogic.SaveToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по снятиям.xlsx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Cнятие_с_карты);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//отчёт клиента Excel по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateExcelCashier(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportCashierLogic.SaveAccountsToExcelFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по зявкам на снятие.xlsx",
|
||||
AccountId = model.AccountId,
|
||||
Email = model.Email
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -134,18 +170,81 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//метод генерации отчёта по всем счетм клиентов
|
||||
#endregion
|
||||
|
||||
#region Работа с word
|
||||
|
||||
//отчёт клиента Word по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateCashierReport(ReportSupportBindingModel model)
|
||||
public void CreateWordClient(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportCashierViewModelForHTML = _reportCashierLogic.SaveAccountsToPdfFile(new ReportBindingModel
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт_по_счетам.pdf",
|
||||
ClientId = model.ClientId,
|
||||
DateFrom = model.DateFrom,
|
||||
DateTo = model.DateTo
|
||||
FileName = "Отчёт по переводам.docx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Между_cчетами);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//отчёт клиента Word по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateWordCrediting(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по пополнениям.docx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Пополнение_карт);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//отчёт клиента Word по выдаче денег
|
||||
[HttpPost]
|
||||
public void CreateWordDebiting(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportClientLogic.SaveToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по снятиям.docx",
|
||||
CardList = model.CardList,
|
||||
Email = model.Email
|
||||
}, OfficeOperationEnum.Cнятие_с_карты);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка входа в систему");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//отчёт клиента Word по переводу денег
|
||||
[HttpPost]
|
||||
public void CreateWordCashier(ReportSupportBindingModel model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_reportCashierLogic.SaveAccountsToWordFile(new ReportBindingModel
|
||||
{
|
||||
FileName = "Отчёт по зявкам на снятие.docx",
|
||||
AccountId = model.AccountId,
|
||||
Email = model.Email
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -154,6 +253,7 @@ namespace BankYouBankruptRestAPI.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -36,17 +36,12 @@ builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
|
||||
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
|
||||
builder.Services.AddSingleton<IReportCashierLogic, ReportCashierLogic>();
|
||||
|
||||
builder.Services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||
|
||||
builder.Services.AddTransient<AbstractMailWorker, MailKitWorker>();
|
||||
builder.Services.AddSingleton<MailKitWorker>();
|
||||
|
||||
//общие классы формировани отчётов
|
||||
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||
|
||||
builder.Services.AddTransient<AbstractSaveToWordClient, SaveToWord>();
|
||||
builder.Services.AddTransient<AbstractSaveToWordCashier, SaveToWordCashier>();
|
||||
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
@ -61,7 +56,7 @@ builder.Services.AddSwaggerGen(c =>
|
||||
var app = builder.Build();
|
||||
|
||||
//Mails Service
|
||||
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
||||
var mailSender = app.Services.GetService<MailKitWorker>();
|
||||
|
||||
mailSender?.MailConfig(new MailConfigBindingModel
|
||||
{
|
||||
@ -69,8 +64,6 @@ mailSender?.MailConfig(new MailConfigBindingModel
|
||||
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
||||
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
||||
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
||||
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
||||
});
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
@ -5,5 +5,11 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
|
||||
"AllowedHosts": "*",
|
||||
|
||||
"SmtpClientHost": "smtp.gmail.com",
|
||||
"SmtpClientPort": "587",
|
||||
"MailLogin": "uveselchak99@gmail.com",
|
||||
"MailPassword": "nqkv jzzq fryi leao"
|
||||
}
|
||||
|
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