Вроде работает

This commit is contained in:
ujijrujijr 2024-05-28 22:49:02 +04:00
parent a460ea0308
commit e1e37a6611
16 changed files with 377 additions and 346 deletions

View File

@ -8,6 +8,7 @@ using ComputerShopDataModels.Models;
using ComputerShopContracts.SearchModels;
using ComputerShopContracts.BusinessLogicContracts;
using DocumentFormat.OpenXml.Bibliography;
using Microsoft.AspNetCore.DataProtection.Repositories;
namespace ComputerShopImplementerApp.Controllers
{
@ -46,16 +47,19 @@ namespace ComputerShopImplementerApp.Controllers
[HttpGet]
public OrderViewModel GetOrder(int orderId)
{
if (APIUser.User == null)
{
throw new Exception("Необходима авторизация");
}
var result = APIUser.GetRequest<OrderViewModel>($"api/order/getorder?id={orderId}");
if (result == null)
{
return default;
}
return result;
if (APIUser.User == null)
{
Response.Redirect("Enter");
}
var result = APIUser.GetRequest<OrderViewModel>($"api/order/getorder?id={orderId}");
if (result == null)
{
return default;
}
return result;
}
@ -81,14 +85,27 @@ namespace ComputerShopImplementerApp.Controllers
//{
// throw new Exception("Количество и сумма должны быть больше 0");
//}
APIUser.PostRequest("api/order/createorder", new OrderBindingModel
//if ()
if (date != DateTime.MinValue)
{
UserId = APIUser.User.Id,
Status = status,
DateCreate = date,
Sum = 0
});
APIUser.PostRequest("api/order/createorder", new OrderBindingModel
{
UserId = APIUser.User.Id,
Status = status,
DateCreate = date,
Sum = 0
});
}
Response.Redirect("Orders");
//try
//{
//}
//catch (Exception)
//{
// Response.Redirect("CreateOrder");
//}
}
@ -111,28 +128,27 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Response.Redirect("~/Home/Entry");
}
if (order == null)
{
throw new Exception("Выберите заказ для изменения");
}
if (status == null)
{
throw new Exception("Выберите статус для заказа");
}
//if (count <= 0)
//if (order == null)
//{
// throw new Exception("Количество и сумма должны быть больше 0");
// throw new Exception("Выберите заказ для изменения");
//}
APIUser.PostRequest("api/order/updateorder", new OrderBindingModel
//if (status == null)
//{
// throw new Exception("Выберите статус для заказа");
//}
if (order > 0 && date != DateTime.MinValue)
{
Id = order,
UserId = APIUser.User.Id,
Status = status,
DateCreate = date,
Sum = sum
});
APIUser.PostRequest("api/order/updateorder", new OrderBindingModel
{
Id = order,
UserId = APIUser.User.Id,
Status = status,
DateCreate = date,
Sum = sum
});
}
Response.Redirect("Orders");
}
@ -154,16 +170,17 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
}
//if (count <= 0)
//{
// throw new Exception("Количество и сумма должны быть больше 0");
//}
APIUser.PostRequest("api/order/deleteorder", new OrderBindingModel
if (order > 0)
{
Id = order
});
APIUser.PostRequest("api/order/deleteorder", new OrderBindingModel
{
Id = order
});
}
Response.Redirect("Orders");
}
@ -189,7 +206,8 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Необходима авторизация");
Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
}
//GetRequestShipmentAsync
var result = await APIUser.GetRequestShipmentAsync<ShipmentViewModel>($"api/shipment/getshipment?id={shipmentId}");
@ -198,6 +216,15 @@ namespace ComputerShopImplementerApp.Controllers
return default;
}
return result;
//try
//{
//}
//catch (Exception)
//{
// Response.Redirect("Shipments");
// return default;
//}
}
@ -206,7 +233,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
}
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
return View();
@ -218,7 +245,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
}
// Создаем словарь из выбранных заказов
var selectedOrders = new Dictionary<int, IOrderModel>();
@ -228,14 +255,16 @@ namespace ComputerShopImplementerApp.Controllers
//var orderModel = APIUser.GetRequest<OrderViewModel>($"api/order/getorder?id={orderId}");
//selectedOrders.Add(orderId, orderModel);
}
APIUser.PostRequest("api/shipment/createshipment", new ShipmentBindingModel
if (!string.IsNullOrEmpty(providerName) && date != DateTime.MinValue && APIUser.User != null)
{
UserId = APIUser.User.Id,
ProviderName = providerName,
DateShipment = date,
ShipmentOrders = selectedOrders
});
APIUser.PostRequest("api/shipment/createshipment", new ShipmentBindingModel
{
UserId = APIUser.User.Id,
ProviderName = providerName,
DateShipment = date,
ShipmentOrders = selectedOrders
});
}
Response.Redirect("Shipments");
}
@ -246,7 +275,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
}
ViewBag.Shipments = await APIUser.GetRequestShipmentAsync<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={APIUser.User.Id}");
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
@ -258,23 +287,24 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
}
// Создаем словарь из выбранных заказов
var selectedOrders = new Dictionary<int, IOrderModel>();
foreach (var orderId in orders)
{
selectedOrders.Add(orderId, new OrderSearchModel { Id = orderId } as IOrderModel);
}
APIUser.PostRequest("api/shipment/updateshipment", new ShipmentBindingModel
if (shipment > 0 && !string.IsNullOrEmpty(providerName) && date != DateTime.MinValue && APIUser.User != null)
{
Id = shipment,
UserId = APIUser.User.Id,
ProviderName = providerName,
DateShipment = date,
ShipmentOrders = selectedOrders
});
APIUser.PostRequest("api/shipment/updateshipment", new ShipmentBindingModel
{
Id = shipment,
UserId = APIUser.User.Id,
ProviderName = providerName,
DateShipment = date,
ShipmentOrders = selectedOrders
});
}
Response.Redirect("Shipments");
}
@ -283,7 +313,8 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
}
ViewBag.Shipments = await APIUser.GetRequestShipmentAsync<List<ShipmentViewModel>>($"api/shipment/getshipments?userId={APIUser.User.Id}");
return View();
@ -310,18 +341,22 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
}
await APIUser.PostRequestAsync("api/shipment/deleteshipment", new ShipmentBindingModel
if (shipment > 0)
{
Id = shipment
});
return RedirectToAction("Shipments");
await APIUser.PostRequestAsync("api/shipment/deleteshipment", new ShipmentBindingModel
{
Id = shipment
});
}
return Redirect("Shipments");
}
// ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ ЗАЯВКИ НА СБОРКИ
@ -354,7 +389,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Необходима авторизация");
Response.Redirect("~/Home/Enter");
}
//GetRequestShipmentAsync
var result = await APIUser.GetRequestRequestAsync<RequestViewModel>($"api/request/getrequest?id={requestId}");
@ -372,7 +407,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
}
ViewBag.Orders = APIUser.GetRequest<List<OrderViewModel>>($"api/order/getorders?userId={APIUser.User.Id}");
return View();
@ -384,7 +419,8 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
}
// Создаем словарь из выбранных заказов
var selectedOrders = new Dictionary<int, IOrderModel>();
@ -392,14 +428,16 @@ namespace ComputerShopImplementerApp.Controllers
{
selectedOrders.Add(orderId, new OrderSearchModel { Id = orderId } as IOrderModel);
}
APIUser.PostRequest("api/request/createrequest", new RequestBindingModel
if (!string.IsNullOrEmpty(clientFIO) && date != DateTime.MinValue)
{
UserId = APIUser.User.Id,
ClientFIO = clientFIO,
DateRequest = date,
RequestOrders = selectedOrders
});
APIUser.PostRequest("api/request/createrequest", new RequestBindingModel
{
UserId = APIUser.User.Id,
ClientFIO = clientFIO,
DateRequest = date,
RequestOrders = selectedOrders
});
}
Response.Redirect("Requests");
}
@ -409,7 +447,8 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
//throw new Exception("Вход только авторизованным");
}
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}");
@ -421,23 +460,25 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Response.Redirect("~/Home/Enter");
}
// Создаем словарь из выбранных заказов
var selectedOrders = new Dictionary<int, IOrderModel>();
foreach (var orderId in orders)
{
selectedOrders.Add(orderId, new OrderSearchModel { Id = orderId } as IOrderModel);
}
APIUser.PostRequest("api/request/updaterequest", new RequestBindingModel
if (request > 0 && !string.IsNullOrEmpty(clientFIO) && date != DateTime.MinValue)
{
Id = request,
UserId = APIUser.User.Id,
ClientFIO = clientFIO,
DateRequest = date,
RequestOrders = selectedOrders
});
APIUser.PostRequest("api/request/updaterequest", new RequestBindingModel
{
Id = request,
UserId = APIUser.User.Id,
ClientFIO = clientFIO,
DateRequest = date,
RequestOrders = selectedOrders
});
}
Response.Redirect("Requests");
}
@ -447,7 +488,7 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
return Redirect("~/Home/Enter");
}
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}");
@ -460,14 +501,16 @@ namespace ComputerShopImplementerApp.Controllers
{
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
Redirect("~/Home/Enter");
}
APIUser.PostRequest("api/request/connectRequestAssembly", new RequestBindingModel
if (request > 0 && assembly > 0)
{
Id = request,
AssemblyId = assembly
});
APIUser.PostRequest("api/request/connectRequestAssembly", new RequestBindingModel
{
Id = request,
AssemblyId = assembly
});
}
Response.Redirect("Requests");
}
@ -492,10 +535,13 @@ namespace ComputerShopImplementerApp.Controllers
{
throw new Exception("Вход только авторизованным");
}
await APIUser.PostRequestAsync("api/request/deleterequest", new RequestBindingModel
if (request > 0)
{
Id = request
});
await APIUser.PostRequestAsync("api/request/deleterequest", new RequestBindingModel
{
Id = request
});
}
return RedirectToAction("Requests");
}
@ -520,44 +566,38 @@ namespace ComputerShopImplementerApp.Controllers
if (APIUser.User == null)
{
Redirect("Index");
throw new Exception("Вход только авторизованным");
}
if (orders.Length <= 0)
if (orders.Length > 0 && !string.IsNullOrEmpty(type))
{
throw new Exception("Выберите хотя бы 1 заказ");
}
if (string.IsNullOrEmpty(type))
{
throw new Exception("Неверный тип отчета");
}
//Преобразование массива в список
List<int> ids = new List<int>();
foreach (var item in orders)
{
ids.Add(item);
}
//Преобразование массива в список
List<int> ids = new List<int>();
foreach (var item in orders)
{
ids.Add(item);
}
if (type == "docx")
{
APIUser.PostRequest("api/order/createreporttowordfile", new ReportBindingModel
{
Ids = ids,
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx"
});
Response.Redirect("Index");
}
if (type == "docx")
{
APIUser.PostRequest("api/order/createreporttowordfile", new ReportBindingModel
{
Ids = ids,
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.docx"
});
Response.Redirect("Index");
}
if (type == "xlsx")
{
APIUser.PostRequest("api/order/createreporttoexcelfile", new ReportBindingModel
{
Ids = ids,
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx"
});
Response.Redirect("Index");
}
}
if (type == "xlsx")
{
APIUser.PostRequest("api/order/createreporttoexcelfile", new ReportBindingModel
{
Ids = ids,
FileName = "C:\\!КУРСОВАЯ\\Сборки по выбранным заказам.xlsx"
});
Response.Redirect("Index");
}
}
Response.Redirect("Index");
}
[HttpGet]
@ -579,103 +619,99 @@ namespace ComputerShopImplementerApp.Controllers
{
throw new Exception("Вход только авторизованным");
}
List<ReportOrdersViewModel> result;
try
if (dateFrom != DateTime.MinValue && dateTo != DateTime.MinValue)
{
List<ReportOrdersViewModel> result;
result = _logic.GetReportOrdersByDates(new ReportBindingModel
{
UserId = APIUser.User.Id,
DateFrom = dateFrom,
DateTo = dateTo
});
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка создания отчета");
throw;
}
string table = "";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС u-table-entity
table += $"<table class=\"u-table-entity\">";
table += "<colgroup>";
//ID заказа
table += "<col width=\"5%\" />";
//Дата заказа
table += "<col width=\"10%\" />";
//Стоимость заказа
table += "<col width=\"10%\" />";
//Статус заказа
table += "<col width=\"10%\" />";
//ID заявки
table += "<col width=\"5%\" />";
//ФИО клиента
table += "<col width=\"15%\" />";
//Дата заявки
table += "<col width=\"10%\" />";
//Название сборки
table += "<col width=\"15%\" />";
//Категория сборки
table += "<col width=\"10%\" />";
//Цена сборки
table += "<col width=\"10%\" />";
table += "</colgroup>";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС
table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">";
//МБ ИЗМЕНИТЬ ВЫСОТУ
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\">Дата заказа</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\">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>";
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 += "</thead>";
//МБ НЕ ПРИСВАИВАТЬ КЛАСС ИЛИ СДЕЛАТЬ ПЕРЕД ВНУТРЕННИМ ЦИКЛОМ
table += "<tbody class=\"u-table-body\">";
foreach (var order in result)
{
if (order.RequestsAssemblies.Count < 1)
string table = "";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС u-table-entity
table += $"<table class=\"u-table-entity\">";
table += "<colgroup>";
//ID заказа
table += "<col width=\"5%\" />";
//Дата заказа
table += "<col width=\"10%\" />";
//Стоимость заказа
table += "<col width=\"10%\" />";
//Статус заказа
table += "<col width=\"10%\" />";
//ID заявки
table += "<col width=\"5%\" />";
//ФИО клиента
table += "<col width=\"15%\" />";
//Дата заявки
table += "<col width=\"10%\" />";
//Название сборки
table += "<col width=\"15%\" />";
//Категория сборки
table += "<col width=\"10%\" />";
//Цена сборки
table += "<col width=\"10%\" />";
table += "</colgroup>";
//МБ НЕ НДО ПРИСВАИВАТЬ КЛАСС
table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">";
//МБ ИЗМЕНИТЬ ВЫСОТУ
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\">Дата заказа</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\">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>";
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 += "</thead>";
//МБ НЕ ПРИСВАИВАТЬ КЛАСС ИЛИ СДЕЛАТЬ ПЕРЕД ВНУТРЕННИМ ЦИКЛОМ
table += "<tbody class=\"u-table-body\">";
foreach (var order in result)
{
//МБ ПОМЕНЯТЬ ВЫСОТУ
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-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.OrderSum.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.OrderStatus.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\">{"Заказ без заявок"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</td>";
table += "</tr>";
}
foreach (var request in order.RequestsAssemblies)
{
//МБ ПОМЕНЯТЬ ВЫСОТУ
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.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.OrderSum.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.OrderStatus.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.RequestId.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.ClientFIO.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.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.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 += "</tr>";
if (order.RequestsAssemblies.Count < 1)
{
//МБ ПОМЕНЯТЬ ВЫСОТУ
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-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.OrderSum.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.OrderStatus.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\">{"Заказ без заявок"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</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\">{"Неизвестно"}</td>";
table += "</tr>";
}
foreach (var request in order.RequestsAssemblies)
{
//МБ ПОМЕНЯТЬ ВЫСОТУ
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.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.OrderSum.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.OrderStatus.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.RequestId.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.ClientFIO.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.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.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 += "</tr>";
}
}
table += "</table>";
return table;
}
table += "</table>";
return table;
return "";
}
[HttpPost]
@ -689,20 +725,23 @@ namespace ComputerShopImplementerApp.Controllers
//{
// throw new Exception("Email пуст");
//}
APIUser.PostRequest("api/order/CreateReportToPDFFile", new ReportBindingModel
if (dateFrom != DateTime.MinValue && dateTo != DateTime.MinValue)
{
FileName = "C:\\!КУРСОВАЯ\\Отчёт за период.pdf",
DateFrom = dateFrom,
DateTo = dateTo,
UserId = APIUser.User.Id
});
APIUser.PostRequest("api/order/SendPDFToMail", new MailSendInfoBindingModel
{
//!!!МБ СЮДА ПЕРЕДАВАТЬ ПОЧТУ, КОТОРУЮ ВВОДЯТ НА СТРАНИЦЕ
MailAddress = APIUser.User.Email,
Subject = "Отчет за период",
Text = "Отчет по заказам с " + dateFrom.ToShortDateString() + " по " + dateTo.ToShortDateString()
});
APIUser.PostRequest("api/order/CreateReportToPDFFile", new ReportBindingModel
{
FileName = "C:\\!КУРСОВАЯ\\Отчёт за период.pdf",
DateFrom = dateFrom,
DateTo = dateTo,
UserId = APIUser.User.Id
});
APIUser.PostRequest("api/order/SendPDFToMail", new MailSendInfoBindingModel
{
//!!!МБ СЮДА ПЕРЕДАВАТЬ ПОЧТУ, КОТОРУЮ ВВОДЯТ НА СТРАНИЦЕ
MailAddress = APIUser.User.Email,
Subject = "Отчет за период",
Text = "Отчет по заказам с " + dateFrom.ToShortDateString() + " по " + dateTo.ToShortDateString()
});
}
Response.Redirect("Index");
}
@ -722,26 +761,33 @@ namespace ComputerShopImplementerApp.Controllers
[HttpPost]
public void Privacy(string login, string password, string email)
{
if (APIUser.User == null)
try
{
throw new Exception("Вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
{
throw new Exception("Введите логин, пароль и почту");
}
APIUser.PostRequest("api/user/updatedata", new UserBindingModel
{
Id = APIUser.User.Id,
Login = login,
Password = password,
Email = email
});
if (APIUser.User == null)
{
throw new Exception("Вход только авторизованным");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
{
throw new Exception("Введите логин, пароль и почту");
}
APIUser.PostRequest("api/user/updatedata", new UserBindingModel
{
Id = APIUser.User.Id,
Login = login,
Password = password,
Email = email
});
APIUser.User.Login = login;
APIUser.User.Password = password;
APIUser.User.Email = email;
Response.Redirect("Index");
APIUser.User.Login = login;
APIUser.User.Password = password;
APIUser.User.Email = email;
Response.Redirect("Index");
}
catch (Exception)
{
Response.Redirect("Index");
}
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
@ -759,6 +805,16 @@ namespace ComputerShopImplementerApp.Controllers
[HttpPost]
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
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
@ -787,18 +843,25 @@ namespace ComputerShopImplementerApp.Controllers
[HttpPost]
public void Register(string login, string password, string email)
{
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
try
{
throw new Exception("Введите логин, пароль и почту");
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(email))
{
throw new Exception("Введите логин, пароль и почту");
}
APIUser.PostRequest("api/user/registerimplementer", new UserBindingModel
{
Login = login,
Password = password,
Email = email
});
Response.Redirect("Enter");
return;
}
APIUser.PostRequest("api/user/registerimplementer", new UserBindingModel
catch (Exception)
{
Login = login,
Password = password,
Email = email
});
Response.Redirect("Enter");
return;
Response.Redirect("Register");
}
}
}
}

