diff --git a/SnackBarBusinessLogic/SnackBarBusinessLogic.csproj b/SnackBarBusinessLogic/SnackBarBusinessLogic.csproj
deleted file mode 100644
index bbcd7e0..0000000
--- a/SnackBarBusinessLogic/SnackBarBusinessLogic.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- net6.0
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SnackBarContracts/BindingModels/SnackBindingModel.cs b/SnackBarContracts/BindingModels/SnackBindingModel.cs
deleted file mode 100644
index 326f81a..0000000
--- a/SnackBarContracts/BindingModels/SnackBindingModel.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SnackBarDataModels.Models;
-
-namespace SnackBarContracts.BindingModels
-{
- public class SnackBindingModel : ISnackModel
- {
- public int Id { get; set; }
- public string SnackName { get; set; } = string.Empty;
- public double Price { get; set; }
- public Dictionary SnackComponents { get; set; } = new();
- }
-}
diff --git a/SnackBarContracts/BusinessLogicsContracts/ISnackLogic.cs b/SnackBarContracts/BusinessLogicsContracts/ISnackLogic.cs
deleted file mode 100644
index 01434b4..0000000
--- a/SnackBarContracts/BusinessLogicsContracts/ISnackLogic.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
-
-namespace SnackBarContracts.BusinessLogicsContracts
-{
- public interface ISnackLogic
- {
- List? ReadList(SnackSearchModel? model);
- SnackViewModel? ReadElement(SnackSearchModel model);
- bool Create(SnackBindingModel model);
- bool Update(SnackBindingModel model);
- bool Delete(SnackBindingModel model);
- }
-}
diff --git a/SnackBarContracts/StoragesContracts/ISnackStorage.cs b/SnackBarContracts/StoragesContracts/ISnackStorage.cs
deleted file mode 100644
index eefae9b..0000000
--- a/SnackBarContracts/StoragesContracts/ISnackStorage.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
-
-namespace SnackBarContracts.StoragesContracts
-{
- public interface ISnackStorage
- {
- List GetFullList();
- List GetFilteredList(SnackSearchModel model);
- SnackViewModel? GetElement(SnackSearchModel model);
- SnackViewModel? Insert(SnackBindingModel model);
- SnackViewModel? Update(SnackBindingModel model);
- SnackViewModel? Delete(SnackBindingModel model);
- }
-}
diff --git a/SnackBarDataModels/ISnackModel.cs b/SnackBarDataModels/ISnackModel.cs
deleted file mode 100644
index 78e0e36..0000000
--- a/SnackBarDataModels/ISnackModel.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SnackBarDataModels.Models
-{
- public interface ISnackModel : IId
- {
- string SnackName { get; }
- double Price { get; }
- Dictionary SnackComponents { get; }
-
- }
-}
diff --git a/SnackBarListImplement/Snack.cs b/SnackBarListImplement/Snack.cs
deleted file mode 100644
index a588419..0000000
--- a/SnackBarListImplement/Snack.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.ViewModels;
-using SnackBarDataModels.Models;
-
-
-namespace SnackBarListImplement.Models
-{
- public class Snack : ISnackModel
- {
- public int Id { get; private set; }
- public string SnackName { get; private set; } = string.Empty;
- public double Price { get; private set; }
- public Dictionary SnackComponents { get; private set; } = new Dictionary();
- public static Snack? Create(SnackBindingModel? model)
- {
- if (model == null)
- {
- return null;
- }
- return new Snack()
- {
- Id = model.Id,
- SnackName = model.SnackName,
- Price = model.Price,
- SnackComponents = model.SnackComponents
- };
- }
- public void Update(SnackBindingModel? model)
- {
- if (model == null)
- {
- return;
- }
- SnackName = model.SnackName;
- Price = model.Price;
- SnackComponents = model.SnackComponents;
- }
- public SnackViewModel GetViewModel => new()
- {
- Id = Id,
- SnackName = SnackName,
- Price = Price,
- SnackComponents = SnackComponents
- };
- }
-}
diff --git a/SnackBarListImplement/SnackStorage.cs b/SnackBarListImplement/SnackStorage.cs
deleted file mode 100644
index 432dc46..0000000
--- a/SnackBarListImplement/SnackStorage.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.ConstrainedExecution;
-using System.Text;
-using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
-using SnackBarListImplement.Models;
-
-namespace SnackBarListImplement.Implements
-{
- public class SnackStorage : ISnackStorage
- {
- private readonly DataListSingleton _source;
-
- public SnackStorage()
- {
- _source = DataListSingleton.GetInstance();
- }
-
- public List GetFullList()
- {
- var result = new List();
- foreach (var snack in _source.Snacks)
- {
- result.Add(snack.GetViewModel);
- }
- return result;
- }
-
- public List GetFilteredList(SnackSearchModel model)
- {
- var result = new List();
- if (string.IsNullOrEmpty(model.SnackName))
- {
- return result;
- }
- foreach (var snack in _source.Snacks)
- {
- if (snack.SnackName.Contains(model.SnackName))
- {
- result.Add(snack.GetViewModel);
- }
- }
- return result;
- }
- public SnackViewModel? GetElement(SnackSearchModel model)
- {
- if (string.IsNullOrEmpty(model.SnackName) && !model.Id.HasValue)
- {
- return null;
- }
- foreach (var snack in _source.Snacks)
- {
- if ((!string.IsNullOrEmpty(model.SnackName) && snack.SnackName == model.SnackName) || (model.Id.HasValue && snack.Id == model.Id))
- {
- return snack.GetViewModel;
- }
- }
- return null;
- }
-
- public SnackViewModel? Insert(SnackBindingModel model)
- {
- model.Id = 1;
- foreach (var snack in _source.Snacks)
- {
- if (model.Id <= snack.Id)
- {
- model.Id = snack.Id + 1;
- }
- }
- var newSnack = Snack.Create(model);
- if (newSnack == null)
- {
- return null;
- }
- _source.Snacks.Add(newSnack);
- return newSnack.GetViewModel;
- }
-
- public SnackViewModel? Update(SnackBindingModel model)
- {
- foreach (var snack in _source.Snacks)
- {
- if (snack.Id == model.Id)
- {
- snack.Update(model);
- return snack.GetViewModel;
- }
- }
- return null;
- }
- public SnackViewModel? Delete(SnackBindingModel model)
- {
- for (int i = 0; i < _source.Snacks.Count; ++i)
- {
- if (_source.Snacks[i].Id == model.Id)
- {
- var element = _source.Snacks[i];
- _source.Snacks.RemoveAt(i);
- return element.GetViewModel;
- }
- }
- return null;
- }
- }
-}
diff --git a/SnackBarBusinessLogic/ComponentLogic.cs b/TypographyBusinessLogic/ComponentLogic.cs
similarity index 93%
rename from SnackBarBusinessLogic/ComponentLogic.cs
rename to TypographyBusinessLogic/ComponentLogic.cs
index 58b5b71..e332560 100644
--- a/SnackBarBusinessLogic/ComponentLogic.cs
+++ b/TypographyBusinessLogic/ComponentLogic.cs
@@ -3,16 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
using Microsoft.Extensions.Logging;
-namespace SnackBarBusinessLogic.BusinessLogics
+namespace TypographyBusinessLogic.BusinessLogics
{
public class ComponentLogic : IComponentLogic
{
diff --git a/SnackBarBusinessLogic/OrderLogic.cs b/TypographyBusinessLogic/OrderLogic.cs
similarity index 92%
rename from SnackBarBusinessLogic/OrderLogic.cs
rename to TypographyBusinessLogic/OrderLogic.cs
index 36d73f5..bcf03a7 100644
--- a/SnackBarBusinessLogic/OrderLogic.cs
+++ b/TypographyBusinessLogic/OrderLogic.cs
@@ -1,17 +1,17 @@
-using SnackBarContracts.BusinessLogicsContracts;
+using TypographyContracts.BusinessLogicsContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
-using SnackBarDataModels.Enums;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
+using TypographyDataModels.Enums;
using Microsoft.Extensions.Logging;
-namespace SnackBarBusinessLogic.BusinessLogics
+namespace TypographyBusinessLogic.BusinessLogics
{
public class OrderLogic : IOrderLogic
{
@@ -102,9 +102,9 @@ namespace SnackBarBusinessLogic.BusinessLogics
{
return;
}
- if (model.SnackId < 0)
+ if (model.PrintedId < 0)
{
- throw new ArgumentNullException("Некорректный идентификатор закусок", nameof(model.SnackId));
+ throw new ArgumentNullException("Некорректный идентификатор закусок", nameof(model.PrintedId));
}
if (model.Count <= 0)
{
diff --git a/SnackBarBusinessLogic/SnackLogic.cs b/TypographyBusinessLogic/PrintedLogic.cs
similarity index 65%
rename from SnackBarBusinessLogic/SnackLogic.cs
rename to TypographyBusinessLogic/PrintedLogic.cs
index 2362281..56b789d 100644
--- a/SnackBarBusinessLogic/SnackLogic.cs
+++ b/TypographyBusinessLogic/PrintedLogic.cs
@@ -1,30 +1,30 @@
using Microsoft.Extensions.Logging;
-using SnackBarBusinessLogic.BusinessLogics;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
+using TypographyBusinessLogic.BusinessLogics;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarBusinessLogic.BusinessLogics
+namespace TypographyBusinessLogic.BusinessLogics
{
- public class SnackLogic : ISnackLogic
+ public class PrintedLogic : IPrintedLogic
{
private readonly ILogger _logger;
- private readonly ISnackStorage _snackStorage;
- public SnackLogic(ILogger logger, ISnackStorage snackStorage)
+ private readonly IPrintedStorage _snackStorage;
+ public PrintedLogic(ILogger logger, IPrintedStorage snackStorage)
{
_logger = logger;
_snackStorage = snackStorage;
}
- public List? ReadList(SnackSearchModel? model)
+ public List? ReadList(PrintedSearchModel? model)
{
- _logger.LogInformation("ReadList. SnackName:{SnackName}.Id:{ Id}", model?.SnackName, model?.Id);
+ _logger.LogInformation("ReadList. PrintedName:{PrintedName}.Id:{ Id}", model?.PrintedName, model?.Id);
var list = model == null ? _snackStorage.GetFullList() : _snackStorage.GetFilteredList(model);
if (list == null)
{
@@ -34,13 +34,13 @@ namespace SnackBarBusinessLogic.BusinessLogics
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
return list;
}
- public SnackViewModel? ReadElement(SnackSearchModel model)
+ public PrintedViewModel? ReadElement(PrintedSearchModel model)
{
if (model == null)
{
throw new ArgumentNullException(nameof(model));
}
- _logger.LogInformation("ReadElement. SnackName:{SnackName}.Id:{ Id}", model.SnackName, model.Id);
+ _logger.LogInformation("ReadElement. PrintedName:{PrintedName}.Id:{ Id}", model.PrintedName, model.Id);
var element = _snackStorage.GetElement(model);
if (element == null)
{
@@ -50,7 +50,7 @@ namespace SnackBarBusinessLogic.BusinessLogics
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
- public bool Create(SnackBindingModel model)
+ public bool Create(PrintedBindingModel model)
{
CheckModel(model);
if (_snackStorage.Insert(model) == null)
@@ -60,7 +60,7 @@ namespace SnackBarBusinessLogic.BusinessLogics
}
return true;
}
- public bool Update(SnackBindingModel model)
+ public bool Update(PrintedBindingModel model)
{
CheckModel(model);
if (_snackStorage.Update(model) == null)
@@ -70,7 +70,7 @@ namespace SnackBarBusinessLogic.BusinessLogics
}
return true;
}
- public bool Delete(SnackBindingModel model)
+ public bool Delete(PrintedBindingModel model)
{
CheckModel(model, false);
_logger.LogInformation("Delete. Id:{Id}", model.Id);
@@ -81,7 +81,7 @@ namespace SnackBarBusinessLogic.BusinessLogics
}
return true;
}
- private void CheckModel(SnackBindingModel model, bool withParams = true)
+ private void CheckModel(PrintedBindingModel model, bool withParams = true)
{
if (model == null)
{
@@ -91,19 +91,19 @@ namespace SnackBarBusinessLogic.BusinessLogics
{
return;
}
- if (string.IsNullOrEmpty(model.SnackName))
+ if (string.IsNullOrEmpty(model.PrintedName))
{
throw new ArgumentNullException("Нет названия закуски",
- nameof(model.SnackName));
+ nameof(model.PrintedName));
}
if (model.Price <= 0)
{
throw new ArgumentNullException("Цена закуски должна быть больше 0", nameof(model.Price));
}
- _logger.LogInformation("Snack. SnackName:{SnackName}.Price:{ Price}. Id: { Id}", model.SnackName, model.Price, model.Id);
- var element = _snackStorage.GetElement(new SnackSearchModel
+ _logger.LogInformation("Printed. PrintedName:{PrintedName}.Price:{ Price}. Id: { Id}", model.PrintedName, model.Price, model.Id);
+ var element = _snackStorage.GetElement(new PrintedSearchModel
{
- SnackName = model.SnackName
+ PrintedName = model.PrintedName
});
if (element != null && element.Id != model.Id)
{
diff --git a/TypographyBusinessLogic/TypographyBusinessLogic.csproj b/TypographyBusinessLogic/TypographyBusinessLogic.csproj
new file mode 100644
index 0000000..f1dbedd
--- /dev/null
+++ b/TypographyBusinessLogic/TypographyBusinessLogic.csproj
@@ -0,0 +1,17 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SnackBarContracts/BindingModels/ComponentBindingModel.cs b/TypographyContracts/BindingModels/ComponentBindingModel.cs
similarity index 80%
rename from SnackBarContracts/BindingModels/ComponentBindingModel.cs
rename to TypographyContracts/BindingModels/ComponentBindingModel.cs
index dc05487..15f49db 100644
--- a/SnackBarContracts/BindingModels/ComponentBindingModel.cs
+++ b/TypographyContracts/BindingModels/ComponentBindingModel.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarDataModels.Models;
+using TypographyDataModels.Models;
-namespace SnackBarContracts.BindingModels
+namespace TypographyContracts.BindingModels
{
public class ComponentBindingModel : IComponentModel
{
diff --git a/SnackBarContracts/BindingModels/OrderBindingModel.cs b/TypographyContracts/BindingModels/OrderBindingModel.cs
similarity index 76%
rename from SnackBarContracts/BindingModels/OrderBindingModel.cs
rename to TypographyContracts/BindingModels/OrderBindingModel.cs
index f256bd5..4708a3d 100644
--- a/SnackBarContracts/BindingModels/OrderBindingModel.cs
+++ b/TypographyContracts/BindingModels/OrderBindingModel.cs
@@ -3,15 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarDataModels.Enums;
-using SnackBarDataModels.Models;
+using TypographyDataModels.Enums;
+using TypographyDataModels.Models;
-namespace SnackBarContracts.BindingModels
+namespace TypographyContracts.BindingModels
{
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
- public int SnackId { get; set; }
+ public int PrintedId { get; set; }
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
diff --git a/TypographyContracts/BindingModels/PrintedBindingModel.cs b/TypographyContracts/BindingModels/PrintedBindingModel.cs
new file mode 100644
index 0000000..faf5644
--- /dev/null
+++ b/TypographyContracts/BindingModels/PrintedBindingModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TypographyDataModels.Models;
+
+namespace TypographyContracts.BindingModels
+{
+ public class PrintedBindingModel : IPrintedModel
+ {
+ public int Id { get; set; }
+ public string PrintedName { get; set; } = string.Empty;
+ public double Price { get; set; }
+ public Dictionary PrintedComponents { get; set; } = new();
+ }
+}
diff --git a/SnackBarContracts/BusinessLogicsContracts/IComponentLogic.cs b/TypographyContracts/BusinessLogicsContracts/IComponentLogic.cs
similarity index 72%
rename from SnackBarContracts/BusinessLogicsContracts/IComponentLogic.cs
rename to TypographyContracts/BusinessLogicsContracts/IComponentLogic.cs
index e5f983d..65d0c04 100644
--- a/SnackBarContracts/BusinessLogicsContracts/IComponentLogic.cs
+++ b/TypographyContracts/BusinessLogicsContracts/IComponentLogic.cs
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
-namespace SnackBarContracts.BusinessLogicsContracts
+namespace TypographyContracts.BusinessLogicsContracts
{
public interface IComponentLogic
{
diff --git a/SnackBarContracts/BusinessLogicsContracts/IOrderLogic.cs b/TypographyContracts/BusinessLogicsContracts/IOrderLogic.cs
similarity index 72%
rename from SnackBarContracts/BusinessLogicsContracts/IOrderLogic.cs
rename to TypographyContracts/BusinessLogicsContracts/IOrderLogic.cs
index b0d1dd2..6105b9a 100644
--- a/SnackBarContracts/BusinessLogicsContracts/IOrderLogic.cs
+++ b/TypographyContracts/BusinessLogicsContracts/IOrderLogic.cs
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
-namespace SnackBarContracts.BusinessLogicsContracts
+namespace TypographyContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
diff --git a/TypographyContracts/BusinessLogicsContracts/IPrintedLogic.cs b/TypographyContracts/BusinessLogicsContracts/IPrintedLogic.cs
new file mode 100644
index 0000000..8b7a050
--- /dev/null
+++ b/TypographyContracts/BusinessLogicsContracts/IPrintedLogic.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
+
+namespace TypographyContracts.BusinessLogicsContracts
+{
+ public interface IPrintedLogic
+ {
+ List? ReadList(PrintedSearchModel? model);
+ PrintedViewModel? ReadElement(PrintedSearchModel model);
+ bool Create(PrintedBindingModel model);
+ bool Update(PrintedBindingModel model);
+ bool Delete(PrintedBindingModel model);
+ }
+}
diff --git a/SnackBarContracts/SearchModels/ComponentSearchModel.cs b/TypographyContracts/SearchModels/ComponentSearchModel.cs
similarity index 85%
rename from SnackBarContracts/SearchModels/ComponentSearchModel.cs
rename to TypographyContracts/SearchModels/ComponentSearchModel.cs
index b8a3651..b23cdcf 100644
--- a/SnackBarContracts/SearchModels/ComponentSearchModel.cs
+++ b/TypographyContracts/SearchModels/ComponentSearchModel.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarContracts.SearchModels
+namespace TypographyContracts.SearchModels
{
public class ComponentSearchModel
{
diff --git a/SnackBarContracts/SearchModels/OrderSearchModel.cs b/TypographyContracts/SearchModels/OrderSearchModel.cs
similarity index 82%
rename from SnackBarContracts/SearchModels/OrderSearchModel.cs
rename to TypographyContracts/SearchModels/OrderSearchModel.cs
index 7d66569..3f183fb 100644
--- a/SnackBarContracts/SearchModels/OrderSearchModel.cs
+++ b/TypographyContracts/SearchModels/OrderSearchModel.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarContracts.SearchModels
+namespace TypographyContracts.SearchModels
{
public class OrderSearchModel
{
diff --git a/SnackBarContracts/SearchModels/SnackSearchModel.cs b/TypographyContracts/SearchModels/PrintedSearchModel.cs
similarity index 57%
rename from SnackBarContracts/SearchModels/SnackSearchModel.cs
rename to TypographyContracts/SearchModels/PrintedSearchModel.cs
index 34c3d4d..115aa32 100644
--- a/SnackBarContracts/SearchModels/SnackSearchModel.cs
+++ b/TypographyContracts/SearchModels/PrintedSearchModel.cs
@@ -4,11 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarContracts.SearchModels
+namespace TypographyContracts.SearchModels
{
- public class SnackSearchModel
+ public class PrintedSearchModel
{
public int? Id { get; set; }
- public string? SnackName { get; set; }
+ public string? PrintedName { get; set; }
}
}
diff --git a/SnackBarContracts/StoragesContracts/IComponentStorage.cs b/TypographyContracts/StoragesContracts/IComponentStorage.cs
similarity index 76%
rename from SnackBarContracts/StoragesContracts/IComponentStorage.cs
rename to TypographyContracts/StoragesContracts/IComponentStorage.cs
index b8cc57b..65094a8 100644
--- a/SnackBarContracts/StoragesContracts/IComponentStorage.cs
+++ b/TypographyContracts/StoragesContracts/IComponentStorage.cs
@@ -1,13 +1,13 @@
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarContracts.StoragesContracts
+namespace TypographyContracts.StoragesContracts
{
public interface IComponentStorage
{
diff --git a/SnackBarContracts/StoragesContracts/IOrderStorage.cs b/TypographyContracts/StoragesContracts/IOrderStorage.cs
similarity index 75%
rename from SnackBarContracts/StoragesContracts/IOrderStorage.cs
rename to TypographyContracts/StoragesContracts/IOrderStorage.cs
index 49835fc..1ea8430 100644
--- a/SnackBarContracts/StoragesContracts/IOrderStorage.cs
+++ b/TypographyContracts/StoragesContracts/IOrderStorage.cs
@@ -1,13 +1,13 @@
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarContracts.StoragesContracts
+namespace TypographyContracts.StoragesContracts
{
public interface IOrderStorage
{
diff --git a/TypographyContracts/StoragesContracts/IPrintedStorage.cs b/TypographyContracts/StoragesContracts/IPrintedStorage.cs
new file mode 100644
index 0000000..794b240
--- /dev/null
+++ b/TypographyContracts/StoragesContracts/IPrintedStorage.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
+
+namespace TypographyContracts.StoragesContracts
+{
+ public interface IPrintedStorage
+ {
+ List GetFullList();
+ List GetFilteredList(PrintedSearchModel model);
+ PrintedViewModel? GetElement(PrintedSearchModel model);
+ PrintedViewModel? Insert(PrintedBindingModel model);
+ PrintedViewModel? Update(PrintedBindingModel model);
+ PrintedViewModel? Delete(PrintedBindingModel model);
+ }
+}
diff --git a/SnackBarContracts/SnackBarContracts.csproj b/TypographyContracts/TypographyContracts.csproj
similarity index 61%
rename from SnackBarContracts/SnackBarContracts.csproj
rename to TypographyContracts/TypographyContracts.csproj
index 16c5379..30c2576 100644
--- a/SnackBarContracts/SnackBarContracts.csproj
+++ b/TypographyContracts/TypographyContracts.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -7,7 +7,7 @@
-
+
diff --git a/SnackBarContracts/ViewModels/ComponentViewModel.cs b/TypographyContracts/ViewModels/ComponentViewModel.cs
similarity index 85%
rename from SnackBarContracts/ViewModels/ComponentViewModel.cs
rename to TypographyContracts/ViewModels/ComponentViewModel.cs
index 0e77b73..40a6a67 100644
--- a/SnackBarContracts/ViewModels/ComponentViewModel.cs
+++ b/TypographyContracts/ViewModels/ComponentViewModel.cs
@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarDataModels.Models;
+using TypographyDataModels.Models;
using System.ComponentModel;
-namespace SnackBarContracts.ViewModels
+namespace TypographyContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{
diff --git a/SnackBarContracts/ViewModels/OrderViewModel.cs b/TypographyContracts/ViewModels/OrderViewModel.cs
similarity index 79%
rename from SnackBarContracts/ViewModels/OrderViewModel.cs
rename to TypographyContracts/ViewModels/OrderViewModel.cs
index f7afd13..847ebde 100644
--- a/SnackBarContracts/ViewModels/OrderViewModel.cs
+++ b/TypographyContracts/ViewModels/OrderViewModel.cs
@@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarDataModels.Enums;
-using SnackBarDataModels.Models;
+using TypographyDataModels.Enums;
+using TypographyDataModels.Models;
using System.ComponentModel;
-namespace SnackBarContracts.ViewModels
+namespace TypographyContracts.ViewModels
{
public class OrderViewModel : IOrderModel
{
[DisplayName("Номер")]
public int Id { get; set; }
- public int SnackId { get; set; }
+ public int PrintedId { get; set; }
[DisplayName("Изделие")]
- public string SnackName { get; set; } = string.Empty;
+ public string PrintedName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Сумма")]
diff --git a/SnackBarContracts/ViewModels/SnackViewModel.cs b/TypographyContracts/ViewModels/PrintedViewModel.cs
similarity index 53%
rename from SnackBarContracts/ViewModels/SnackViewModel.cs
rename to TypographyContracts/ViewModels/PrintedViewModel.cs
index e28dbf3..90bd2f7 100644
--- a/SnackBarContracts/ViewModels/SnackViewModel.cs
+++ b/TypographyContracts/ViewModels/PrintedViewModel.cs
@@ -3,19 +3,19 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarDataModels.Models;
+using TypographyDataModels.Models;
using System.ComponentModel;
-namespace SnackBarContracts.ViewModels
+namespace TypographyContracts.ViewModels
{
- public class SnackViewModel : ISnackModel
+ public class PrintedViewModel : IPrintedModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
- public string SnackName { get; set; } = string.Empty;
+ public string PrintedName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
- public Dictionary SnackComponents { get; set; } = new();
+ public Dictionary PrintedComponents { get; set; } = new();
}
}
diff --git a/SnackBarDataModels/IComponentModel.cs b/TypographyDataModels/IComponentModel.cs
similarity index 86%
rename from SnackBarDataModels/IComponentModel.cs
rename to TypographyDataModels/IComponentModel.cs
index 581476f..3225cb6 100644
--- a/SnackBarDataModels/IComponentModel.cs
+++ b/TypographyDataModels/IComponentModel.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarDataModels.Models
+namespace TypographyDataModels.Models
{
public interface IComponentModel : IId
{
diff --git a/SnackBarDataModels/IId.cs b/TypographyDataModels/IId.cs
similarity index 85%
rename from SnackBarDataModels/IId.cs
rename to TypographyDataModels/IId.cs
index 94f5236..5806a37 100644
--- a/SnackBarDataModels/IId.cs
+++ b/TypographyDataModels/IId.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarDataModels
+namespace TypographyDataModels
{
public interface IId
{
diff --git a/SnackBarDataModels/IOrderModel.cs b/TypographyDataModels/IOrderModel.cs
similarity index 83%
rename from SnackBarDataModels/IOrderModel.cs
rename to TypographyDataModels/IOrderModel.cs
index 25fba96..3358942 100644
--- a/SnackBarDataModels/IOrderModel.cs
+++ b/TypographyDataModels/IOrderModel.cs
@@ -4,11 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace SnackBarDataModels.Enums
+namespace TypographyDataModels.Enums
{
public interface IOrderModel : IId
{
- int SnackId { get; }
+ int PrintedId { get; }
int Count { get; }
double Sum { get; }
OrderStatus Status { get; }
diff --git a/TypographyDataModels/IPrintedModel.cs b/TypographyDataModels/IPrintedModel.cs
new file mode 100644
index 0000000..a1efb0c
--- /dev/null
+++ b/TypographyDataModels/IPrintedModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TypographyDataModels.Models
+{
+ public interface IPrintedModel : IId
+ {
+ string PrintedName { get; }
+ double Price { get; }
+ Dictionary PrintedComponents { get; }
+
+ }
+}
diff --git a/SnackBarDataModels/OrderStatus.cs b/TypographyDataModels/OrderStatus.cs
similarity index 82%
rename from SnackBarDataModels/OrderStatus.cs
rename to TypographyDataModels/OrderStatus.cs
index 3b879a0..9705761 100644
--- a/SnackBarDataModels/OrderStatus.cs
+++ b/TypographyDataModels/OrderStatus.cs
@@ -1,4 +1,4 @@
-namespace SnackBarDataModels.Enums
+namespace TypographyDataModels.Enums
{
public enum OrderStatus
{
diff --git a/SnackBarDataModels/SnackBarDataModels.csproj b/TypographyDataModels/TypographyDataModels.csproj
similarity index 100%
rename from SnackBarDataModels/SnackBarDataModels.csproj
rename to TypographyDataModels/TypographyDataModels.csproj
diff --git a/SnackBarListImplement/Component.cs b/TypographyListImplement/Component.cs
similarity index 87%
rename from SnackBarListImplement/Component.cs
rename to TypographyListImplement/Component.cs
index 3e114c6..9b0cdb3 100644
--- a/SnackBarListImplement/Component.cs
+++ b/TypographyListImplement/Component.cs
@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.ViewModels;
-using SnackBarDataModels.Models;
+using TypographyContracts.BindingModels;
+using TypographyContracts.ViewModels;
+using TypographyDataModels.Models;
-namespace SnackBarListImplement.Models
+namespace TypographyListImplement.Models
{
public class Component : IComponentModel
{
diff --git a/SnackBarListImplement/ComponentStorage.cs b/TypographyListImplement/ComponentStorage.cs
similarity index 92%
rename from SnackBarListImplement/ComponentStorage.cs
rename to TypographyListImplement/ComponentStorage.cs
index e77f4c8..35643dc 100644
--- a/SnackBarListImplement/ComponentStorage.cs
+++ b/TypographyListImplement/ComponentStorage.cs
@@ -3,14 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
-using SnackBarListImplement.Models;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
+using TypographyListImplement.Models;
-namespace SnackBarListImplement.Implements
+namespace TypographyListImplement.Implements
{
public class ComponentStorage : IComponentStorage
{
diff --git a/SnackBarListImplement/DataListSingleton.cs b/TypographyListImplement/DataListSingleton.cs
similarity index 80%
rename from SnackBarListImplement/DataListSingleton.cs
rename to TypographyListImplement/DataListSingleton.cs
index 74bf139..dd973c4 100644
--- a/SnackBarListImplement/DataListSingleton.cs
+++ b/TypographyListImplement/DataListSingleton.cs
@@ -3,21 +3,21 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarListImplement.Models;
+using TypographyListImplement.Models;
-namespace SnackBarListImplement
+namespace TypographyListImplement
{
public class DataListSingleton
{
private static DataListSingleton? _instance;
public List Components { get; set; }
public List Orders { get; set; }
- public List Snacks { get; set; }
+ public List Printeds { get; set; }
private DataListSingleton()
{
Components = new List();
Orders = new List();
- Snacks = new List();
+ Printeds = new List();
}
public static DataListSingleton GetInstance()
{
diff --git a/SnackBarListImplement/Order.cs b/TypographyListImplement/Order.cs
similarity index 81%
rename from SnackBarListImplement/Order.cs
rename to TypographyListImplement/Order.cs
index 15f481a..da05a97 100644
--- a/SnackBarListImplement/Order.cs
+++ b/TypographyListImplement/Order.cs
@@ -3,16 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.ViewModels;
-using SnackBarDataModels.Enums;
-using SnackBarDataModels.Models;
+using TypographyContracts.BindingModels;
+using TypographyContracts.ViewModels;
+using TypographyDataModels.Enums;
+using TypographyDataModels.Models;
-namespace SnackBarListImplement.Models
+namespace TypographyListImplement.Models
{
public class Order : IOrderModel
{
- public int SnackId { get; private set; }
+ public int PrintedId { get; private set; }
public int Count { get; private set; }
@@ -35,7 +35,7 @@ namespace SnackBarListImplement.Models
return new Order
{
Id = model.Id,
- SnackId = model.SnackId,
+ PrintedId = model.PrintedId,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@@ -51,7 +51,7 @@ namespace SnackBarListImplement.Models
return;
}
Id = model.Id;
- SnackId = model.SnackId;
+ PrintedId = model.PrintedId;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
@@ -61,7 +61,7 @@ namespace SnackBarListImplement.Models
public OrderViewModel GetViewModel => new()
{
- SnackId = SnackId,
+ PrintedId = PrintedId,
Count = Count,
Sum = Sum,
DateCreate = DateCreate,
diff --git a/SnackBarListImplement/OrderStorage.cs b/TypographyListImplement/OrderStorage.cs
similarity index 74%
rename from SnackBarListImplement/OrderStorage.cs
rename to TypographyListImplement/OrderStorage.cs
index 5a218cd..4876aa0 100644
--- a/SnackBarListImplement/OrderStorage.cs
+++ b/TypographyListImplement/OrderStorage.cs
@@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.StoragesContracts;
-using SnackBarContracts.ViewModels;
-using SnackBarListImplement.Models;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
+using TypographyListImplement.Models;
-namespace SnackBarListImplement.Implements
+namespace TypographyListImplement.Implements
{
public class OrderStorage : IOrderStorage
{
@@ -25,7 +25,7 @@ namespace SnackBarListImplement.Implements
var result = new List();
foreach (var order in _source.Orders)
{
- result.Add(AddSnackName(order.GetViewModel));
+ result.Add(AddPrintedName(order.GetViewModel));
}
return result;
}
@@ -41,7 +41,7 @@ namespace SnackBarListImplement.Implements
{
if (order.Id == model.Id)
{
- result.Add(AddSnackName(order.GetViewModel));
+ result.Add(AddPrintedName(order.GetViewModel));
}
}
return result;
@@ -57,7 +57,7 @@ namespace SnackBarListImplement.Implements
{
if (order.Id == model.Id)
{
- return AddSnackName(order.GetViewModel);
+ return AddPrintedName(order.GetViewModel);
}
}
return null;
@@ -79,7 +79,7 @@ namespace SnackBarListImplement.Implements
return null;
}
_source.Orders.Add(newOrder);
- return AddSnackName(newOrder.GetViewModel);
+ return AddPrintedName(newOrder.GetViewModel);
}
public OrderViewModel? Update(OrderBindingModel model)
@@ -89,7 +89,7 @@ namespace SnackBarListImplement.Implements
if (order.Id == model.Id)
{
order.Update(model);
- return AddSnackName(order.GetViewModel);
+ return AddPrintedName(order.GetViewModel);
}
}
return null;
@@ -103,18 +103,18 @@ namespace SnackBarListImplement.Implements
{
var element = _source.Orders[i];
_source.Orders.RemoveAt(i);
- return AddSnackName(element.GetViewModel);
+ return AddPrintedName(element.GetViewModel);
}
}
return null;
}
- private OrderViewModel AddSnackName(OrderViewModel model)
+ private OrderViewModel AddPrintedName(OrderViewModel model)
{
- var selectedSnack = _source.Snacks.Find(snack => snack.Id == model.SnackId);
- if (selectedSnack != null)
+ var selectedPrinted = _source.Printeds.Find(printed => printed.Id == model.PrintedId);
+ if (selectedPrinted != null)
{
- model.SnackName = selectedSnack.SnackName;
+ model.PrintedName = selectedPrinted.PrintedName;
}
return model;
}
diff --git a/TypographyListImplement/Printed.cs b/TypographyListImplement/Printed.cs
new file mode 100644
index 0000000..f4072b3
--- /dev/null
+++ b/TypographyListImplement/Printed.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TypographyContracts.BindingModels;
+using TypographyContracts.ViewModels;
+using TypographyDataModels.Models;
+
+
+namespace TypographyListImplement.Models
+{
+ public class Printed : IPrintedModel
+ {
+ public int Id { get; private set; }
+ public string PrintedName { get; private set; } = string.Empty;
+ public double Price { get; private set; }
+ public Dictionary PrintedComponents { get; private set; } = new Dictionary();
+ public static Printed? Create(PrintedBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Printed()
+ {
+ Id = model.Id,
+ PrintedName = model.PrintedName,
+ Price = model.Price,
+ PrintedComponents = model.PrintedComponents
+ };
+ }
+ public void Update(PrintedBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ PrintedName = model.PrintedName;
+ Price = model.Price;
+ PrintedComponents = model.PrintedComponents;
+ }
+ public PrintedViewModel GetViewModel => new()
+ {
+ Id = Id,
+ PrintedName = PrintedName,
+ Price = Price,
+ PrintedComponents = PrintedComponents
+ };
+ }
+}
diff --git a/TypographyListImplement/PrintedStorage.cs b/TypographyListImplement/PrintedStorage.cs
new file mode 100644
index 0000000..c202898
--- /dev/null
+++ b/TypographyListImplement/PrintedStorage.cs
@@ -0,0 +1,111 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.ConstrainedExecution;
+using System.Text;
+using System.Threading.Tasks;
+using TypographyContracts.BindingModels;
+using TypographyContracts.SearchModels;
+using TypographyContracts.StoragesContracts;
+using TypographyContracts.ViewModels;
+using TypographyListImplement.Models;
+
+namespace TypographyListImplement.Implements
+{
+ public class PrintedStorage : IPrintedStorage
+ {
+ private readonly DataListSingleton _source;
+
+ public PrintedStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var printed in _source.Printeds)
+ {
+ result.Add(printed.GetViewModel);
+ }
+ return result;
+ }
+
+ public List GetFilteredList(PrintedSearchModel model)
+ {
+ var result = new List();
+ if (string.IsNullOrEmpty(model.PrintedName))
+ {
+ return result;
+ }
+ foreach (var printed in _source.Printeds)
+ {
+ if (printed.PrintedName.Contains(model.PrintedName))
+ {
+ result.Add(printed.GetViewModel);
+ }
+ }
+ return result;
+ }
+ public PrintedViewModel? GetElement(PrintedSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.PrintedName) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ foreach (var printed in _source.Printeds)
+ {
+ if ((!string.IsNullOrEmpty(model.PrintedName) && printed.PrintedName == model.PrintedName) || (model.Id.HasValue && printed.Id == model.Id))
+ {
+ return printed.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ public PrintedViewModel? Insert(PrintedBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var printed in _source.Printeds)
+ {
+ if (model.Id <= printed.Id)
+ {
+ model.Id = printed.Id + 1;
+ }
+ }
+ var newPrinted = Printed.Create(model);
+ if (newPrinted == null)
+ {
+ return null;
+ }
+ _source.Printeds.Add(newPrinted);
+ return newPrinted.GetViewModel;
+ }
+
+ public PrintedViewModel? Update(PrintedBindingModel model)
+ {
+ foreach (var printed in _source.Printeds)
+ {
+ if (printed.Id == model.Id)
+ {
+ printed.Update(model);
+ return printed.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public PrintedViewModel? Delete(PrintedBindingModel model)
+ {
+ for (int i = 0; i < _source.Printeds.Count; ++i)
+ {
+ if (_source.Printeds[i].Id == model.Id)
+ {
+ var element = _source.Printeds[i];
+ _source.Printeds.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/SnackBarListImplement/SnackBarListImplement.csproj b/TypographyListImplement/TypographyListImplement.csproj
similarity index 57%
rename from SnackBarListImplement/SnackBarListImplement.csproj
rename to TypographyListImplement/TypographyListImplement.csproj
index 1297ced..95efe1f 100644
--- a/SnackBarListImplement/SnackBarListImplement.csproj
+++ b/TypographyListImplement/TypographyListImplement.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/SnackBarView/FormComponent.Designer.cs b/TypographyView/FormComponent.Designer.cs
similarity index 99%
rename from SnackBarView/FormComponent.Designer.cs
rename to TypographyView/FormComponent.Designer.cs
index 5606096..57b5e98 100644
--- a/SnackBarView/FormComponent.Designer.cs
+++ b/TypographyView/FormComponent.Designer.cs
@@ -1,4 +1,4 @@
-namespace SnackBarView
+namespace TypographyView
{
partial class FormComponent
{
diff --git a/SnackBarView/FormComponent.cs b/TypographyView/FormComponent.cs
similarity index 94%
rename from SnackBarView/FormComponent.cs
rename to TypographyView/FormComponent.cs
index 9864356..f7925ae 100644
--- a/SnackBarView/FormComponent.cs
+++ b/TypographyView/FormComponent.cs
@@ -1,11 +1,11 @@
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.SearchModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.SearchModels;
using Microsoft.Extensions.Logging;
using System.Windows.Forms;
-namespace SnackBarView
+namespace TypographyView
{
public partial class FormComponent : Form
{
diff --git a/SnackBarView/FormComponent.resx b/TypographyView/FormComponent.resx
similarity index 100%
rename from SnackBarView/FormComponent.resx
rename to TypographyView/FormComponent.resx
diff --git a/SnackBarView/FormComponents.Designer.cs b/TypographyView/FormComponents.Designer.cs
similarity index 99%
rename from SnackBarView/FormComponents.Designer.cs
rename to TypographyView/FormComponents.Designer.cs
index fc46b74..81e8435 100644
--- a/SnackBarView/FormComponents.Designer.cs
+++ b/TypographyView/FormComponents.Designer.cs
@@ -1,4 +1,4 @@
-namespace SnackBarView
+namespace TypographyView
{
partial class FormComponents
{
diff --git a/SnackBarView/FormComponents.cs b/TypographyView/FormComponents.cs
similarity index 97%
rename from SnackBarView/FormComponents.cs
rename to TypographyView/FormComponents.cs
index 2d86660..bcc56dc 100644
--- a/SnackBarView/FormComponents.cs
+++ b/TypographyView/FormComponents.cs
@@ -7,12 +7,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
-namespace SnackBarView
+namespace TypographyView
{
public partial class FormComponents : Form
{
diff --git a/SnackBarView/FormComponents.resx b/TypographyView/FormComponents.resx
similarity index 100%
rename from SnackBarView/FormComponents.resx
rename to TypographyView/FormComponents.resx
diff --git a/SnackBarView/FormCreateOrder.Designer.cs b/TypographyView/FormCreateOrder.Designer.cs
similarity index 80%
rename from SnackBarView/FormCreateOrder.Designer.cs
rename to TypographyView/FormCreateOrder.Designer.cs
index f40d2e5..b22e27b 100644
--- a/SnackBarView/FormCreateOrder.Designer.cs
+++ b/TypographyView/FormCreateOrder.Designer.cs
@@ -1,4 +1,4 @@
-namespace SnackBarView
+namespace TypographyView
{
partial class FormCreateOrder
{
@@ -28,24 +28,24 @@
///
private void InitializeComponent()
{
- labelSnack = new Label();
+ labelPrinted = new Label();
labelCount = new Label();
labelSum = new Label();
- comboBoxSnack = new ComboBox();
+ comboBoxPrinted = new ComboBox();
textBoxCount = new TextBox();
textBoxSum = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
- // labelSnack
+ // labelPrinted
//
- labelSnack.AutoSize = true;
- labelSnack.Location = new Point(12, 22);
- labelSnack.Name = "labelSnack";
- labelSnack.Size = new Size(64, 20);
- labelSnack.TabIndex = 0;
- labelSnack.Text = "Закуска:";
+ labelPrinted.AutoSize = true;
+ labelPrinted.Location = new Point(12, 22);
+ labelPrinted.Name = "labelPrinted";
+ labelPrinted.Size = new Size(71, 20);
+ labelPrinted.TabIndex = 0;
+ labelPrinted.Text = "Изделие:";
//
// labelCount
//
@@ -65,14 +65,14 @@
labelSum.TabIndex = 2;
labelSum.Text = "Сумма:";
//
- // comboBoxSnack
+ // comboBoxPrinted
//
- comboBoxSnack.FormattingEnabled = true;
- comboBoxSnack.Location = new Point(111, 19);
- comboBoxSnack.Name = "comboBoxSnack";
- comboBoxSnack.Size = new Size(238, 28);
- comboBoxSnack.TabIndex = 3;
- comboBoxSnack.SelectedIndexChanged += ComboBoxSnack_SelectedIndexChanged;
+ comboBoxPrinted.FormattingEnabled = true;
+ comboBoxPrinted.Location = new Point(111, 19);
+ comboBoxPrinted.Name = "comboBoxPrinted";
+ comboBoxPrinted.Size = new Size(238, 28);
+ comboBoxPrinted.TabIndex = 3;
+ comboBoxPrinted.SelectedIndexChanged += ComboBoxPrinted_SelectedIndexChanged;
//
// textBoxCount
//
@@ -118,10 +118,10 @@
Controls.Add(buttonSave);
Controls.Add(textBoxSum);
Controls.Add(textBoxCount);
- Controls.Add(comboBoxSnack);
+ Controls.Add(comboBoxPrinted);
Controls.Add(labelSum);
Controls.Add(labelCount);
- Controls.Add(labelSnack);
+ Controls.Add(labelPrinted);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;
@@ -131,10 +131,10 @@
#endregion
- private Label labelSnack;
+ private Label labelPrinted;
private Label labelCount;
private Label labelSum;
- private ComboBox comboBoxSnack;
+ private ComboBox comboBoxPrinted;
private TextBox textBoxCount;
private TextBox textBoxSum;
private Button buttonSave;
diff --git a/SnackBarView/FormCreateOrder.cs b/TypographyView/FormCreateOrder.cs
similarity index 72%
rename from SnackBarView/FormCreateOrder.cs
rename to TypographyView/FormCreateOrder.cs
index 9f6c183..8491661 100644
--- a/SnackBarView/FormCreateOrder.cs
+++ b/TypographyView/FormCreateOrder.cs
@@ -1,22 +1,22 @@
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.SearchModels;
-using SnackBarContracts.ViewModels;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.SearchModels;
+using TypographyContracts.ViewModels;
using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic.Logging;
using System.Windows.Forms;
-namespace SnackBarView
+namespace TypographyView
{
public partial class FormCreateOrder : Form
{
private readonly ILogger _logger;
- private readonly ISnackLogic _logicIC;
+ private readonly IPrintedLogic _logicIC;
private readonly IOrderLogic _logicO;
- public FormCreateOrder(ILogger logger, ISnackLogic logicIC, IOrderLogic logicO)
+ public FormCreateOrder(ILogger logger, IPrintedLogic logicIC, IOrderLogic logicO)
{
InitializeComponent();
_logger = logger;
@@ -26,33 +26,33 @@ namespace SnackBarView
private void FormCreateOrder_Load(object sender, EventArgs e)
{
- _logger.LogInformation("Loading snack for order");
+ _logger.LogInformation("Loading printed for order");
try
{
- var snackList = _logicIC.ReadList(null);
- if (snackList != null)
+ var printedList = _logicIC.ReadList(null);
+ if (printedList != null)
{
- comboBoxSnack.DisplayMember = "SnackName";
- comboBoxSnack.ValueMember = "Id";
- comboBoxSnack.DataSource = snackList;
- comboBoxSnack.SelectedItem = null;
+ comboBoxPrinted.DisplayMember = "PrintedName";
+ comboBoxPrinted.ValueMember = "Id";
+ comboBoxPrinted.DataSource = printedList;
+ comboBoxPrinted.SelectedItem = null;
}
}
catch (Exception ex)
{
- _logger.LogError(ex, "Error during loading snack for order");
+ _logger.LogError(ex, "Error during loading printed for order");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void CalcSum()
{
- if (comboBoxSnack.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
+ if (comboBoxPrinted.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
{
try
{
- int id = Convert.ToInt32(comboBoxSnack.SelectedValue);
- var product = _logicIC.ReadElement(new SnackSearchModel { Id = id });
+ int id = Convert.ToInt32(comboBoxPrinted.SelectedValue);
+ var product = _logicIC.ReadElement(new PrintedSearchModel { Id = id });
int count = Convert.ToInt32(textBoxCount.Text);
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString();
_logger.LogInformation("Calculation of order sum");
@@ -70,7 +70,7 @@ namespace SnackBarView
CalcSum();
}
- private void ComboBoxSnack_SelectedIndexChanged(object sender, EventArgs e)
+ private void ComboBoxPrinted_SelectedIndexChanged(object sender, EventArgs e)
{
CalcSum();
}
@@ -82,7 +82,7 @@ namespace SnackBarView
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- if (comboBoxSnack.SelectedValue == null)
+ if (comboBoxPrinted.SelectedValue == null)
{
MessageBox.Show("Выберите закуску", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@@ -92,7 +92,7 @@ namespace SnackBarView
{
var operationResult = _logicO.CreateOrder(new OrderBindingModel
{
- SnackId = Convert.ToInt32(comboBoxSnack.SelectedValue),
+ PrintedId = Convert.ToInt32(comboBoxPrinted.SelectedValue),
Count = Convert.ToInt32(textBoxCount.Text),
Sum = Convert.ToDouble(textBoxSum.Text)
});
diff --git a/SnackBarView/FormCreateOrder.resx b/TypographyView/FormCreateOrder.resx
similarity index 100%
rename from SnackBarView/FormCreateOrder.resx
rename to TypographyView/FormCreateOrder.resx
diff --git a/SnackBarView/FormMain.Designer.cs b/TypographyView/FormMain.Designer.cs
similarity index 92%
rename from SnackBarView/FormMain.Designer.cs
rename to TypographyView/FormMain.Designer.cs
index 600ad08..dbc094d 100644
--- a/SnackBarView/FormMain.Designer.cs
+++ b/TypographyView/FormMain.Designer.cs
@@ -1,4 +1,4 @@
-namespace SnackBarView
+namespace TypographyView
{
partial class FormMain
{
@@ -31,7 +31,7 @@
menuStrip = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem();
- закускаToolStripMenuItem = new ToolStripMenuItem();
+ изделиеToolStripMenuItem = new ToolStripMenuItem();
dataGridView = new DataGridView();
buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button();
@@ -54,7 +54,7 @@
//
// справочникиToolStripMenuItem
//
- справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, закускаToolStripMenuItem });
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, изделиеToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
@@ -66,12 +66,12 @@
компонентыToolStripMenuItem.Text = "Компоненты";
компонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
//
- // закускаToolStripMenuItem
+ // изделиеToolStripMenuItem
//
- закускаToolStripMenuItem.Name = "закускаToolStripMenuItem";
- закускаToolStripMenuItem.Size = new Size(224, 26);
- закускаToolStripMenuItem.Text = "Закуска";
- закускаToolStripMenuItem.Click += ЗакускаToolStripMenuItem_Click;
+ изделиеToolStripMenuItem.Name = "изделиеToolStripMenuItem";
+ изделиеToolStripMenuItem.Size = new Size(224, 26);
+ изделиеToolStripMenuItem.Text = "Изделие";
+ изделиеToolStripMenuItem.Click += ЗакускаToolStripMenuItem_Click;
//
// dataGridView
//
@@ -149,7 +149,7 @@
Controls.Add(menuStrip);
MainMenuStrip = menuStrip;
Name = "FormMain";
- Text = "Закусочная";
+ Text = "Типография";
Load += FormMain_Load;
menuStrip.ResumeLayout(false);
menuStrip.PerformLayout();
@@ -169,6 +169,6 @@
private Button buttonIssuedOrder;
private Button buttonUpd;
private ToolStripMenuItem компонентыToolStripMenuItem;
- private ToolStripMenuItem закускаToolStripMenuItem;
+ private ToolStripMenuItem изделиеToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/SnackBarView/FormMain.cs b/TypographyView/FormMain.cs
similarity index 92%
rename from SnackBarView/FormMain.cs
rename to TypographyView/FormMain.cs
index 2b884f1..f60a245 100644
--- a/SnackBarView/FormMain.cs
+++ b/TypographyView/FormMain.cs
@@ -7,12 +7,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
-using SnackBarDataModels.Enums;
+using TypographyDataModels.Enums;
-namespace SnackBarView
+namespace TypographyView
{
public partial class FormMain : Form
{
@@ -40,8 +40,8 @@ namespace SnackBarView
if (list != null)
{
dataGridView.DataSource = list;
- dataGridView.Columns["SnackId"].Visible = false;
- dataGridView.Columns["SnackName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["PrintedId"].Visible = false;
+ dataGridView.Columns["PrintedName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Orders loading");
}
@@ -63,8 +63,8 @@ namespace SnackBarView
private void ЗакускаToolStripMenuItem_Click(object sender, EventArgs e)
{
- var service = Program.ServiceProvider?.GetService(typeof(FormSnacks));
- if (service is FormSnacks form)
+ var service = Program.ServiceProvider?.GetService(typeof(FormPrinteds));
+ if (service is FormPrinteds form)
{
form.ShowDialog();
}
@@ -159,7 +159,7 @@ namespace SnackBarView
return new OrderBindingModel
{
Id = id,
- SnackId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["SnackId"].Value),
+ PrintedId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["PrintedId"].Value),
Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
diff --git a/SnackBarView/FormMain.resx b/TypographyView/FormMain.resx
similarity index 100%
rename from SnackBarView/FormMain.resx
rename to TypographyView/FormMain.resx
diff --git a/SnackBarView/FormSnack.Designer.cs b/TypographyView/FormPrinted.Designer.cs
similarity index 76%
rename from SnackBarView/FormSnack.Designer.cs
rename to TypographyView/FormPrinted.Designer.cs
index eb8f56c..d53c6ff 100644
--- a/SnackBarView/FormSnack.Designer.cs
+++ b/TypographyView/FormPrinted.Designer.cs
@@ -1,6 +1,6 @@
-namespace SnackBarView
+namespace TypographyView
{
- partial class FormSnack
+ partial class FormPrinted
{
///
/// Required designer variable.
@@ -50,35 +50,33 @@
// labelName
//
labelName.AutoSize = true;
- labelName.Location = new Point(10, 7);
+ labelName.Location = new Point(11, 9);
labelName.Name = "labelName";
- labelName.Size = new Size(62, 15);
+ labelName.Size = new Size(80, 20);
labelName.TabIndex = 0;
labelName.Text = "Название:";
//
// labelPrice
//
labelPrice.AutoSize = true;
- labelPrice.Location = new Point(10, 42);
+ labelPrice.Location = new Point(11, 56);
labelPrice.Name = "labelPrice";
- labelPrice.Size = new Size(70, 15);
+ labelPrice.Size = new Size(86, 20);
labelPrice.TabIndex = 1;
labelPrice.Text = "Стоимость:";
//
// textBoxName
//
- textBoxName.Location = new Point(86, 4);
- textBoxName.Margin = new Padding(3, 2, 3, 2);
+ textBoxName.Location = new Point(98, 5);
textBoxName.Name = "textBoxName";
- textBoxName.Size = new Size(261, 23);
+ textBoxName.Size = new Size(298, 27);
textBoxName.TabIndex = 2;
//
// textBoxPrice
//
- textBoxPrice.Location = new Point(86, 40);
- textBoxPrice.Margin = new Padding(3, 2, 3, 2);
+ textBoxPrice.Location = new Point(98, 53);
textBoxPrice.Name = "textBoxPrice";
- textBoxPrice.Size = new Size(167, 23);
+ textBoxPrice.Size = new Size(190, 27);
textBoxPrice.TabIndex = 3;
//
// groupBoxComponents
@@ -88,21 +86,18 @@
groupBoxComponents.Controls.Add(buttonEdit);
groupBoxComponents.Controls.Add(buttonAdd);
groupBoxComponents.Controls.Add(dataGridView);
- groupBoxComponents.Location = new Point(10, 64);
- groupBoxComponents.Margin = new Padding(3, 2, 3, 2);
+ groupBoxComponents.Location = new Point(11, 85);
groupBoxComponents.Name = "groupBoxComponents";
- groupBoxComponents.Padding = new Padding(3, 2, 3, 2);
- groupBoxComponents.Size = new Size(679, 263);
+ groupBoxComponents.Size = new Size(776, 351);
groupBoxComponents.TabIndex = 4;
groupBoxComponents.TabStop = false;
groupBoxComponents.Text = "Компоненты";
//
// buttonUpd
//
- buttonUpd.Location = new Point(544, 154);
- buttonUpd.Margin = new Padding(3, 2, 3, 2);
+ buttonUpd.Location = new Point(622, 205);
buttonUpd.Name = "buttonUpd";
- buttonUpd.Size = new Size(103, 27);
+ buttonUpd.Size = new Size(118, 36);
buttonUpd.TabIndex = 4;
buttonUpd.Text = "Обновить";
buttonUpd.UseVisualStyleBackColor = true;
@@ -110,10 +105,9 @@
//
// buttonDel
//
- buttonDel.Location = new Point(544, 113);
- buttonDel.Margin = new Padding(3, 2, 3, 2);
+ buttonDel.Location = new Point(622, 151);
buttonDel.Name = "buttonDel";
- buttonDel.Size = new Size(103, 27);
+ buttonDel.Size = new Size(118, 36);
buttonDel.TabIndex = 3;
buttonDel.Text = "Удалить";
buttonDel.UseVisualStyleBackColor = true;
@@ -121,10 +115,9 @@
//
// buttonEdit
//
- buttonEdit.Location = new Point(544, 74);
- buttonEdit.Margin = new Padding(3, 2, 3, 2);
+ buttonEdit.Location = new Point(622, 99);
buttonEdit.Name = "buttonEdit";
- buttonEdit.Size = new Size(103, 27);
+ buttonEdit.Size = new Size(118, 36);
buttonEdit.TabIndex = 2;
buttonEdit.Text = "Изменить";
buttonEdit.UseVisualStyleBackColor = true;
@@ -132,10 +125,9 @@
//
// buttonAdd
//
- buttonAdd.Location = new Point(544, 31);
- buttonAdd.Margin = new Padding(3, 2, 3, 2);
+ buttonAdd.Location = new Point(622, 41);
buttonAdd.Name = "buttonAdd";
- buttonAdd.Size = new Size(103, 27);
+ buttonAdd.Size = new Size(118, 36);
buttonAdd.TabIndex = 1;
buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true;
@@ -148,13 +140,12 @@
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { Columnid, ColumnName, ColumnCount });
- dataGridView.Location = new Point(5, 20);
- dataGridView.Margin = new Padding(3, 2, 3, 2);
+ dataGridView.Location = new Point(6, 27);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
- dataGridView.Size = new Size(497, 239);
+ dataGridView.Size = new Size(568, 319);
dataGridView.TabIndex = 0;
//
// Columnid
@@ -183,10 +174,9 @@
//
// buttonSave
//
- buttonSave.Location = new Point(478, 332);
- buttonSave.Margin = new Padding(3, 2, 3, 2);
+ buttonSave.Location = new Point(546, 443);
buttonSave.Name = "buttonSave";
- buttonSave.Size = new Size(103, 27);
+ buttonSave.Size = new Size(118, 36);
buttonSave.TabIndex = 5;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@@ -194,20 +184,19 @@
//
// buttonCancel
//
- buttonCancel.Location = new Point(586, 332);
- buttonCancel.Margin = new Padding(3, 2, 3, 2);
+ buttonCancel.Location = new Point(670, 443);
buttonCancel.Name = "buttonCancel";
- buttonCancel.Size = new Size(103, 27);
+ buttonCancel.Size = new Size(118, 36);
buttonCancel.TabIndex = 6;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
- // FormSnack
+ // FormPrinted
//
- AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(700, 368);
+ ClientSize = new Size(800, 491);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(groupBoxComponents);
@@ -215,10 +204,9 @@
Controls.Add(textBoxName);
Controls.Add(labelPrice);
Controls.Add(labelName);
- Margin = new Padding(3, 2, 3, 2);
- Name = "FormSnack";
- Text = "Закуски";
- Load += FormSnack_Load;
+ Name = "FormPrinted";
+ Text = "Изделия";
+ Load += FormPrinted_Load;
groupBoxComponents.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
diff --git a/SnackBarView/FormSnack.cs b/TypographyView/FormPrinted.cs
similarity index 72%
rename from SnackBarView/FormSnack.cs
rename to TypographyView/FormPrinted.cs
index 922bf54..b41844f 100644
--- a/SnackBarView/FormSnack.cs
+++ b/TypographyView/FormPrinted.cs
@@ -7,55 +7,55 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.SearchModels;
-using SnackBarDataModels.Models;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.SearchModels;
+using TypographyDataModels.Models;
using Microsoft.Extensions.Logging;
using Microsoft.VisualBasic.Logging;
using NLog.Extensions.Logging;
-namespace SnackBarView
+namespace TypographyView
{
- public partial class FormSnack : Form
+ public partial class FormPrinted : Form
{
private readonly ILogger _logger;
- private readonly ISnackLogic _logic;
+ private readonly IPrintedLogic _logic;
private int? _id;
- private Dictionary _snackComponents;
+ private Dictionary _printedComponents;
public int Id { set { _id = value; } }
- public FormSnack(ILogger logger, ISnackLogic logic)
+ public FormPrinted(ILogger logger, IPrintedLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
- _snackComponents = new Dictionary();
+ _printedComponents = new Dictionary();
}
- private void FormSnack_Load(object sender, EventArgs e)
+ private void FormPrinted_Load(object sender, EventArgs e)
{
if (_id.HasValue)
{
- _logger.LogInformation("Snack loading");
+ _logger.LogInformation("Printed loading");
try
{
- var view = _logic.ReadElement(new SnackSearchModel { Id = _id.Value });
+ var view = _logic.ReadElement(new PrintedSearchModel { Id = _id.Value });
if (view != null)
{
- textBoxName.Text = view.SnackName;
+ textBoxName.Text = view.PrintedName;
textBoxPrice.Text = view.Price.ToString();
- _snackComponents = view.SnackComponents ?? new Dictionary();
+ _printedComponents = view.PrintedComponents ?? new Dictionary();
LoadData();
}
}
catch (Exception ex)
{
- _logger.LogError(ex, "Snack loading error");
+ _logger.LogError(ex, "Printed loading error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@@ -63,15 +63,15 @@ namespace SnackBarView
private void LoadData()
{
- _logger.LogInformation("Snack components loading");
+ _logger.LogInformation("Printed components loading");
try
{
- if (_snackComponents != null)
+ if (_printedComponents != null)
{
dataGridView.Rows.Clear();
- foreach (var snackC in _snackComponents)
+ foreach (var printedC in _printedComponents)
{
- dataGridView.Rows.Add(new object[] { snackC.Key, snackC.Value.Item1.ComponentName, snackC.Value.Item2 });
+ dataGridView.Rows.Add(new object[] { printedC.Key, printedC.Value.Item1.ComponentName, printedC.Value.Item2 });
}
textBoxPrice.Text = CalcPrice().ToString();
}
@@ -85,8 +85,8 @@ namespace SnackBarView
private void ButtonAdd_Click(object sender, EventArgs e)
{
- var service = Program.ServiceProvider?.GetService(typeof(FormSnackComponent));
- if (service is FormSnackComponent form)
+ var service = Program.ServiceProvider?.GetService(typeof(FormPrintedComponent));
+ if (service is FormPrintedComponent form)
{
if (form.ShowDialog() == DialogResult.OK)
{
@@ -95,13 +95,13 @@ namespace SnackBarView
return;
}
_logger.LogInformation("Adding new component: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
- if (_snackComponents.ContainsKey(form.Id))
+ if (_printedComponents.ContainsKey(form.Id))
{
- _snackComponents[form.Id] = (form.ComponentModel, form.Count);
+ _printedComponents[form.Id] = (form.ComponentModel, form.Count);
}
else
{
- _snackComponents.Add(form.Id, (form.ComponentModel, form.Count));
+ _printedComponents.Add(form.Id, (form.ComponentModel, form.Count));
}
LoadData();
}
@@ -112,12 +112,12 @@ namespace SnackBarView
{
if (dataGridView.SelectedRows.Count == 1)
{
- var service = Program.ServiceProvider?.GetService(typeof(FormSnackComponent));
- if (service is FormSnackComponent form)
+ var service = Program.ServiceProvider?.GetService(typeof(FormPrintedComponent));
+ if (service is FormPrintedComponent form)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
form.Id = id;
- form.Count = _snackComponents[id].Item2;
+ form.Count = _printedComponents[id].Item2;
if (form.ShowDialog() == DialogResult.OK)
{
if (form.ComponentModel == null)
@@ -125,7 +125,7 @@ namespace SnackBarView
return;
}
_logger.LogInformation("Component editing: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
- _snackComponents[form.Id] = (form.ComponentModel, form.Count);
+ _printedComponents[form.Id] = (form.ComponentModel, form.Count);
LoadData();
}
}
@@ -142,7 +142,7 @@ namespace SnackBarView
{
_logger.LogInformation("Deletion of component: {ComponentName} - {Count}", dataGridView.SelectedRows[0].Cells[1].Value,
dataGridView.SelectedRows[0].Cells[2].Value);
- _snackComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
+ _printedComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
}
catch (Exception ex)
{
@@ -170,20 +170,20 @@ namespace SnackBarView
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- if (_snackComponents == null || _snackComponents.Count == 0)
+ if (_printedComponents == null || _printedComponents.Count == 0)
{
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
- _logger.LogInformation("Snack saving");
+ _logger.LogInformation("Printed saving");
try
{
- var model = new SnackBindingModel
+ var model = new PrintedBindingModel
{
Id = _id ?? 0,
- SnackName = textBoxName.Text,
+ PrintedName = textBoxName.Text,
Price = Convert.ToDouble(textBoxPrice.Text),
- SnackComponents = _snackComponents
+ PrintedComponents = _printedComponents
};
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
if (!operationResult)
@@ -196,7 +196,7 @@ namespace SnackBarView
}
catch (Exception ex)
{
- _logger.LogError(ex, "Snack saving error");
+ _logger.LogError(ex, "Printed saving error");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@@ -210,7 +210,7 @@ namespace SnackBarView
private double CalcPrice()
{
double price = 0;
- foreach (var elem in _snackComponents)
+ foreach (var elem in _printedComponents)
{
price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
}
diff --git a/SnackBarView/FormSnack.resx b/TypographyView/FormPrinted.resx
similarity index 100%
rename from SnackBarView/FormSnack.resx
rename to TypographyView/FormPrinted.resx
diff --git a/SnackBarView/FormSnackComponent.Designer.cs b/TypographyView/FormPrintedComponent.Designer.cs
similarity index 95%
rename from SnackBarView/FormSnackComponent.Designer.cs
rename to TypographyView/FormPrintedComponent.Designer.cs
index 6789c4c..e9b2dc0 100644
--- a/SnackBarView/FormSnackComponent.Designer.cs
+++ b/TypographyView/FormPrintedComponent.Designer.cs
@@ -1,6 +1,6 @@
-namespace SnackBarView
+namespace TypographyView
{
- partial class FormSnackComponent
+ partial class FormPrintedComponent
{
///
/// Required designer variable.
@@ -89,7 +89,7 @@
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
- // FormSnackComponent
+ // FormPrintedComponent
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
@@ -100,8 +100,8 @@
Controls.Add(comboBoxComponent);
Controls.Add(labelCount);
Controls.Add(labelComponent);
- Name = "FormSnackComponent";
- Text = "Компонент закуски";
+ Name = "FormPrintedComponent";
+ Text = "Компонент изделия";
ResumeLayout(false);
PerformLayout();
}
diff --git a/SnackBarView/FormSnackComponent.cs b/TypographyView/FormPrintedComponent.cs
similarity index 90%
rename from SnackBarView/FormSnackComponent.cs
rename to TypographyView/FormPrintedComponent.cs
index a893d5c..f59e1a3 100644
--- a/SnackBarView/FormSnackComponent.cs
+++ b/TypographyView/FormPrintedComponent.cs
@@ -7,13 +7,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.ViewModels;
-using SnackBarDataModels.Models;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.ViewModels;
+using TypographyDataModels.Models;
-namespace SnackBarView
+namespace TypographyView
{
- public partial class FormSnackComponent : Form
+ public partial class FormPrintedComponent : Form
{
private readonly List? _list;
public int Id
@@ -51,7 +51,7 @@ namespace SnackBarView
set { textBoxCount.Text = value.ToString(); }
}
- public FormSnackComponent(IComponentLogic logic)
+ public FormPrintedComponent(IComponentLogic logic)
{
InitializeComponent();
_list = logic.ReadList(null);
diff --git a/SnackBarView/FormSnackComponent.resx b/TypographyView/FormPrintedComponent.resx
similarity index 100%
rename from SnackBarView/FormSnackComponent.resx
rename to TypographyView/FormPrintedComponent.resx
diff --git a/SnackBarView/FormSnacks.Designer.cs b/TypographyView/FormPrinteds.Designer.cs
similarity index 95%
rename from SnackBarView/FormSnacks.Designer.cs
rename to TypographyView/FormPrinteds.Designer.cs
index 36aab48..aef392b 100644
--- a/SnackBarView/FormSnacks.Designer.cs
+++ b/TypographyView/FormPrinteds.Designer.cs
@@ -1,6 +1,6 @@
-namespace SnackBarView
+namespace TypographyView
{
- partial class FormSnacks
+ partial class FormPrinteds
{
///
/// Required designer variable.
@@ -87,7 +87,7 @@
buttonUpd.UseVisualStyleBackColor = true;
buttonUpd.Click += ButtonUpd_Click;
//
- // FormSnacks
+ // FormPrinteds
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
@@ -97,9 +97,9 @@
Controls.Add(buttonEdit);
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
- Name = "FormSnacks";
- Text = "Закуски";
- Load += FormSnacks_Load;
+ Name = "FormPrinteds";
+ Text = "Изделия";
+ Load += FormPrinteds_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
diff --git a/SnackBarView/FormSnacks.cs b/TypographyView/FormPrinteds.cs
similarity index 80%
rename from SnackBarView/FormSnacks.cs
rename to TypographyView/FormPrinteds.cs
index 223fbd5..2a5a2d6 100644
--- a/SnackBarView/FormSnacks.cs
+++ b/TypographyView/FormPrinteds.cs
@@ -7,26 +7,26 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using SnackBarContracts.BindingModels;
-using SnackBarContracts.BusinessLogicsContracts;
+using TypographyContracts.BindingModels;
+using TypographyContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
-namespace SnackBarView
+namespace TypographyView
{
- public partial class FormSnacks : Form
+ public partial class FormPrinteds : Form
{
private readonly ILogger _logger;
- private readonly ISnackLogic _logic;
+ private readonly IPrintedLogic _logic;
- public FormSnacks(ILogger logger, ISnackLogic logic)
+ public FormPrinteds(ILogger logger, IPrintedLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
}
- private void FormSnacks_Load(object sender, EventArgs e)
+ private void FormPrinteds_Load(object sender, EventArgs e)
{
LoadData();
}
@@ -40,8 +40,8 @@ namespace SnackBarView
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
- dataGridView.Columns["SnackName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
- dataGridView.Columns["SnackComponents"].Visible = false;
+ dataGridView.Columns["PrintedName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["PrintedComponents"].Visible = false;
}
_logger.LogInformation("Ice creams loading");
}
@@ -54,8 +54,8 @@ namespace SnackBarView
private void ButtonAdd_Click(object sender, EventArgs e)
{
- var service = Program.ServiceProvider?.GetService(typeof(FormSnack));
- if (service is FormSnack form)
+ var service = Program.ServiceProvider?.GetService(typeof(FormPrinted));
+ if (service is FormPrinted form)
{
if (form.ShowDialog() == DialogResult.OK)
{
@@ -68,8 +68,8 @@ namespace SnackBarView
{
if (dataGridView.SelectedRows.Count == 1)
{
- var service = Program.ServiceProvider?.GetService(typeof(FormSnack));
- if (service is FormSnack form)
+ var service = Program.ServiceProvider?.GetService(typeof(FormPrinted));
+ if (service is FormPrinted form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
@@ -90,7 +90,7 @@ namespace SnackBarView
_logger.LogInformation("Deletion of ice cream");
try
{
- if (!_logic.Delete(new SnackBindingModel { Id = id }))
+ if (!_logic.Delete(new PrintedBindingModel { Id = id }))
{
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
}
diff --git a/SnackBarView/FormSnacks.resx b/TypographyView/FormPrinteds.resx
similarity index 100%
rename from SnackBarView/FormSnacks.resx
rename to TypographyView/FormPrinteds.resx
diff --git a/SnackBarView/Program.cs b/TypographyView/Program.cs
similarity index 76%
rename from SnackBarView/Program.cs
rename to TypographyView/Program.cs
index dcf07d6..c3b8cca 100644
--- a/SnackBarView/Program.cs
+++ b/TypographyView/Program.cs
@@ -1,12 +1,12 @@
-using SnackBarBusinessLogic.BusinessLogics;
-using SnackBarContracts.BusinessLogicsContracts;
-using SnackBarContracts.StoragesContracts;
-using SnackBarListImplement.Implements;
+using TypographyBusinessLogic.BusinessLogics;
+using TypographyContracts.BusinessLogicsContracts;
+using TypographyContracts.StoragesContracts;
+using TypographyListImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
-namespace SnackBarView
+namespace TypographyView
{
internal static class Program
{
@@ -35,19 +35,19 @@ namespace SnackBarView
});
services.AddTransient();
services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/SnackBarView/Properties/Resources.Designer.cs b/TypographyView/Properties/Resources.Designer.cs
similarity index 95%
rename from SnackBarView/Properties/Resources.Designer.cs
rename to TypographyView/Properties/Resources.Designer.cs
index 51ee88a..de83124 100644
--- a/SnackBarView/Properties/Resources.Designer.cs
+++ b/TypographyView/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace SnackBarView.Properties {
+namespace TypographyView.Properties {
using System;
@@ -39,7 +39,7 @@ namespace SnackBarView.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SnackBarView.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TypographyView.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/SnackBarView/Properties/Resources.resx b/TypographyView/Properties/Resources.resx
similarity index 100%
rename from SnackBarView/Properties/Resources.resx
rename to TypographyView/Properties/Resources.resx
diff --git a/SnackBarView/SnackBarView.csproj b/TypographyView/TypographyView.csproj
similarity index 50%
rename from SnackBarView/SnackBarView.csproj
rename to TypographyView/TypographyView.csproj
index db26832..443c7f0 100644
--- a/SnackBarView/SnackBarView.csproj
+++ b/TypographyView/TypographyView.csproj
@@ -9,17 +9,14 @@
-
-
-
-
-
-
-
+
+
+
+
diff --git a/SnackBarView/SnackBarView.sln b/TypographyView/TypographyView.sln
similarity index 73%
rename from SnackBarView/SnackBarView.sln
rename to TypographyView/TypographyView.sln
index 4bf7f75..71b5d33 100644
--- a/SnackBarView/SnackBarView.sln
+++ b/TypographyView/TypographyView.sln
@@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34525.116
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SnackBarView", "SnackBarView.csproj", "{F33DFCDC-9D11-44B7-9A5B-794E500A2B7B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypographyView", "TypographyView.csproj", "{F33DFCDC-9D11-44B7-9A5B-794E500A2B7B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnackBarListImplement", "..\SnackBarListImplement\SnackBarListImplement.csproj", "{9D223B95-71A3-4914-9532-A4D8B31288FD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypographyListImplement", "..\TypographyListImplement\TypographyListImplement.csproj", "{9D223B95-71A3-4914-9532-A4D8B31288FD}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnackBarDataModels", "..\SnackBarDataModels\SnackBarDataModels.csproj", "{11F46ADA-6833-42AD-BF19-78A7826BC741}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypographyDataModels", "..\TypographyDataModels\TypographyDataModels.csproj", "{11F46ADA-6833-42AD-BF19-78A7826BC741}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnackBarContracts", "..\SnackBarContracts\SnackBarContracts.csproj", "{E8B5103A-3CAB-4C14-9DC8-6FFF40CA0D34}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypographyContracts", "..\TypographyContracts\TypographyContracts.csproj", "{E8B5103A-3CAB-4C14-9DC8-6FFF40CA0D34}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SnackBarBusinessLogic", "..\SnackBarBusinessLogic\SnackBarBusinessLogic.csproj", "{1057A33D-538D-4E7F-862B-1FF8E9E021A0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TypographyBusinessLogic", "..\TypographyBusinessLogic\TypographyBusinessLogic.csproj", "{1057A33D-538D-4E7F-862B-1FF8E9E021A0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/SnackBarView/nlog.config b/TypographyView/nlog.config
similarity index 100%
rename from SnackBarView/nlog.config
rename to TypographyView/nlog.config