Merge branch 'master' of http://student.git.athene.tech/the/CourseWork_CompShop
This commit is contained in:
commit
6340282572
@ -37,15 +37,44 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
public List<ReportComponentReceivingViewModel> GetComponentReceivings(List<int> ids)
|
public List<ReportComponentReceivingViewModel> GetComponentReceivings(List<int> ids)
|
||||||
{
|
{
|
||||||
var result = new List<ReportComponentReceivingViewModel>();
|
var result = new List<ReportComponentReceivingViewModel>();
|
||||||
|
|
||||||
List<ComponentViewModel> components = new List<ComponentViewModel>();
|
|
||||||
foreach (int id in ids)
|
foreach (int id in ids)
|
||||||
{
|
{
|
||||||
var component = _componentStorage.GetElement(new ComponentSearchModel()
|
var component = _componentStorage.GetElement(new ComponentSearchModel()
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
});
|
});
|
||||||
if (component != null) components.Add(component);
|
var supplies = _supplyStorage.GetFilteredList(new()
|
||||||
|
{
|
||||||
|
ComponentId = id
|
||||||
|
});
|
||||||
|
|
||||||
|
var receivings = new List<EquipmentReceivingViewModel>();
|
||||||
|
|
||||||
|
foreach(var supply in supplies)
|
||||||
|
{
|
||||||
|
if (supply.ReceivingId.HasValue)
|
||||||
|
{
|
||||||
|
var receiving = _receivingStorage.GetElement(new() { Id = supply.ReceivingId.Value });
|
||||||
|
if (receiving != null && receivings.Contains(receiving))
|
||||||
|
{
|
||||||
|
receivings.Add(receiving);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var receivingnames = new List<string>();
|
||||||
|
foreach (var receiving in receivings)
|
||||||
|
{
|
||||||
|
receivingnames.Add($"Id: {receiving.Id}. Date: {receiving.Status}.");
|
||||||
|
}
|
||||||
|
if(receivingnames.Count > 0 && component != null)
|
||||||
|
{
|
||||||
|
result.Add(new()
|
||||||
|
{
|
||||||
|
ComponentName = component.ComponentName,
|
||||||
|
Receivings = receivingnames
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,12 +83,12 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
|
|
||||||
public void SaveReceivingComponentsToWordFile(ReportBindingModel model)
|
public void SaveReceivingComponentsToWordFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
//_saveToWord.CreateDoc(new WordInfoProvider
|
_saveToWord.CreateDoc(new WordInfoProvider
|
||||||
//{
|
{
|
||||||
// FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
// Title = "Список получений по компонентам",
|
Title = "Список получений по компонентам",
|
||||||
// ComponentReceivings = GetComponentReceivings(model.Ids)
|
ComponentReceivings = GetComponentReceivings(model.Ids)
|
||||||
//});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveReceivingComponentsToXmlFile(ReportBindingModel mode)
|
public void SaveReceivingComponentsToXmlFile(ReportBindingModel mode)
|
||||||
|
@ -12,51 +12,51 @@ namespace ComputerShopBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
public void CreateDoc(WordInfoProvider info)
|
public void CreateDoc(WordInfoProvider info)
|
||||||
{
|
{
|
||||||
//CreateWord(info);
|
CreateWord(info);
|
||||||
|
|
||||||
//CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
//{
|
{
|
||||||
// Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
// TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
// {
|
{
|
||||||
// Size = "24",
|
Size = "24",
|
||||||
// JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
// }
|
}
|
||||||
//});
|
});
|
||||||
|
|
||||||
//foreach (var mc in info.MemberConferences)
|
foreach (var mc in info.MemberConferences)
|
||||||
//{
|
{
|
||||||
// CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
// {
|
{
|
||||||
// Texts = new List<(string, WordTextProperties)>
|
Texts = new List<(string, WordTextProperties)>
|
||||||
// { (mc.MemberFIO, new WordTextProperties { Size = "20", Bold=true})},
|
{ (mc.MemberFIO, new WordTextProperties { Size = "20", Bold=true})},
|
||||||
// TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
// {
|
{
|
||||||
// Size = "24",
|
Size = "24",
|
||||||
// JustificationType = WordJustificationType.Both
|
JustificationType = WordJustificationType.Both
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// foreach (var conference in mc.Conferences)
|
foreach (var conference in mc.Conferences)
|
||||||
// {
|
{
|
||||||
// CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
// {
|
{
|
||||||
// Texts = new List<(string, WordTextProperties)>
|
Texts = new List<(string, WordTextProperties)>
|
||||||
// { (conference.Item1 + " - ", new WordTextProperties { Size = "16", Bold=false}),
|
{ (conference.Item1 + " - ", new WordTextProperties { Size = "16", Bold=false}),
|
||||||
// (conference.Item2.ToShortDateString(), new WordTextProperties { Size = "16", Bold=false})},
|
(conference.Item2.ToShortDateString(), new WordTextProperties { Size = "16", Bold=false})},
|
||||||
// TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
// {
|
{
|
||||||
// Size = "24",
|
Size = "24",
|
||||||
// JustificationType = WordJustificationType.Both
|
JustificationType = WordJustificationType.Both
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//SaveWord(info);
|
SaveWord(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
//protected abstract void CreateWord(WordInfoOrganiser info);
|
protected abstract void CreateWord(WordInfoOrganiser info);
|
||||||
//protected abstract void CreateParagraph(WordParagraph paragraph);
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
//protected abstract void SaveWord(WordInfoOrganiser info);
|
protected abstract void SaveWord(WordInfoOrganiser info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ namespace ComputerShopBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public Dictionary<ComponentViewModel, List<EquipmentReceivingViewModel>> ComponentReceivings { get; set; } = new();
|
public List<ReportComponentReceivingViewModel> ComponentReceivings { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ComputerShopBusinessLogic.OfficePackage.Implements
|
namespace ComputerShopBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
public class SaveToWord
|
public class SaveToWord : AbstractSaveToWord
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,6 @@ namespace ComputerShopContracts.SearchModels
|
|||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
public ComponentSearchModel? Component { get; set; }
|
public ComponentSearchModel? Component { get; set; }
|
||||||
|
public int? ComponentId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,8 @@ namespace ComputerShopContracts.ViewModels
|
|||||||
set;
|
set;
|
||||||
} = new();
|
} = new();
|
||||||
|
|
||||||
|
public int? ReceivingId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,18 +47,29 @@ namespace ComputerShopDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<SupplyViewModel> GetFilteredList(SupplySearchModel model)
|
public List<SupplyViewModel> GetFilteredList(SupplySearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && !model.ComponentId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new ComputerShopDatabase();
|
using var context = new ComputerShopDatabase();
|
||||||
return context.Supplies
|
if(model.ComponentId.HasValue)
|
||||||
.Include(x => x.Orders)
|
return context.Supplies
|
||||||
.ThenInclude(x => x.Order)
|
.Include(x => x.Orders)
|
||||||
.Where(x => x.Id == model.Id)
|
.ThenInclude(x => x.Order)
|
||||||
.ToList()
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel)
|
.ToList()
|
||||||
.ToList();
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
else
|
||||||
|
return context.Supplies
|
||||||
|
.Include(x => x.Orders)
|
||||||
|
.ThenInclude(x => x.Order)
|
||||||
|
.Include(x => x.ComponentSupplies)
|
||||||
|
.ThenInclude(x => x.Component)
|
||||||
|
.Where(x => x.ComponentSupplies.Any(x => x.ComponentId == model.ComponentId))
|
||||||
|
.ToList()
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SupplyViewModel> GetFullList()
|
public List<SupplyViewModel> GetFullList()
|
||||||
|
Loading…
Reference in New Issue
Block a user