View File

@ -10,11 +10,11 @@
<div class="col-md-6">
<div class="form-group">
<label class="mb-3">Выберите завку:</label>
<select id="request" name="request" class="form-control">
<select id="request" name="request" class="form-control mb-3">
<option selected disabled>Выберите заявку</option>
@foreach (var request in ViewBag.Requests)
{
<option value="@request.Id">@request.DateRequest</option>
<option value="@request.Id">@request.Id) @request.DateRequest</option>
}
</select>
</div>
@ -23,7 +23,7 @@
<div class="col-md-6">
<div class="form-group">
<label class="mb-3">Выберите сборку:</label>
<select id="assembly" name="assembly" class="form-control">
<select id="assembly" name="assembly" class="form-control mb-3">
<option selected disabled>Выберите сборку</option>
@foreach (var assembly in ViewBag.Assemblies)
{
@ -87,9 +87,10 @@
if (result.requestOrders.hasOwnProperty(orderId)) {
var order = result.requestOrders[orderId];
var localDate = formatDate(order.dateCreate);
var optionText = orderId + ') ' + localDate;
$('#currentOrders').append($('<option>', {
value: orderId,
text: localDate
text: optionText
}));
}
}

View File

@ -7,8 +7,8 @@
</div>
<form method="post">
<div class="row">
<div class="col-4 mb-3">Статус заказа:</div>
<div class="col-8 mb-3">
<div class="mb-3">Статус заказа:</div>
<div class="mb-3">
<select id="status" name="status" class="form-control">
@{
foreach (var status in Enum.GetValues(typeof(OrderStatus)))
@ -22,12 +22,12 @@
</div>
</div>
<div class="row">
<div class="col-4 mb-3">Дата создания:</div>
<div class="col-8 mb-3"><input type="datetime-local" id="date" name="date" step="1"></div>
<div class="mb-3">Дата создания:</div>
<div class="mb-3"><input type="datetime-local" id="date" name="date" step="1"></div>
</div>
<div class="row mb-3">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></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="col-8"></div>

View File

@ -20,7 +20,7 @@
@{
foreach (var order in ViewBag.Orders)
{
<option value="@order.Id">@order.DateCreate</option>
<option value="@order.Id">@order.Id) @order.DateCreate</option>
}
}
</select>

