Compare commits

..

No commits in common. "f24279d9db07044e7a7d50d7b135cc692c7b6e6e" and "ed4f11ab9117229928cfd0ee28fac24d000b4b17" have entirely different histories.

38 changed files with 310 additions and 10 deletions

View File

@ -37,7 +37,7 @@ namespace ComputerShopBusinessLogic.BusinessLogics
/// Отчёт для doc/xls /// Отчёт для doc/xls
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(List<int> selectedOrders) public List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(/*List<OrderSearchModel>*/List<int> selectedOrders)
{ {
return _orderStorage.GetOrdersAssemblies(selectedOrders); return _orderStorage.GetOrdersAssemblies(selectedOrders);
} }
@ -58,6 +58,7 @@ namespace ComputerShopBusinessLogic.BusinessLogics
Title = "Список сборок по выбранным заказам", Title = "Список сборок по выбранным заказам",
OrderAssemblies = GetReportOrdersAssemblies(model.Ids) OrderAssemblies = GetReportOrdersAssemblies(model.Ids)
});; });;
//throw new NotImplementedException();
} }
public void SaveReportOrderAssembliesToExcelFile(ReportBindingModel model) public void SaveReportOrderAssembliesToExcelFile(ReportBindingModel model)
{ {
@ -66,6 +67,7 @@ namespace ComputerShopBusinessLogic.BusinessLogics
FileName = model.FileName, FileName = model.FileName,
OrderAssemblies = GetReportOrdersAssemblies(model.Ids) OrderAssemblies = GetReportOrdersAssemblies(model.Ids)
}); });
//throw new NotImplementedException();
} }
//!!!ИСПРАВИТЬ //!!!ИСПРАВИТЬ

View File

@ -17,11 +17,13 @@ namespace ComputerShopBusinessLogic.MailWorker
protected int _smtpClientPort; protected int _smtpClientPort;
protected string _popHost = string.Empty; protected string _popHost = string.Empty;
protected int _popPort; protected int _popPort;
//private readonly IOrganiserLogic _organiserLogic;
private readonly ILogger _logger; private readonly ILogger _logger;
public AbstractMailWorker(ILogger<AbstractMailWorker> logger) public AbstractMailWorker(ILogger<AbstractMailWorker> logger/*, IOrganiserLogic organiserLogic*/)
{ {
_logger = logger; _logger = logger;
//_organiserLogic = organiserLogic;
} }
public void MailConfig(MailConfigBindingModel config) public void MailConfig(MailConfigBindingModel config)

View File

@ -15,7 +15,7 @@ namespace ComputerShopBusinessLogic.MailWorker
{ {
public class MailKitWorker : AbstractMailWorker public class MailKitWorker : AbstractMailWorker
{ {
public MailKitWorker(ILogger<MailKitWorker> logger) : base(logger) { } public MailKitWorker(ILogger<MailKitWorker> logger/*, IOrganiserLogic organiserLogic*/) : base(logger/*, organiserLogic*/) { }
protected override async Task SendMailAsync(MailSendInfoBindingModel info) protected override async Task SendMailAsync(MailSendInfoBindingModel info)
{ {

View File

@ -14,6 +14,7 @@ namespace ComputerShopBusinessLogic.OfficePackage
{ {
CreateExcel(info); CreateExcel(info);
//!!!2 абзаца ниже - настройка заголовков, исправить скорее всего
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
@ -22,6 +23,12 @@ namespace ComputerShopBusinessLogic.OfficePackage
StyleInfo = ExcelStyleInfoType.Title StyleInfo = ExcelStyleInfoType.Title
}); });
//MergeCells(new ExcelMergeParameters
//{
// CellFromName = "A1",
// CellToName = "C1"
//});
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "B", ColumnName = "B",
@ -135,8 +142,48 @@ namespace ComputerShopBusinessLogic.OfficePackage
rowIndex++; rowIndex++;
} }
} }
//rowIndex++; //rowIndex++;
// foreach (var (Component, Count) in tc.Components)
// {
// InsertCellInWorksheet(new ExcelCellParameters
// {
// ColumnName = "B",
// RowIndex = rowIndex,
// Text = Component,
// StyleInfo = ExcelStyleInfoType.TextWithBorder
// });
// InsertCellInWorksheet(new ExcelCellParameters
// {
// ColumnName = "C",
// RowIndex = rowIndex,
// Text = Count.ToString(),
// StyleInfo = ExcelStyleInfoType.TextWithBorder
// });
// rowIndex++;
// }
// InsertCellInWorksheet(new ExcelCellParameters
// {
// ColumnName = "A",
// RowIndex = rowIndex,
// Text = "Итого",
// StyleInfo = ExcelStyleInfoType.Text
// });
// InsertCellInWorksheet(new ExcelCellParameters
// {
// ColumnName = "C",
// RowIndex = rowIndex,
// Text = tc.TotalCount.ToString(),
// StyleInfo = ExcelStyleInfoType.Text
// });
// rowIndex++;
} }
SaveExcel(info); SaveExcel(info);
} }
protected abstract void CreateExcel(ExcelInfoImplementer info); protected abstract void CreateExcel(ExcelInfoImplementer info);

View File

