доделать пополнение и поправить представление консервы в магазине

This commit is contained in:
Shtyrkin_Egor 2024-03-06 11:01:55 +04:00
parent c65f7168a8
commit f430bc9773
20 changed files with 37 additions and 116 deletions

View File

@ -1,14 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FishFactory;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;

View File

@ -1,15 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using FishFactoryContracts.BusinessLogicsContracts;
using Microsoft.VisualBasic.Logging;
using FishFactoryContracts.SearchModels;
using FishFactoryContracts.BindingModels;

View File

@ -1,15 +1,6 @@
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FishFactory.Forms
{

View File

@ -1,15 +1,6 @@
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FishFactory.Forms
{
@ -82,7 +73,6 @@ namespace FishFactory.Forms
if (service is FormShopReplenish form)
{
form.ShowDialog();
LoadData();
}
}

View File

@ -1,4 +1,4 @@
namespace FishFactory
namespace FishFactory.Forms
{
partial class FormShop
{
@ -156,6 +156,7 @@
Controls.Add(label1);
Name = "FormShop";
Text = "Магазин";
Load += FormShop_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
PerformLayout();

View File

@ -3,9 +3,8 @@ using FishFactoryContracts.BusinessLogicsContracts;
using FishFactoryContracts.SearchModels;
using FishFactoryDataModel.Models;
using Microsoft.Extensions.Logging;
using System.Windows.Forms;
namespace FishFactory
namespace FishFactory.Forms
{
public partial class FormShop : Form
{

View File

@ -1,4 +1,4 @@
namespace FishFactory
namespace FishFactory.Forms
{
partial class FormShopReplenish
{
@ -123,6 +123,7 @@
Controls.Add(label1);
Name = "FormShopReplenish";
Text = "Пополнение магазина";
Load += FormShopReplenish_Load;
ResumeLayout(false);
PerformLayout();
}

View File

@ -1,10 +1,9 @@

using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BusinessLogicsContracts;
using FishFactoryContracts.ViewModels;
using Microsoft.Extensions.Logging;
namespace FishFactory
namespace FishFactory.Forms
{
public partial class FormShopReplenish : Form
{
@ -22,7 +21,7 @@ namespace FishFactory
_logicS = logicS;
}
private void FormCreateReplenish_Load(object sender, EventArgs e)
private void FormShopReplenish_Load(object sender, EventArgs e)
{
_shopList = _logicS.ReadList(null);
_cannedList = _logicP.ReadList(null);

View File

@ -1,4 +1,4 @@
namespace FishFactory
namespace FishFactory.Forms
{
partial class FormShops
{
@ -105,6 +105,7 @@
Controls.Add(dataGridView);
Name = "FormShops";
Text = "Список магазинов";
Load += FormShops_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}

View File

@ -1,18 +1,15 @@
using FishFactory.Forms;
using FishFactoryDataModel.Models;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BindingModels;
using FishFactoryContracts.BusinessLogicsContracts;
using FishFactoryContracts.SearchModels;
using Microsoft.Extensions.Logging;
namespace FishFactory
namespace FishFactory.Forms
{
public partial class FormShops : Form
{
private readonly ILogger _logger;
private readonly IComponentLogic _logic;
private readonly IShopLogic _logic;
public FormShops(ILogger<FormShops> logger, IComponentLogic logic)
public FormShops(ILogger<FormShops> logger, IShopLogic logic)
{
InitializeComponent();
_logger = logger;
@ -82,7 +79,7 @@ namespace FishFactory
_logger.LogInformation("Удаление магазина");
try
{
if (!_logic.Delete(new ComponentBindingModel
if (!_logic.Delete(new ShopBindingModel
{
Id = id
}))

View File

@ -140,7 +140,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic
{
throw new ArgumentNullException("Нет названия компонента", nameof(model.ShopName));
}
_logger.LogInformation("Shop. ShopName:{ShopName}.Adress:{Adress}. Id: {Id}", model.ShopName, model.Adress, model.Id);
_logger.LogInformation("Shop. ShopName:{ShopName}.Adress:{Adress}.OpeningDate:{OpeningDate}. Id: {Id}", model.ShopName, model.Adress, model.OpeningDate, model.Id);
var element = _shopStorage.GetElement(new ShopSearchModel
{
ShopName = model.ShopName

View File

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FishFactoryDataModel.Models;
namespace FishFactoryContracts.BindingModels
{
public class ReplenishBindingModel
public class ReplenishBindingModel : IReplenishModel
{
public int ShopId { get; set; }
public int CannedId { get; set; }

View File

@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FishFactoryDataModel.Models;
using FishFactoryDataModel.Models;
namespace FishFactoryContracts.BindingModels
{
public class ShopBindingModel
public class ShopBindingModel : IShopModel
{
public int Id { get; set; }
public string ShopName { get; set; } = string.Empty;

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FishFactoryContracts.SearchModels
namespace FishFactoryContracts.SearchModels
{
public class OrderSearchModel
{

View File

@ -18,6 +18,5 @@ namespace FishFactoryContracts.ViewModels
[DisplayName("Дата открытия")]
public DateTime OpeningDate { get; set; }
public Dictionary<int, (ICannedModel, int)> ShopCanneds { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
namespace FishFactoryDataModel.Models
{
public interface IReplenishModel
{
int ShopId { get; }
int CannedId { get; }
int Count { get; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FishFactoryDataModel.Models
{
public interface IShopCannedModel
{
int ShopId { get; }
int CannedId { get; }
int Count { get; }
}
}

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FishFactoryDataModel.Models
namespace FishFactoryDataModel.Models
{
public interface IShopModel : IId
{

View File

@ -3,11 +3,6 @@ using FishFactoryContracts.SearchModels;
using FishFactoryContracts.StoragesContracts;
using FishFactoryContracts.ViewModels;
using FishFactoryListImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FishFactoryListImplement.Implements
{
@ -30,13 +25,13 @@ namespace FishFactoryListImplement.Implements
public List<ShopViewModel> GetFilteredList(ShopSearchModel model)
{
var result = new List<ShopViewModel>();
if (model == null || !model.Id.HasValue)
if (string.IsNullOrEmpty(model.ShopName))
{
return result;
}
foreach (var shop in _source.Shops)
{
if (shop.Id == model.Id)
if (shop.ShopName.Contains(model.ShopName))
{
result.Add(shop.GetViewModel);
}
@ -45,13 +40,13 @@ namespace FishFactoryListImplement.Implements
}
public ShopViewModel? GetElement(ShopSearchModel model)
{
if (!model.Id.HasValue)
if (string.IsNullOrEmpty(model.ShopName) && !model.Id.HasValue)
{
return null;
}
foreach (var shop in _source.Shops)
{
if (model.Id.HasValue && shop.Id == model.Id)
if ((!string.IsNullOrEmpty(model.ShopName) && shop.ShopName == model.ShopName) || (model.Id.HasValue && shop.Id == model.Id))
{
return shop.GetViewModel;
}

View File

@ -1,11 +1,6 @@
using FishFactoryContracts.BindingModels;
using FishFactoryDataModel.Models;
using FishFactoryContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FishFactoryListImplement.Models
{