View File

@ -13,46 +13,22 @@
<option selected disabled>Выберите заказ</option>
@foreach (var order in ViewBag.Orders)
{
<option value="@order.Id">@order.DateCreate</option>
<option value="@order.Id">@order.Id) @order.DateCreate</option>
}
</select>
@*<select id="order" name="order" class="form-control" asp-items="@(new SelectList(ViewBag.Orders, "Id", "DateCreate"))"> <option selected disabled>Выберите заказ</option> </select>*@
</div>
<div class="form-group">
<label class="mb-3">Текущий статус заказа:</label>
@* <input class="mb-3" type="text" id="currentStatus" name="currentStatus" readonly /> *@
<span id="currentStatus" style="font-weight: bold;"></span>
<span id="currentStatus" style="font-weight: bold;" class="mb-3"></span>
</div>
@* <div class="row">
<div class="col-4 mb-3">Статус заказа:</div>
<div class="col-8 mb-3">
<select id="status" name="status" class="form-control">
@{
foreach (var status in Enum.GetValues(typeof(OrderStatus)))
{
<option value="@status">@status</option>
}
}
</select>
</div>
</div> *@
<div class="form-group">
<label class="mb-3">Дата создания:</label>
@* <div class="col-8 mb-3"> *@<input type="datetime-local" id="date" name="date" class="mb-3 form-control">@* </div> *@
<input type="datetime-local" id="date" name="date" class="mb-3 form-control">
</div>
@* <div class="row">
<div class="col-4 mb-3">Дата создания:</div>
<div class="col-8 mb-3"><input type="datetime-local" id="date" name="date"></div>
</div> *@
<div class="form-group">
<label>Сумма:</label>
@* <div class="col-8"><input type="text" id="sum" name="sum" readonly /></div> *@
<input type="number" id="sum" name="sum" readonly />
</div>
@* <div class="row mb-3">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div> *@
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Удалить" class="btn btn-primary" /></div>