@ -15,6 +15,7 @@ namespace ComputerShopBusinessLogic.OfficePackage
CreatePdf(info); CreatePdf(info);
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center }); CreateParagraph(new PdfParagraph { Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center });
//!!!МБ ТУТ НЕЛЬЗЯ ДРОБНЫЕ ЧИСЛА ИЛИ МОЖНО С ТОЧКОЙ
CreateTable(new List<string> { "2cm", "2.5cm", "2cm", "2cm", "2cm", "4cm", "2.5cm", "3.5cm", "3.5cm", "2.5cm" }); CreateTable(new List<string> { "2cm", "2.5cm", "2cm", "2cm", "2cm", "4cm", "2.5cm", "3.5cm", "3.5cm", "2.5cm" });
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
@ -26,6 +27,7 @@ namespace ComputerShopBusinessLogic.OfficePackage
foreach (var order in info.Orders) foreach (var order in info.Orders)
{ {
//!!!СЮДА
if (order.RequestsAssemblies.Count < 1) if (order.RequestsAssemblies.Count < 1)
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
@ -54,6 +56,8 @@ namespace ComputerShopBusinessLogic.OfficePackage
} }
} }
//CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Rigth });
SavePdf(info); SavePdf(info);
} }
protected abstract void CreatePdf(PdfInfoImplementer info); protected abstract void CreatePdf(PdfInfoImplementer info);

View File

@ -45,6 +45,10 @@ namespace ComputerShopBusinessLogic.OfficePackage
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {
//(orderAs.OrderId.ToString() + "\n", new WordTextProperties {Size = "24", Bold=true}),
//(orderAs.DateCreateOrder.ToShortDateString() + " - ", new WordTextProperties { Size = "24" }),
//(orderAs.OrderSum.ToString() + " - ", new WordTextProperties { Size = "24" }),
//(orderAs.OrderStatus.ToString() + " - ", new WordTextProperties { Size = "24" }),
(assembly.AssemblyName + " - ", new WordTextProperties { Size = "24" }), (assembly.AssemblyName + " - ", new WordTextProperties { Size = "24" }),
(assembly.AssemblyCategory + " - ", new WordTextProperties { Size = "24" }), (assembly.AssemblyCategory + " - ", new WordTextProperties { Size = "24" }),
(assembly.AssemblyPrice.ToString(), new WordTextProperties { Size = "24" }) (assembly.AssemblyPrice.ToString(), new WordTextProperties { Size = "24" })

View File

@ -10,6 +10,8 @@ namespace ComputerShopBusinessLogic.OfficePackage.HelperModels
public class ExcelInfoImplementer public class ExcelInfoImplementer
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
//public string Title { get; set; } = string.Empty;
//!!!Мб поставить string.Empty, названия задать в ReportImplementerLogic
public string Title1 { get; set; } = "ID заказа"; public string Title1 { get; set; } = "ID заказа";
public string Title2 { get; set; } = "Дата заказа"; public string Title2 { get; set; } = "Дата заказа";
public string Title3 { get; set; } = "Стоимость заказа"; public string Title3 { get; set; } = "Стоимость заказа";

View File

@ -183,6 +183,9 @@ namespace ComputerShopBusinessLogic.OfficePackage.Implements
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>(); var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
worksheetPart.Worksheet = new Worksheet(new SheetData()); worksheetPart.Worksheet = new Worksheet(new SheetData());
// Добавление столбцов с заданной шириной
// Save the stylesheet formats
//stylesPart.Stylesheet.Save();
// Create custom widths for columns // Create custom widths for columns
Columns lstColumns = worksheetPart.Worksheet.GetFirstChild<Columns>(); Columns lstColumns = worksheetPart.Worksheet.GetFirstChild<Columns>();
@ -190,6 +193,10 @@ namespace ComputerShopBusinessLogic.OfficePackage.Implements
{ {
lstColumns = new Columns(); lstColumns = new Columns();
} }
// Min = 1, Max = 1 ==> Apply this to column 1 (A)
// Min = 2, Max = 2 ==> Apply this to column 2 (B)
// Width = 25 ==> Set the width to 25
// CustomWidth = true ==> Tell Excel to use the custom width
lstColumns.Append(new Column() { Min = 1, Max = 1, Width = 10, CustomWidth = true }); lstColumns.Append(new Column() { Min = 1, Max = 1, Width = 10, CustomWidth = true });
lstColumns.Append(new Column() { Min = 2, Max = 2, Width = 10, CustomWidth = true }); lstColumns.Append(new Column() { Min = 2, Max = 2, Width = 10, CustomWidth = true });
lstColumns.Append(new Column() { Min = 3, Max = 3, Width = 20, CustomWidth = true }); lstColumns.Append(new Column() { Min = 3, Max = 3, Width = 20, CustomWidth = true });

View File

@ -101,6 +101,7 @@ namespace ComputerShopBusinessLogic.OfficePackage.Implements
} }
} }
//!!!ТУТ ИСКЛЮЧЕНИЕ
protected override void SavePdf(PdfInfoImplementer info) protected override void SavePdf(PdfInfoImplementer info)
{ {
var renderer = new PdfDocumentRenderer(true) var renderer = new PdfDocumentRenderer(true)

View File

@ -15,7 +15,7 @@ namespace ComputerShopContracts.BusinessLogicContracts
/// Получение отчёта для word/excel /// Получение отчёта для word/excel
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(List<int> selectedOrders); List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(List</*OrderSearchModel*/int> selectedOrders);
/// <summary> /// <summary>
/// Получение отчёта для почты /// Получение отчёта для почты

View File

@ -11,6 +11,7 @@ namespace ComputerShopContracts.SearchModels
public int? Id { get; set; } public int? Id { get; set; }
public int? UserId { get; set; } public int? UserId { get; set; }
//поиск по сборкам
public int? AssemblyId { get; set; } public int? AssemblyId { get; set; }
public DateTime? DateFrom { get; set; } public DateTime? DateFrom { get; set; }

View File

@ -18,7 +18,7 @@ namespace ComputerShopContracts.StorageContracts
OrderViewModel? Update(OrderBindingModel model); OrderViewModel? Update(OrderBindingModel model);
OrderViewModel? Delete(OrderBindingModel model); OrderViewModel? Delete(OrderBindingModel model);
//получение данных о заказах для отчётов //получение данных о заказах для отчётов
List<ReportOrderAssemblyViewModel> GetOrdersAssemblies(List<int> model); List<ReportOrderAssemblyViewModel> GetOrdersAssemblies(List<int/*OrderSearchModel*/> model);
List<ReportOrdersViewModel> GetOrdersInfoByDates(ReportBindingModel report); List<ReportOrdersViewModel> GetOrdersInfoByDates(ReportBindingModel report);
} }
} }

