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

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

View File

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

View File

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

View File

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

View File

@ -13,46 +13,22 @@
<option selected disabled>Выберите заказ</option> <option selected disabled>Выберите заказ</option>
@foreach (var order in ViewBag.Orders) @foreach (var order in ViewBag.Orders)
{ {
<option value="@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>
@* <input class="mb-3" type="text" id="currentStatus" name="currentStatus" readonly /> *@ <span id="currentStatus" style="font-weight: bold;" class="mb-3"></span>
<span id="currentStatus" style="font-weight: bold;"></span>
</div> </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"> <div class="form-group">
<label class="mb-3">Дата создания:</label> <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>
@* <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"> <div class="form-group">
<label>Сумма:</label> <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 />
</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> *@
<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>

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@
</div> </div>
<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"> <select multiple id="orders" name="orders" class="form-control mb-3">
@* !!!ЕСЛИ НЕ БУДЕТ РАБОТАТЬ, УБРАТЬ ОТСЮДА @order.Sum *@ @* !!!ЕСЛИ НЕ БУДЕТ РАБОТАТЬ, УБРАТЬ ОТСЮДА @order.Sum *@
@foreach (var order in ViewBag.Orders) @foreach (var order in ViewBag.Orders)
{ {

View File

@ -20,7 +20,7 @@
</div> </div>
</form> </form>
<div class="row"> <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>
<div class="mt-3" id="report"> <div class="mt-3" id="report">
</div> </div>

View File

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

View File

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

View File

@ -9,11 +9,11 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="mb-3">Выберите заказ для изменения:</label> <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> <option selected disabled>Выберите заказ</option>
@foreach (var order in ViewBag.Orders) @foreach (var order in ViewBag.Orders)
{ {
<option value="@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>*@ @*<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"> <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 /> *@ @* <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>
@* <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"> <div class="form-group">
<label class="mb-3">Дата создания:</label> <label class="mb-3">Дата создания:</label>
<input type="datetime-local" id="date" name="date" class="mb-3 form-control" step="1"> <input type="datetime-local" id="date" name="date" class="mb-3 form-control" step="1">
</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"></div>
</div> *@
<div class="form-group"> <div class="form-group">
<label>Сумма:</label> <label>Сумма:</label>
@* <div class="col-8"><input type="text" id="sum" name="sum" readonly /></div> *@ <input type="number" id="sum" name="sum" readonly class="mb-3"/>
<input type="number" id="sum" name="sum" readonly />
</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> *@
<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>

View File

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

View File

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