View File

@ -7,11 +7,11 @@
<form method="post">
<div class="form-group">
<label class="mb-3">Выберите завку для удаления:</label>
<select id="request" name="request" class="form-control">
<select id="request" name="request" class="form-control mb-3">
<option selected disabled>Выберите заявку</option>
@foreach (var request in ViewBag.Requests)
{
<option value="@request.Id">@request.DateRequest</option>
<option value="@request.Id">@request.Id) @request.DateRequest</option>
}
</select>
</div>
@ -67,9 +67,10 @@
if (result.requestOrders.hasOwnProperty(orderId)) {
var order = result.requestOrders[orderId];
var localDate = formatDate(order.dateCreate);
var optionText = orderId + ') ' + localDate;
$('#currentOrders').append($('<option>', {
value: orderId,
text: localDate
text: optionText
}));
}
}

View File

@ -7,11 +7,11 @@
<form method="post">
<div class="form-group">
<label class="mb-3">Партия товаров для удаления:</label>
<select id="shipment" name="shipment" class="form-control">
<select id="shipment" name="shipment" class="form-control mb-3">
<option selected disabled>Выберите партию товаров</option>
@foreach (var shipment in ViewBag.Shipments)
{
<option value="@shipment.Id">@shipment.DateShipment</option>
<option value="@shipment.Id">@shipment.Id) @shipment.DateShipment</option>
}
</select>
</div>
@ -67,9 +67,10 @@
if (result.shipmentOrders.hasOwnProperty(orderId)) {
var order = result.shipmentOrders[orderId];
var localDate = formatDate(order.dateCreate);
var optionText = orderId + ') ' + localDate;
$('#currentOrders').append($('<option>', {
value: orderId,
text: localDate
text: optionText
}));
}
}