View File

@ -20,5 +20,6 @@ namespace ComputerShopContracts.ViewModels
//данные о сборках //данные о сборках
public List<(string AssemblyName, string AssemblyCategory, double AssemblyPrice)> Assemblies { get; set; } public List<(string AssemblyName, string AssemblyCategory, double AssemblyPrice)> Assemblies { get; set; }
//public Dictionary<int, IAssemblyModel> Assemblies { get; set; }
} }
} }

View File

@ -39,5 +39,9 @@ namespace ComputerShopContracts.ViewModels
this.RequestOrders = requestOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel); this.RequestOrders = requestOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel);
this.Assembly = assembly as IAssemblyModel; this.Assembly = assembly as IAssemblyModel;
} }
//public RequestViewModel(Dictionary<int, OrderViewModel> requestOrders)
//{
// this.RequestOrders = requestOrders.ToDictionary(x => x.Key, x => x.Value as IOrderModel);
//}
} }
} }

View File

@ -58,8 +58,11 @@ namespace ComputerShopDatabaseImplement.Implements
public List<ReportOrderAssemblyViewModel> GetOrdersAssemblies(List<int>/*<OrderSearchModel>*/ selectedModels) public List<ReportOrderAssemblyViewModel> GetOrdersAssemblies(List<int>/*<OrderSearchModel>*/ selectedModels)
{ {
using var context = new ComputerShopDatabase(); using var context = new ComputerShopDatabase();
//id заказов, которые выбрал пользователь
//List<int?> id_of_selected_models = selectedModels.Select(x => x.Id).ToList();
//те заказы из бд, которые выбрал пользователь и имеют сборку //те заказы из бд, которые выбрал пользователь и имеют сборку
//МБ ИЗМЕНИТЬ, И СДЕЛАТЬ ВЫВОД ВСЕХ ЗАЯВОК (В ТОМ ЧИСЛЕ БЕЗ СБОРОК)
return context.Orders.Include(x => x.Requests) return context.Orders.Include(x => x.Requests)
.ThenInclude(x => x.Request) .ThenInclude(x => x.Request)
.ThenInclude(x => x.Assembly) .ThenInclude(x => x.Assembly)

View File

@ -15,6 +15,7 @@ namespace ComputerShopDatabaseImplement.Implements
public class RequestStorage : IRequestStorage public class RequestStorage : IRequestStorage
{ {
//id пользователя учитывается в GetFilteredList //id пользователя учитывается в GetFilteredList
//!!!ТУТ ДОБАВИЛ .OrderBy(x => x.DateRequest)
public List<RequestViewModel> GetFullList() public List<RequestViewModel> GetFullList()
{ {
using var context = new ComputerShopDatabase(); using var context = new ComputerShopDatabase();
@ -155,9 +156,11 @@ namespace ComputerShopDatabaseImplement.Implements
{ {
assemblyPrice = request.Assembly.Price; assemblyPrice = request.Assembly.Price;
} }
//var ordersOfRequest = context.RequestOrders.Where(x => x.RequestId == model.Id).ToList();
foreach (Order order_request in request.RequestOrders.Values) foreach (Order order_request in request.RequestOrders.Values)
{ {
//Если была связанная сборка, то вычитание стоимости сборки, иначе -0 //Если была связанная сборка, то вычитание стоимости сборки, иначе -0
//order_request.ChangeSum(-(request.Assembly?.Price ?? 0));
order_request.ChangeSum(-assemblyPrice); order_request.ChangeSum(-assemblyPrice);
} }
context.Requests.Remove(request); context.Requests.Remove(request);

View File

@ -18,6 +18,7 @@ namespace ComputerShopDatabaseImplement.Implements
public List<ShipmentViewModel> GetFullList() public List<ShipmentViewModel> GetFullList()
{ {
using var context = new ComputerShopDatabase(); using var context = new ComputerShopDatabase();
//!!!ТУТ ДОБАВИЛ .OrderBy(x => x.DateShipment)
return context.Shipments return context.Shipments
.Include(x => x.Orders) .Include(x => x.Orders)
.ThenInclude(x => x.Order) .ThenInclude(x => x.Order)

View File

@ -76,6 +76,7 @@ namespace ComputerShopDatabaseImplement.Models
ClientFIO = model.ClientFIO; ClientFIO = model.ClientFIO;
} }
DateRequest = model.DateRequest; DateRequest = model.DateRequest;
//DateMake не обновляю, потому что странно менять дату оформления заявки после её создания
//Обновление ссылки на сборку (assemblyId) отдельным методом //Обновление ссылки на сборку (assemblyId) отдельным методом
} }

View File

@ -90,6 +90,7 @@ namespace ComputerShopDatabaseImplement.Models
//ИСПРАВЛЕНО: удаление всех заказов //ИСПРАВЛЕНО: удаление всех заказов
if (shipmentOrders != null && shipmentOrders.Count > 0) if (shipmentOrders != null && shipmentOrders.Count > 0)
{ {
//context.ShipmentOrders.RemoveRange(shipmentOrders.Where(x => !model.ShipmentOrders.ContainsKey(x.OrderId)));
context.ShipmentOrders.RemoveRange(shipmentOrders); context.ShipmentOrders.RemoveRange(shipmentOrders);
context.SaveChanges(); context.SaveChanges();
} }

View File

@ -18,6 +18,11 @@ namespace ComputerShopDatabaseImplement.Models
public int ShipmentId { get; set; } public int ShipmentId { get; set; }
[Required] [Required]
public int OrderId { get; set; } public int OrderId { get; set; }
//МБ НАДО ТАК:
//[ForeignKey("OrderId")]
//public virtual Order Order { get; set; }
public virtual Shipment Shipment { get; set; } = new(); public virtual Shipment Shipment { get; set; } = new();
public virtual Order Order { get; set; } = new(); public virtual Order Order { get; set; } = new();
} }

View File

@ -27,6 +27,12 @@ namespace ComputerShopImplementerApp
var result = response.Result.Content.ReadAsStringAsync().Result; var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode) if (response.Result.IsSuccessStatusCode)
{ {
// var settings = new JsonSerializerSettings
// {
// TypeNameHandling = TypeNameHandling.All
//};
//return JsonConvert.DeserializeObject<T>(result, settings);
return JsonConvert.DeserializeObject<T>(result); return JsonConvert.DeserializeObject<T>(result);
} }
else else

View File

@ -29,11 +29,12 @@ namespace ComputerShopImplementerApp.Controllers
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
return View(); return View(/*APIUser.GetRequest<List<OrderViewModel>>($"api/main/getorders?userId={APIUser.User.Id}")*/);
} }
// ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ // ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ
//!!!МБ ДОБАВИТЬ [HttpGet]
public IActionResult Orders() public IActionResult Orders()
{ {
if (APIUser.User == null) if (APIUser.User == null)
@ -67,6 +68,8 @@ namespace ComputerShopImplementerApp.Controllers
[HttpGet] [HttpGet]
public IActionResult CreateOrder() public IActionResult CreateOrder()
{ {
//!!!ПОТОМ УДАЛИТЬ
//ViewBag.OrderStatuses = APIUser.GetRequest<List<String>>("api/order/getorderstatuses");
return View(); return View();
} }
@ -78,6 +81,11 @@ namespace ComputerShopImplementerApp.Controllers
{ {
throw new Exception("Вход только авторизованным"); throw new Exception("Вход только авторизованным");
} }
//if (count <= 0)
//{
// throw new Exception("Количество и сумма должны быть больше 0");
//}
//if ()
if (date != DateTime.MinValue) if (date != DateTime.MinValue)
{ {
APIUser.PostRequest("api/order/createorder", new OrderBindingModel APIUser.PostRequest("api/order/createorder", new OrderBindingModel
@ -89,6 +97,15 @@ namespace ComputerShopImplementerApp.Controllers
}); });
} }
Response.Redirect("Orders"); Response.Redirect("Orders");
//try
//{
//}
//catch (Exception)
//{
// Response.Redirect("CreateOrder");
//}
} }
@ -105,6 +122,7 @@ namespace ComputerShopImplementerApp.Controllers
return View(); return View();
} }
//МБ ПОСТАВИТЬ int? и передавать order.Value
[HttpPost] [HttpPost]
public void UpdateOrder(int order, OrderStatus status, DateTime date, double sum) public void UpdateOrder(int order, OrderStatus status, DateTime date, double sum)
{ {
@ -112,6 +130,14 @@ namespace ComputerShopImplementerApp.Controllers
{ {
Response.Redirect("~/Home/Entry"); Response.Redirect("~/Home/Entry");
} }
//if (order == null)
//{
// throw new Exception("Выберите заказ для изменения");
//}
//if (status == null)
//{
// throw new Exception("Выберите статус для заказа");
//}
if (order > 0 && date != DateTime.MinValue) if (order > 0 && date != DateTime.MinValue)
{ {
APIUser.PostRequest("api/order/updateorder", new OrderBindingModel APIUser.PostRequest("api/order/updateorder", new OrderBindingModel
@ -135,6 +161,7 @@ namespace ComputerShopImplementerApp.Controllers
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}"); ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
//ViewBag.Statuses =
return View(); return View();
} }
@ -144,6 +171,7 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null) if (APIUser.User == null)
{ {
Redirect("~/Home/Enter"); Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
} }
if (order > 0) if (order > 0)
@ -179,13 +207,24 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null) if (APIUser.User == null)
{ {
Redirect("~/Home/Enter"); Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
} }
//GetRequestShipmentAsync
var result = await APIUser.GetRequestShipmentAsync<ShipmentViewModel>($"api/shipment/getshipment?id={shipmentId}"); var result = await APIUser.GetRequestShipmentAsync<ShipmentViewModel>($"api/shipment/getshipment?id={shipmentId}");
if (result == null) if (result == null)
{ {
return default; return default;
} }
return result; return result;
//try
//{
//}
//catch (Exception)
//{
// Response.Redirect("Shipments");
// return default;
//}
} }
@ -213,6 +252,8 @@ namespace ComputerShopImplementerApp.Controllers
foreach (var orderId in orders) foreach (var orderId in orders)
{ {
selectedOrders.Add(orderId, new OrderSearchModel { Id = orderId } as IOrderModel); selectedOrders.Add(orderId, new OrderSearchModel { Id = orderId } as IOrderModel);
//var orderModel = APIUser.GetRequest<OrderViewModel>($"api/order/getorder?id={orderId}");
//selectedOrders.Add(orderId, orderModel);
} }
if (!string.IsNullOrEmpty(providerName) && date != DateTime.MinValue && APIUser.User != null) if (!string.IsNullOrEmpty(providerName) && date != DateTime.MinValue && APIUser.User != null)
{ {
@ -228,6 +269,7 @@ namespace ComputerShopImplementerApp.Controllers
} }
//!!!МБ СДЕЛАТЬ ПО АНАЛОГИИ С public async Task<IActionResult> Shipments()
[HttpGet] [HttpGet]
public async Task<IActionResult> UpdateShipment() public async Task<IActionResult> UpdateShipment()
{ {
@ -272,12 +314,28 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null) if (APIUser.User == null)
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
} }
ViewBag.Shipments = await APIUser.GetRequestShipmentAsync<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={APIUser.User.Id}"); ViewBag.Shipments = await APIUser.GetRequestShipmentAsync<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={APIUser.User.Id}");
return View(); return View();
} }
//[HttpPost]
//public void DeleteShipment(int shipment)
//{
// if (APIUser.User == null)
// {
// throw new Exception("Вход только авторизованным");
// }
// APIUser.PostRequest("api/shipment/deleteshipment", new ShipmentBindingModel
// {
// Id = shipment
// });
// Response.Redirect("Shipments");
//}
[HttpPost] [HttpPost]
public async Task<IActionResult> DeleteShipment(int shipment) public async Task<IActionResult> DeleteShipment(int shipment)
{ {
@ -301,6 +359,18 @@ namespace ComputerShopImplementerApp.Controllers
// ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ // ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ
//public IActionResult Requests()
//{
// if (APIUser.User == null)
// {
// return Redirect("~/Home/Enter");
// }
// return View(APIUser.GetRequest<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}"));
//}
//МБ ТАК Requests
public async Task<IActionResult> Requests() public async Task<IActionResult> Requests()
{ {
if (APIUser.User == null) if (APIUser.User == null)
@ -308,6 +378,8 @@ namespace ComputerShopImplementerApp.Controllers
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
var requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}"); var requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}");
//var shipments = await APIUser.GetRequestShipmentAsync<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={APIUser.User.Id}");
return View(requests); return View(requests);
} }
@ -319,6 +391,7 @@ namespace ComputerShopImplementerApp.Controllers
{ {
Response.Redirect("~/Home/Enter"); Response.Redirect("~/Home/Enter");
} }
//GetRequestShipmentAsync
var result = await APIUser.GetRequestRequestAsync<RequestViewModel>($"api/request/getrequest?id={requestId}"); var result = await APIUser.GetRequestRequestAsync<RequestViewModel>($"api/request/getrequest?id={requestId}");
if (result == null) if (result == null)
{ {
@ -347,6 +420,7 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null) if (APIUser.User == null)
{ {
Redirect("~/Home/Enter"); Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
} }
// Создаем словарь из выбранных заказов // Создаем словарь из выбранных заказов
var selectedOrders = new Dictionary<int, IOrderModel>(); var selectedOrders = new Dictionary<int, IOrderModel>();
@ -374,6 +448,7 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null) if (APIUser.User == null)
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
} }
ViewBag.Requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}"); ViewBag.Requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}");
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}"); ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
@ -416,6 +491,7 @@ namespace ComputerShopImplementerApp.Controllers
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
ViewBag.Requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}"); ViewBag.Requests = await APIUser.GetRequestRequestAsync<List<RequestViewModel>>($"api/request/getrequests?userId={APIUser.User.Id}");
//ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
ViewBag.Assemblies = APIUser.GetRequest<List<AssemblyViewModel>>($"api/assembly/getassemblies"); ViewBag.Assemblies = APIUser.GetRequest<List<AssemblyViewModel>>($"api/assembly/getassemblies");
return View(); return View();
} }
@ -480,6 +556,7 @@ namespace ComputerShopImplementerApp.Controllers
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}"); ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
//ViewBag.Statuses =
return View(); return View();
} }
@ -518,6 +595,7 @@ namespace ComputerShopImplementerApp.Controllers
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx" FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx"
}); });
return GetWordFile(); return GetWordFile();
//Response.Redirect("GetWordFile");
} }
if (type == "xlsx") if (type == "xlsx")
@ -528,6 +606,7 @@ namespace ComputerShopImplementerApp.Controllers
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx" FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx"
}); });
return GetExcelFile(); return GetExcelFile();
//Response.Redirect("GetExcelFile");
} }
} }
return Redirect("Index"); return Redirect("Index");
@ -541,6 +620,8 @@ namespace ComputerShopImplementerApp.Controllers
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
//ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
//ViewBag.Statuses =
return View(); return View();
} }
@ -561,6 +642,7 @@ namespace ComputerShopImplementerApp.Controllers
DateTo = dateTo DateTo = dateTo
}); });
string table = ""; string table = "";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС u-table-entity
table += $"<table class=\"u-table-entity\">"; table += $"<table class=\"u-table-entity\">";
table += "<colgroup>"; table += "<colgroup>";
//ID заказа //ID заказа
@ -584,8 +666,11 @@ namespace ComputerShopImplementerApp.Controllers
//Цена сборки //Цена сборки
table += "<col width=\"10%\" />"; table += "<col width=\"10%\" />";
table += "</colgroup>"; table += "</colgroup>";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС
table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">"; table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">";
//МБ ИЗМЕНИТЬ ВЫСОТУ
table += "<tr style=\"height: 31px\">"; table += "<tr style=\"height: 31px\">";
//МБ ИЗМЕНИТЬ КЛАСС
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">ID заказа</th>"; table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">ID заказа</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Дата заказа</th>"; table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Дата заказа</th>";
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Стоимость заказа</th>"; table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Стоимость заказа</th>";
@ -598,11 +683,13 @@ namespace ComputerShopImplementerApp.Controllers
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Цена сборки</th>"; table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">Цена сборки</th>";
table += "</tr>"; table += "</tr>";
table += "</thead>"; table += "</thead>";
//МБ НЕ ПРИСВАИВАТЬ КЛАСС ИЛИ СДЕЛАТЬ ПЕРЕД ВНУТРЕННИМ ЦИКЛОМ
table += "<tbody class=\"u-table-body\">"; table += "<tbody class=\"u-table-body\">";
foreach (var order in result) foreach (var order in result)
{ {
if (order.RequestsAssemblies.Count < 1) if (order.RequestsAssemblies.Count < 1)
{ {
//МБ ПОМЕНЯТЬ ВЫСОТУ
table += "<tr style=\"height: 75px\">"; table += "<tr style=\"height: 75px\">";
table += $"<td class=\"u-border-1 u-border-grey-40 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.OrderId.ToString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.OrderId.ToString()}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.DateCreateOrder.ToShortDateString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.DateCreateOrder.ToShortDateString()}</td>";
@ -618,6 +705,7 @@ namespace ComputerShopImplementerApp.Controllers
} }
foreach (var request in order.RequestsAssemblies) foreach (var request in order.RequestsAssemblies)
{ {
//МБ ПОМЕНЯТЬ ВЫСОТУ
table += "<tr style=\"height: 75px\">"; table += "<tr style=\"height: 75px\">";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.OrderId.ToString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.OrderId.ToString()}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.DateCreateOrder.ToShortDateString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{order.DateCreateOrder.ToShortDateString()}</td>";
@ -628,6 +716,7 @@ namespace ComputerShopImplementerApp.Controllers
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{request.DateRequest.ToShortDateString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{request.DateRequest.ToShortDateString()}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{(string.IsNullOrEmpty(request.AssemblyName) ? "Сборка не привязана" : request.AssemblyName)}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{(string.IsNullOrEmpty(request.AssemblyName) ? "Сборка не привязана" : request.AssemblyName)}</td>";
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{(string.IsNullOrEmpty(request.AssemblyCategory) ? "Неизвестная категория" : request.AssemblyCategory)}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{(string.IsNullOrEmpty(request.AssemblyCategory) ? "Неизвестная категория" : request.AssemblyCategory)}</td>";
//МБ тут не будет 0 у непривязанных сборок
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{request.AssemblyPrice.ToString()}</td>"; table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\" style=\"text-align:center; border: 1px solid black; border-collapse:collapse\">{request.AssemblyPrice.ToString()}</td>";
table += "</tr>"; table += "</tr>";
} }
@ -645,6 +734,10 @@ namespace ComputerShopImplementerApp.Controllers
{ {
throw new Exception("Вход только авторизованным"); throw new Exception("Вход только авторизованным");
} }
//if (string.IsNullOrEmpty(organiserEmail))
//{
// throw new Exception("Email пуст");
//}
if (dateFrom != DateTime.MinValue && dateTo != DateTime.MinValue) if (dateFrom != DateTime.MinValue && dateTo != DateTime.MinValue)
{ {
APIUser.PostRequest("api/order/CreateReportToPDFFile", new ReportBindingModel APIUser.PostRequest("api/order/CreateReportToPDFFile", new ReportBindingModel
@ -656,6 +749,7 @@ namespace ComputerShopImplementerApp.Controllers
}); });
APIUser.PostRequest("api/order/SendPDFToMail", new MailSendInfoBindingModel APIUser.PostRequest("api/order/SendPDFToMail", new MailSendInfoBindingModel
{ {
//!!!МБ СЮДА ПЕРЕДАВАТЬ ПОЧТУ, КОТОРУЮ ВВОДЯТ НА СТРАНИЦЕ
MailAddress = APIUser.User.Email, MailAddress = APIUser.User.Email,
Subject = "Отчет за период", Subject = "Отчет за период",
Text = "Отчет по заказам с " + dateFrom.ToShortDateString() + " по " + dateTo.ToShortDateString() Text = "Отчет по заказам с " + dateFrom.ToShortDateString() + " по " + dateTo.ToShortDateString()
@ -724,6 +818,16 @@ namespace ComputerShopImplementerApp.Controllers
[HttpPost] [HttpPost]
public void Enter(string login, string password) public void Enter(string login, string password)
{ {
//if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
//{
// Response.Redirect("Enter");
//}
//APIUser.User = APIUser.GetRequest<UserViewModel>($"api/user/loginimplementer?login={login}&password={password}");
//if (APIUser.User == null)
//{
// Response.Redirect("Enter");
//}
//Response.Redirect("Index");
try try
{ {
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))

View File

@ -10,6 +10,12 @@ using ComputerShopBusinessLogic.OfficePackage.Implements;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
//builder.Services.AddTransient<IUserModel, User>();
//builder.Services.AddTransient<IOrder, Order>();
//builder.Services.AddTransient<IShipmentModel, Shipment>();
//builder.Services.AddTransient<IRequestModel, Request>();
builder.Services.AddTransient<IUserStorage, UserStorage>(); builder.Services.AddTransient<IUserStorage, UserStorage>();
builder.Services.AddTransient<IShipmentStorage, ShipmentStorage>(); builder.Services.AddTransient<IShipmentStorage, ShipmentStorage>();
builder.Services.AddTransient<IRequestStorage, RequestStorage>(); builder.Services.AddTransient<IRequestStorage, RequestStorage>();

View File

@ -17,15 +17,45 @@
} }
} }
</select> </select>
@* !!!ПОТОМ УДАЛИТЬ *@
@* <select id="status" name="status" class="form-control" asp-items="@(new SelectList(@ViewBag.OrderStatuses,"Id", "TextileName"))"></select> *@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="mb-3">Дата создания:</div> <div class="mb-3">Дата создания:</div>
<div class="mb-3"><input type="datetime-local" id="date" name="date" step="1"></div> <div class="mb-3"><input type="datetime-local" id="date" name="date" step="1"></div>
</div> </div>
<div class="row">
<div class="mb-3">Сумма:</div>
<div class="mb-3"><input type="text" id="sum" name="sum" readonly /></div>
</div>
<div class="row"> <div class="row">
<div class="col-8"></div> <div class="col-8"></div>
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div> <div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
</div> </div>
</form> </form>
@* !!!МБ НАДО БУДЕТ *@
@* <script>
$('#status').on('change', function () {
check();
});
$('#date').on('change', function () {
check();
});
function check() {
var status = $('#status').val();
var date = $('#date').val();
if (status && date) {
$.ajax({
method: "POST",
url: "/Home/Calc",
data: { count: count, textile: textile },
success: function (result) {
$("#sum").val(result);
}
});
};
}
</script> *@

View File

@ -58,6 +58,7 @@
console.log(result); console.log(result);
var localDate = result.dateCreate.toLocaleString(); var localDate = result.dateCreate.toLocaleString();
$("#date").val(localDate); $("#date").val(localDate);
//!!!ТУТ КАК-ТО ВЫВЕСТИ СТАТУС
var orderStatusName = orderStatusNames[result.status + 1]; var orderStatusName = orderStatusNames[result.status + 1];
$("#currentStatus").text(orderStatusName); $("#currentStatus").text(orderStatusName);
$("#sum").val(result.sum); $("#sum").val(result.sum);

View File

@ -46,7 +46,7 @@
}); });
function formatDate(date) { function formatDate(date) {
var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
return new Date(date).toLocaleString('ru-RU', options).replace(',', ''); return new Date(date).toLocaleString('ru-RU', options).replace(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/;
} }
function check() { function check() {
var request = $('#request').val(); var request = $('#request').val();

View File

@ -46,7 +46,7 @@
}); });
function formatDate(date) { function formatDate(date) {
var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
return new Date(date).toLocaleString('ru-RU', options).replace(',', ''); return new Date(date).toLocaleString('ru-RU', options).replace(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/;
} }
function check() { function check() {
var shipment = $('#shipment').val(); var shipment = $('#shipment').val();

View File

@ -1,6 +1,7 @@
@using ComputerShopContracts.ViewModels @using ComputerShopContracts.ViewModels
@model List<OrderViewModel> @model List<OrderViewModel>
@* !!!ТУТ СКОРЕЕ ВСЕГО НАДО ПОМЕНЯТЬ *@
@{ @{
ViewData["Title"] = "Orders"; ViewData["Title"] = "Orders";
} }

View File

@ -10,6 +10,7 @@
<div class="form-group"> <div class="form-group">
<label class="mb-3">Выберите заказы для отчёта:</label> <label class="mb-3">Выберите заказы для отчёта:</label>
<select multiple id="orders" name="orders" class="form-control mb-3"> <select multiple id="orders" name="orders" class="form-control mb-3">
@* !!!ЕСЛИ НЕ БУДЕТ РАБОТАТЬ, УБРАТЬ ОТСЮДА @order.Sum *@
@foreach (var order in ViewBag.Orders) @foreach (var order in ViewBag.Orders)
{ {
<option value="@order.Id">@order.Id) @order.DateCreate; @order.Sum</option> <option value="@order.Id">@order.Id) @order.DateCreate; @order.Sum</option>

View File

@ -45,4 +45,35 @@
} }
check(); check();
$('#show').on('click', (e) => check()); $('#show').on('click', (e) => check());
// $('#order').on('change', function () {
// check();
// });
// var orderStatusNames = [
// "Неизвестен",
// "Принят",
// "Выполняется",
// "Готов",
// "Выдан"
// ];
// function check() {
// var order = $('#order').val();
// if (order) {
// $.ajax({
// method: "GET",
// url: "/Home/GetOrder",
// data: { orderId: order },
// success: function (result) {
// console.log(result);
// var localDate = result.dateCreate.toLocaleString();
// $("#date").val(localDate);
// //!!!ТУТ КАК-ТО ВЫВЕСТИ СТАТУС
// var orderStatusName = orderStatusNames[result.status + 1];
// $("#currentStatus").text(orderStatusName);
// $("#sum").val(result.sum);
// }
// });
// };
// }
</script> </script>

View File

@ -1,6 +1,7 @@
@using ComputerShopContracts.ViewModels @using ComputerShopContracts.ViewModels
@model List<RequestViewModel> @model List<RequestViewModel>
@* !!!ТУТ СКОРЕЕ ВСЕГО НАДО ПОМЕНЯТЬ *@
@{ @{
ViewData["Title"] = "Requests"; ViewData["Title"] = "Requests";
} }
@ -18,6 +19,7 @@
return; return;
} }
// !!!ДОБАВИТЬ ЭТИ МЕТОДЫ В HOME КОНТРОЛЛЕР И ТАКИЕ ЖЕ СТРАНИЦЫ
<p> <p>
<a asp-action="CreateRequest">Создать заявку</a> <a asp-action="CreateRequest">Создать заявку</a>
<span style="margin-left: 20px;"></span> <span style="margin-left: 20px;"></span>

