Uvoz, ce je vec projektov da je scroll bar
This commit is contained in:
@@ -7,6 +7,13 @@
|
||||
Layout = "~/Pages/Layouts/_Layout.cshtml";
|
||||
}
|
||||
|
||||
@section Styles
|
||||
{
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
}
|
||||
|
||||
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
|
||||
<span>
|
||||
<span class="text-muted font-weight-light">@switch (@ViewData["Type"])
|
||||
@@ -21,7 +28,7 @@
|
||||
<i>Dobavnice</i>
|
||||
break;
|
||||
case 3:
|
||||
<i>Naročila kupcev</i>
|
||||
<i>Naročila ponudbe/kupcev</i>
|
||||
break;
|
||||
case 4:
|
||||
<i>Kooperacije</i>
|
||||
@@ -34,6 +41,8 @@
|
||||
</span>
|
||||
</h4>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-12 mb-2 text-right">
|
||||
<form method="get">
|
||||
@@ -58,11 +67,9 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
|
||||
<table class="table card-table table-hover">
|
||||
</div>
|
||||
<div class="card-body" style="max-height:65vh; overflow-y:auto;">
|
||||
<table class="table card-table table-hover custom-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 200px;">#</th>
|
||||
@@ -128,6 +135,7 @@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer py-3 text-right">
|
||||
<a asp-page="Create" asp-route-type="@ViewData["Type"]" class="btn btn-primary">@switch (@ViewData["Type"])
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<div class="col-6">
|
||||
<div class="card">
|
||||
<h6 class="card-header">
|
||||
Povezovanje excel z pozicijo
|
||||
Povezovanje @Model.FileName z pozicijo
|
||||
</h6>
|
||||
<div class="card-body">
|
||||
<input type="hidden" asp-for="IdProjectPart" />
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace EveryThing.Pages.Projects
|
||||
[BindProperty]
|
||||
public string SelectedItems { get; set; }
|
||||
|
||||
|
||||
public IActionResult OnGet(int idProject, int idProjectPart, string fileName)
|
||||
{
|
||||
var user = _userManager.GetUserAsync(User).Result;
|
||||
@@ -67,9 +68,9 @@ namespace EveryThing.Pages.Projects
|
||||
ViewData["ProjectPartItems"] = new SelectList(tmpList, "Name", "Display");
|
||||
|
||||
ExcelItems = new List<ExcelItem>();
|
||||
string path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads");
|
||||
var path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads", "TempExcelImport", fileName);
|
||||
|
||||
var xlWorkbook = new XLWorkbook(Path.Combine(path, fileName));
|
||||
var xlWorkbook = new XLWorkbook(path);
|
||||
|
||||
//ONLY FIRST LIST
|
||||
var worksheet = xlWorkbook.Worksheet(1);
|
||||
@@ -120,9 +121,9 @@ namespace EveryThing.Pages.Projects
|
||||
});
|
||||
}
|
||||
|
||||
string path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads");
|
||||
var path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads", "TempExcelImport", FileName);
|
||||
|
||||
var xlWorkbook = new XLWorkbook(Path.Combine(path, FileName));
|
||||
var xlWorkbook = new XLWorkbook(path);
|
||||
|
||||
//ONLY FIRST LIST
|
||||
var worksheet = xlWorkbook.Worksheet(1);
|
||||
@@ -157,8 +158,7 @@ namespace EveryThing.Pages.Projects
|
||||
|
||||
string value = row.Cell(excelItem.CellIndex).Value.ToString();
|
||||
|
||||
if (excelItem.Name == "IdItemFk"
|
||||
|| excelItem.Name == "IdMaterialFk")
|
||||
if (excelItem.Name is "IdItemFk" or "IdMaterialFk")
|
||||
{
|
||||
var completableItem = _context.CodeTableItems.FirstOrDefault(x => x.Title == value && x.Active == true);
|
||||
if (completableItem == null)
|
||||
@@ -179,6 +179,31 @@ namespace EveryThing.Pages.Projects
|
||||
else
|
||||
newPosition.IdMaterialFk = completableItem.IdItem;
|
||||
}
|
||||
else if (excelItem.Name is "IdMaterialSupplierFk")
|
||||
{
|
||||
var tmpPartner = _context.CodeTablePartners.FirstOrDefault(x => x.Title == value && x.Active == true);
|
||||
if (tmpPartner == null)
|
||||
{
|
||||
//Add new if not exists
|
||||
tmpPartner = new CodeTablePartner()
|
||||
{
|
||||
Active = true,
|
||||
IdCompanyFk = user.IdCompanyFk,
|
||||
Title = value,
|
||||
Supplier = true,
|
||||
IdCountryFk = _context.CodeTableCountries.First(x => x.Code == "SI").IdCountry,
|
||||
City = "",
|
||||
Street = "",
|
||||
HouseNumber = "",
|
||||
PostNumber = 0,
|
||||
Post = "",
|
||||
};
|
||||
_context.CodeTablePartners.Add(tmpPartner);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
newPosition.IdMaterialSupplierFk = tmpPartner.IdPartner;
|
||||
}
|
||||
else
|
||||
{
|
||||
var propertyInfo = newPosition.GetType().GetProperties().First(x => x.Name == excelItem.Name);
|
||||
@@ -191,6 +216,7 @@ namespace EveryThing.Pages.Projects
|
||||
i++;
|
||||
}
|
||||
|
||||
System.IO.File.Delete(path);
|
||||
|
||||
return RedirectToPage("./Edit", new {id = IdProject});
|
||||
}
|
||||
|
||||
@@ -104,21 +104,26 @@ namespace EveryThing.Pages.Projects
|
||||
{
|
||||
return Page();//TODO return error
|
||||
}
|
||||
string path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads");
|
||||
var path = Path.Combine(_hostingEnvironment.WebRootPath, "Uploads", "TempExcelImport");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
List<string> uploadedFiles = new List<string>();
|
||||
else
|
||||
{
|
||||
//Pocistimo mapo
|
||||
foreach (var fileInfo in new DirectoryInfo(path).GetFiles("*.*"))
|
||||
{
|
||||
fileInfo.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
var postedFile = postedFiles[0];
|
||||
|
||||
string fileName = Guid.NewGuid().ToString().Replace("-", "_") + Path.GetExtension(postedFile.FileName);
|
||||
using (FileStream stream = new FileStream(Path.Combine(path, fileName), FileMode.Create))
|
||||
var fileName = postedFile.FileName;//Guid.NewGuid().ToString().Replace("-", "_") + Path.GetExtension(postedFile.FileName);
|
||||
await using (var stream = new FileStream(Path.Combine(path, fileName), FileMode.Create))
|
||||
{
|
||||
postedFile.CopyTo(stream);
|
||||
uploadedFiles.Add(fileName);
|
||||
await postedFile.CopyToAsync(stream);
|
||||
}
|
||||
return RedirectToPage("./CreatePartItemImportExcel", new { idProject = idProject, idProjectPart = idProjectPart, fileName = fileName});
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<h6 class="card-header">
|
||||
Seznam projektov
|
||||
</h6>
|
||||
|
||||
<div class="card-body" style="max-height:65vh; overflow-y:auto;">
|
||||
<table class="table card-table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -122,6 +122,7 @@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer py-3 text-right">
|
||||
<a asp-page="Create" class="btn btn-primary">Vnos projekta</a>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user