View File

@ -3,6 +3,6 @@
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<h1 class="display-4">Приветствуем Вас на сайте компьютерной техники "Ты ж программист" для исполнителя</h1>
<p>Выберите необходимое действие в шапке страницы</p>
</div>

View File

@ -21,7 +21,9 @@
<p>
<a asp-action="CreateOrder">Создать заказ</a>
<span style="margin-left: 20px;"></span>
<a asp-action="UpdateOrder">Обновить заказ</a>
<span style="margin-left: 20px;"></span>
<a asp-action="DeleteOrder">Удалить заказ</a>
</p>
<table class="table">

View File

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

View File

@ -20,7 +20,7 @@
</div>
</form>
<div class="row">
<button class="mt-5" type="button" id="show">Вывести здесь</button>
<button class="mt-4 btn btn-primary" type="button" id="show">Вывести здесь</button>
</div>
<div class="mt-3" id="report">
</div>

View File

@ -22,8 +22,11 @@
// !!!ДОБАВИТЬ ЭТИ МЕТОДЫ В HOME КОНТРОЛЛЕР И ТАКИЕ ЖЕ СТРАНИЦЫ
<p>
<a asp-action="CreateRequest">Создать заявку</a>
<span style="margin-left: 20px;"></span>
<a asp-action="ConnectRequestAssembly">Связать заявку со сборкой</a>
<span style="margin-left: 20px;"></span>
<a asp-action="UpdateRequest">Обновить заявку</a>
<span style="margin-left: 20px;"></span>
<a asp-action="DeleteRequest">Удалить заявку</a>
</p>
<table class="table">