View File

@ -1,6 +1,7 @@
@using ComputerShopContracts.ViewModels @using ComputerShopContracts.ViewModels
@model List<ShipmentViewModel> @model List<ShipmentViewModel>
@* !!!ТУТ СКОРЕЕ ВСЕГО НАДО ПОМЕНЯТЬ *@
@{ @{
ViewData["Title"] = "Shipments"; ViewData["Title"] = "Shipments";
} }
@ -18,6 +19,7 @@
return; return;
} }
// !!!ДОБАВИТЬ ЭТИ МЕТОДЫ В HOME КОНТРОЛЛЕР И ТАКИЕ ЖЕ СТРАНИЦЫ
<p> <p>
<a asp-action="CreateShipment">Создать партию товаров</a> <a asp-action="CreateShipment">Создать партию товаров</a>
<span style="margin-left: 20px;"></span> <span style="margin-left: 20px;"></span>

View File

@ -16,6 +16,7 @@
<option value="@order.Id">@order.Id) @order.DateCreate</option> <option value="@order.Id">@order.Id) @order.DateCreate</option>
} }
</select> </select>
@*<select id="order" name="order" class="form-control" asp-items="@(new SelectList(ViewBag.Orders, "Id", "DateCreate"))"> <option selected disabled>Выберите заказ</option> </select>*@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="mb-3">Новый статус заказа:</label> <label class="mb-3">Новый статус заказа:</label>
@ -33,6 +34,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="mb-3">Текущий статус заказа:</label> <label class="mb-3">Текущий статус заказа:</label>
@* <input class="mb-3" type="text" id="currentStatus" name="currentStatus" readonly /> *@
<span id="currentStatus" name="currentStatus" style="font-weight: bold;" class="mb-3"></span> <span id="currentStatus" name="currentStatus" style="font-weight: bold;" class="mb-3"></span>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -73,6 +75,7 @@
console.log(result); console.log(result);
var localDate = result.dateCreate.toLocaleString(); var localDate = result.dateCreate.toLocaleString();
$("#date").val(localDate); $("#date").val(localDate);
//!!!ТУТ КАК-ТО ВЫВЕСТИ СТАТУС
var orderStatusName = orderStatusNames[result.status + 1]; var orderStatusName = orderStatusNames[result.status + 1];
$("#currentStatus").text(orderStatusName); $("#currentStatus").text(orderStatusName);
$("#sum").val(result.sum); $("#sum").val(result.sum);

