Compare commits

..

2 Commits

Author SHA1 Message Date
f24279d9db Слияние после мелких поправок 2024-05-29 19:03:46 +04:00
169c61fff8 поправки 2024-05-29 19:01:27 +04:00
38 changed files with 10 additions and 310 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<OrderSearchModel>*/List<int> selectedOrders) public List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(List<int> selectedOrders)
{ {
return _orderStorage.GetOrdersAssemblies(selectedOrders); return _orderStorage.GetOrdersAssemblies(selectedOrders);
} }
@ -58,7 +58,6 @@ 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)
{ {
@ -67,7 +66,6 @@ namespace ComputerShopBusinessLogic.BusinessLogics
FileName = model.FileName, FileName = model.FileName,
OrderAssemblies = GetReportOrdersAssemblies(model.Ids) OrderAssemblies = GetReportOrdersAssemblies(model.Ids)
}); });
//throw new NotImplementedException();
} }
//!!!ИСПРАВИТЬ //!!!ИСПРАВИТЬ

View File

@ -17,13 +17,11 @@ 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/*, IOrganiserLogic organiserLogic*/) public AbstractMailWorker(ILogger<AbstractMailWorker> logger)
{ {
_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/*, IOrganiserLogic organiserLogic*/) : base(logger/*, organiserLogic*/) { } public MailKitWorker(ILogger<MailKitWorker> logger) : base(logger) { }
protected override async Task SendMailAsync(MailSendInfoBindingModel info) protected override async Task SendMailAsync(MailSendInfoBindingModel info)
{ {

View File

@ -14,7 +14,6 @@ namespace ComputerShopBusinessLogic.OfficePackage
{ {
CreateExcel(info); CreateExcel(info);
//!!!2 абзаца ниже - настройка заголовков, исправить скорее всего
InsertCellInWorksheet(new ExcelCellParameters InsertCellInWorksheet(new ExcelCellParameters
{ {
ColumnName = "A", ColumnName = "A",
@ -23,12 +22,6 @@ 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",
@ -142,48 +135,8 @@ 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,7 +15,6 @@ 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
@ -27,7 +26,6 @@ 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
@ -56,8 +54,6 @@ 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,10 +45,6 @@ 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,8 +10,6 @@ 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,9 +183,6 @@ 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>();
@ -193,10 +190,6 @@ 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,7 +101,6 @@ 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</*OrderSearchModel*/int> selectedOrders); List<ReportOrderAssemblyViewModel> GetReportOrdersAssemblies(List<int> selectedOrders);
/// <summary> /// <summary>
/// Получение отчёта для почты /// Получение отчёта для почты

View File

@ -11,7 +11,6 @@ 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/*OrderSearchModel*/> model); List<ReportOrderAssemblyViewModel> GetOrdersAssemblies(List<int> model);
List<ReportOrdersViewModel> GetOrdersInfoByDates(ReportBindingModel report); List<ReportOrdersViewModel> GetOrdersInfoByDates(ReportBindingModel report);
} }
} }

View File

@ -20,6 +20,5 @@ 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,9 +39,5 @@ 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,11 +58,8 @@ 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,7 +15,6 @@ 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();
@ -156,11 +155,9 @@ 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,7 +18,6 @@ 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,7 +76,6 @@ namespace ComputerShopDatabaseImplement.Models
ClientFIO = model.ClientFIO; ClientFIO = model.ClientFIO;
} }
DateRequest = model.DateRequest; DateRequest = model.DateRequest;
//DateMake не обновляю, потому что странно менять дату оформления заявки после её создания
//Обновление ссылки на сборку (assemblyId) отдельным методом //Обновление ссылки на сборку (assemblyId) отдельным методом
} }

View File