View File

@ -22,7 +22,9 @@
// !!!ДОБАВИТЬ ЭТИ МЕТОДЫ В HOME КОНТРОЛЛЕР И ТАКИЕ ЖЕ СТРАНИЦЫ
<p>
<a asp-action="CreateShipment">Создать партию товаров</a>
<span style="margin-left: 20px;"></span>
<a asp-action="UpdateShipment">Обновить партию товаров</a>
<span style="margin-left: 20px;"></span>
<a asp-action="DeleteShipment">Удалить партию товаров</a>
</p>
<table class="table">

View File

@ -9,11 +9,11 @@
</div>
<div class="form-group">
<label class="mb-3">Выберите заказ для изменения:</label>
<select id="order" name="order" class="form-control">
<select id="order" name="order" class="form-control mb-3">
<option selected disabled>Выберите заказ</option>
@foreach (var order in ViewBag.Orders)
{
<option value="@order.Id">@order.DateCreate</option>
<option value="@order.Id">@order.Id) @order.DateCreate</option>
}
</select>
@*<select id="order" name="order" class="form-control" asp-items="@(new SelectList(ViewBag.Orders, "Id", "DateCreate"))"> <option selected disabled>Выберите заказ</option> </select>*@
@ -35,38 +35,17 @@
<div class="form-group">
<label class="mb-3">Текущий статус заказа:</label>
@* <input class="mb-3" type="text" id="currentStatus" name="currentStatus" readonly /> *@
<span id="currentStatus" style="font-weight: bold;"></span>
<span id="currentStatus" name="currentStatus" style="font-weight: bold;" class="mb-3"></span>
</div>
@* <div class="row">
<div class="col-4 mb-3">Статус заказа:</div>
<div class="col-8 mb-3">
<select id="status" name="status" class="form-control">
@{
foreach (var status in Enum.GetValues(typeof(OrderStatus)))
{
<option value="@status">@status</option>
}
}
</select>
</div>
</div> *@
<div class="form-group">
<label class="mb-3">Дата создания:</label>
<input type="datetime-local" id="date" name="date" class="mb-3 form-control" step="1">
</div>
@* <div class="row">
<div class="col-4 mb-3">Дата создания:</div>
<div class="col-8 mb-3"><input type="datetime-local" id="date" name="date"></div>
</div> *@
<div class="form-group">
<label>Сумма:</label>
@* <div class="col-8"><input type="text" id="sum" name="sum" readonly /></div> *@
<input type="number" id="sum" name="sum" readonly />
<input type="number" id="sum" name="sum" readonly class="mb-3"/>
</div>
@* <div class="row mb-3">
<div class="col-4">Сумма:</div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly /></div>
</div> *@
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Обновить" class="btn btn-primary" /></div>