View File

@ -41,6 +41,7 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label class="mb-3">Текущие заказы заявки:</label> <label class="mb-3">Текущие заказы заявки:</label>
@* !!!МБ УБРАТЬ disabled *@
<select multiple disabled size="6" id="currentOrders" name="currentOrders" class="form-control"> <select multiple disabled size="6" id="currentOrders" name="currentOrders" class="form-control">
</select> </select>
</div> </div>
@ -61,7 +62,7 @@
}); });
function formatDate(date) { function formatDate(date) {
var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
return new Date(date).toLocaleString('ru-RU', options).replace(',', ''); return new Date(date).toLocaleString('ru-RU', options).replace(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/;
} }
function check() { function check() {
var request = $('#request').val(); var request = $('#request').val();

View File

@ -63,6 +63,14 @@
var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };
return new Date(date).toLocaleString('ru-RU', options).replace(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/; return new Date(date).toLocaleString('ru-RU', options).replace(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/;
} }
// function formatDate(date) {
// // var datePart = new Date(date).toLocaleDateString('ru-RU', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\./g, '').replace(/\g, '.');
// // var timePart = new Date(date).toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' }).replace(/:/g, '');
// // return datePart + ' ' + timePart;
// var datePart = new Date(date).toLocaleDateString('ru-RU', { year: '2-digit', month: '2-digit', day: '2-digit' }).replace(/\./g, '').replace(/\//g, '.');
// var timePart = new Date(date).toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' }).replace(/:/g, '');
// return datePart.replace(/$/, '. ') + timePart;
// }
function check() { function check() {
var shipment = $('#shipment').val(); var shipment = $('#shipment').val();
if (shipment) { if (shipment) {

View File

@ -17,6 +17,7 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@* !!!Тут изменять asp-action и мб удалить "Личные данные" *@
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"> <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1"> <ul class="navbar-nav flex-grow-1">
<li class="nav-item"> <li class="nav-item">
@ -33,6 +34,7 @@
</li> </li>
@* !!!СЮДА ВСТАВИТЬ 2 ССЫЛКИ НА СТРАНИЦЫ С ПОЛУЧЕНИЕМ ОТЧЁТОВ *@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportOrdersAssembliesToFile">Отчёт по заказам в файле</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="ReportOrdersAssembliesToFile">Отчёт по заказам в файле</a>
</li> </li>
@ -63,7 +65,7 @@
</div> </div>
<footer class="border-top footer text-muted"> <footer class="border-top footer text-muted">
<div class="container"> <div class="container">
&copy; 2024 - Сайт магазина компьютерной техники "Ты ж программист" для исполнителя &copy; 2024 - Сайт магазина компьютерной техники "Ты ж программист" для исполнителя - <a asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
</div> </div>
</footer> </footer>
<script src="~/js/site.js" asp-append-version="true"></script> <script src="~/js/site.js" asp-append-version="true"></script>

View File

@ -123,6 +123,17 @@ namespace ComputerShopRestApi.Controllers
} }
//МБ ИЗМЕНИТЬ IEnumerable на List
//!!!ПОТОМ УДАЛИТЬ
//[HttpGet]
//public IEnumerable<string> GetOrderStatuses()
//{
// // Получаем все значения из перечисления и возвращаем как список строк
// var allStatuses = Enum.GetValues(typeof(OrderStatus)).Cast<OrderStatus>().Select(status => status.ToString());
// return allStatuses;
//}
[HttpPost] [HttpPost]
public void CreateOrder(OrderBindingModel model) public void CreateOrder(OrderBindingModel model)
{ {
@ -150,6 +161,7 @@ namespace ComputerShopRestApi.Controllers
} }
} }
//[HttpDelete]
[HttpPost] [HttpPost]
public void DeleteOrder(OrderBindingModel model) public void DeleteOrder(OrderBindingModel model)
{ {

View File

@ -72,6 +72,7 @@ namespace ComputerShopRestApi.Controllers
} }
} }
//параметры для удобного использования в swagger, потом скорее всего будет передаваться RequestBindingModel model
[HttpPost] [HttpPost]
public void ConnectRequestAssembly(RequestBindingModel model) public void ConnectRequestAssembly(RequestBindingModel model)
{ {