@ -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 ( s tring. IsNullOrEmpt y( 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" ) ;
}
}
}
}