View File

@ -7,11 +7,11 @@
<form method="post">
<div class="form-group">
<label class="mb-3">Выберите завку для изменения:</label>
<select id="request" name="request" class="form-control">
<select id="request" name="request" class="form-control mb-3">
<option selected disabled>Выберите заявку</option>
@foreach (var request in ViewBag.Requests)
{
<option value="@request.Id">@request.DateRequest</option>
<option value="@request.Id">@request.Id) @request.DateRequest</option>
}
</select>
</div>
@ -32,7 +32,7 @@
@{
foreach (var order in ViewBag.Orders)
{
<option value="@order.Id">@order.DateCreate</option>
<option value="@order.Id">@order.Id) @order.DateCreate</option>
}
}
</select>
@ -83,9 +83,11 @@
if (result.requestOrders.hasOwnProperty(orderId)) {
var order = result.requestOrders[orderId];
var localDate = formatDate(order.dateCreate);
var optionText = orderId + ') ' + localDate;
//!!!ВОТ ТУТ ОШИБКА
$('#currentOrders').append($('<option>', {
value: orderId,
text: localDate
text: optionText
}));
}
}

View File

@ -7,11 +7,11 @@
<form method="post">
<div class="form-group">
<label class="mb-3">Выберите заказ для изменения:</label>
<select id="shipment" name="shipment" class="form-control">
<select id="shipment" name="shipment" class="form-control mb-3">
<option selected disabled>Выберите партию товаров</option>
@foreach (var shipment in ViewBag.Shipments)
{
<option value="@shipment.Id">@shipment.DateShipment</option>
<option value="@shipment.Id">@shipment.Id) @shipment.DateShipment</option>
}
</select>
</div>
@ -31,7 +31,7 @@
@{
foreach (var order in ViewBag.Orders)
{
<option value="@order.Id">@order.DateCreate</option>
<option value="@order.Id">@order.Id) @order.DateCreate</option>
}
}
</select>
@ -40,7 +40,7 @@
<div class="col-md-6">
<div class="form-group">
<label class="mb-3">Текущие заказы партии:</label>
@* !!!МБ УБРАТЬ disabled *@
<select multiple disabled size="6" id="currentOrders" name="currentOrders" class="form-control">
</select>
</div>
@ -48,7 +48,7 @@
</div>
<div class="row">
<div class="row mt-3">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Изменить" class="btn btn-primary" /></div>
</div>
@ -90,9 +90,10 @@
if (result.shipmentOrders.hasOwnProperty(orderId)) {
var order = result.shipmentOrders[orderId];
var localDate = formatDate(order.dateCreate);
var optionText = orderId + ') ' + localDate;
$('#currentOrders').append($('<option>', {
value: orderId,
text: localDate
text: optionText
}));
}
}