@ -90,7 +90,6 @@ 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,11 +18,6 @@ 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,12 +27,6 @@ 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,12 +29,11 @@ namespace ComputerShopImplementerApp.Controllers
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
return View(/*APIUser.GetRequest<List<OrderViewModel>>($"api/main/getorders?userId={APIUser.User.Id}")*/); return View();
} }
// ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ // ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ ЗАКАЗЫ
//!!!МБ ДОБАВИТЬ [HttpGet]
public IActionResult Orders() public IActionResult Orders()
{ {
if (APIUser.User == null) if (APIUser.User == null)
@ -68,8 +67,6 @@ namespace ComputerShopImplementerApp.Controllers
[HttpGet] [HttpGet]
public IActionResult CreateOrder() public IActionResult CreateOrder()
{ {
//!!!ПОТОМ УДАЛИТЬ
//ViewBag.OrderStatuses = APIUser.GetRequest<List<String>>("api/order/getorderstatuses");
return View(); return View();
} }
@ -81,11 +78,6 @@ 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
@ -97,15 +89,6 @@ namespace ComputerShopImplementerApp.Controllers
}); });
} }
Response.Redirect("Orders"); Response.Redirect("Orders");
//try
//{
//}
//catch (Exception)
//{
// Response.Redirect("CreateOrder");
//}
} }
@ -122,7 +105,6 @@ 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)
{ {
@ -130,14 +112,6 @@ 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
@ -161,7 +135,6 @@ 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();
} }
@ -171,7 +144,6 @@ 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)
@ -207,24 +179,13 @@ 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;
//}
} }
@ -252,8 +213,6 @@ 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)
{ {
@ -269,7 +228,6 @@ namespace ComputerShopImplementerApp.Controllers
} }
//!!!МБ СДЕЛАТЬ ПО АНАЛОГИИ С public async Task<IActionResult> Shipments()
[HttpGet] [HttpGet]
public async Task<IActionResult> UpdateShipment() public async Task<IActionResult> UpdateShipment()
{ {
@ -314,28 +272,12 @@ 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)
{ {
@ -359,18 +301,6 @@ 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)
@ -378,8 +308,6 @@ 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);
} }
@ -391,7 +319,6 @@ 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)
{ {
@ -420,7 +347,6 @@ 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>();
@ -448,7 +374,6 @@ 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}");
@ -491,7 +416,6 @@ 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();
} }
@ -556,7 +480,6 @@ 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();
} }
@ -595,7 +518,6 @@ namespace ComputerShopImplementerApp.Controllers
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx" FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx"
}); });
return GetWordFile(); return GetWordFile();
//Response.Redirect("GetWordFile");
} }
if (type == "xlsx") if (type == "xlsx")
@ -606,7 +528,6 @@ namespace ComputerShopImplementerApp.Controllers
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx" FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx"
}); });
return GetExcelFile(); return GetExcelFile();
//Response.Redirect("GetExcelFile");
} }
} }
return Redirect("Index"); return Redirect("Index");
@ -620,8 +541,6 @@ 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();
} }
@ -642,7 +561,6 @@ 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 заказа
@ -666,11 +584,8 @@ 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>";
@ -683,13 +598,11 @@ 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>";
@ -705,7 +618,6 @@ 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>";
@ -716,7 +628,6 @@ 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>";
} }
@ -734,10 +645,6 @@ 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
@ -749,7 +656,6 @@ 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()
@ -818,16 +724,6 @@ 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,12 +10,6 @@ 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,45 +17,15 @@
} }
} }
</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,7 +58,6 @@
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(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/; return new Date(date).toLocaleString('ru-RU', options).replace(',', '');
} }
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(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/; return new Date(date).toLocaleString('ru-RU', options).replace(',', '');
} }
function check() { function check() {
var shipment = $('#shipment').val(); var shipment = $('#shipment').val();

View File

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

View File

@ -10,7 +10,6 @@
<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,35 +45,4 @@
} }
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,7 +1,6 @@
@using ComputerShopContracts.ViewModels @using ComputerShopContracts.ViewModels
@model List<RequestViewModel> @model List<RequestViewModel>
@* !!!ТУТ СКОРЕЕ ВСЕГО НАДО ПОМЕНЯТЬ *@
@{ @{
ViewData["Title"] = "Requests"; ViewData["Title"] = "Requests";
} }
@ -19,7 +18,6 @@
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,7 +1,6 @@
@using ComputerShopContracts.ViewModels @using ComputerShopContracts.ViewModels
@model List<ShipmentViewModel> @model List<ShipmentViewModel>
@* !!!ТУТ СКОРЕЕ ВСЕГО НАДО ПОМЕНЯТЬ *@
@{ @{
ViewData["Title"] = "Shipments"; ViewData["Title"] = "Shipments";
} }
@ -19,7 +18,6 @@
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,7 +16,6 @@
<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>
@ -34,7 +33,6 @@
</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">
@ -75,7 +73,6 @@
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,7 +41,6 @@
<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>
@ -62,7 +61,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(',', '')/*.replace(/\./g, '').replace(/\s/g, '.')*/; return new Date(date).toLocaleString('ru-RU', options).replace(',', '');
} }
function check() { function check() {
var request = $('#request').val(); var request = $('#request').val();

View File

@ -63,14 +63,6 @@
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,7 +17,6 @@
<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">
@ -34,7 +33,6 @@
</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>
@ -65,7 +63,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 - Сайт магазина компьютерной техники "Ты ж программист" для исполнителя - <a asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a> &copy; 2024 - Сайт магазина компьютерной техники "Ты ж программист" для исполнителя
</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

@ -122,17 +122,6 @@ 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)
@ -161,7 +150,6 @@ namespace ComputerShopRestApi.Controllers
} }
} }
//[HttpDelete]
[HttpPost] [HttpPost]
public void DeleteOrder(OrderBindingModel model) public void DeleteOrder(OrderBindingModel model)
{ {

View File

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