Усе работает!!!!
This commit is contained in:
parent
3f9b829835
commit
96c38b0049
@ -113,34 +113,40 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
var order = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
if (order == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(order));
|
||||
}
|
||||
if (newStatus - model.Status == 1)
|
||||
{
|
||||
model.Status = newStatus;
|
||||
|
||||
if (_orderStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update order operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (order.Status + 1 != newStatus)
|
||||
{
|
||||
_logger.LogWarning("Change status operation failed. Incorrect new status: {newStatus}. Current status: {currStatus}", newStatus, order.Status);
|
||||
return false;
|
||||
}
|
||||
_logger.LogWarning("Changing status operation faled: current:{Status}: required:{newStatus}.", model.Status, newStatus);
|
||||
throw new ArgumentException($"Невозможно присвоить статус {newStatus} заказу с текущим статусом {model.Status}");
|
||||
}
|
||||
public bool ChangeStatus(OrderBindingModel model, OrderStatus newStatus)
|
||||
{
|
||||
var vmodel = _orderStorage.GetElement(new() { Id = model.Id });
|
||||
|
||||
if (vmodel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if ((int)vmodel.Status + 1 != (int)newStatus)
|
||||
{
|
||||
throw new InvalidOperationException($"Попытка перевести заказ не в следующий статус: " +
|
||||
$"Текущий статус: {vmodel.Status} \n" +
|
||||
$"Планируемый статус: {newStatus} \n" +
|
||||
$"Доступный статус: {(OrderStatus)((int)vmodel.Status + 1)}");
|
||||
}
|
||||
|
||||
model.Status = newStatus;
|
||||
model.DateCreate = vmodel.DateCreate;
|
||||
|
||||
model.ProductId = vmodel.ProductId;
|
||||
model.Sum = vmodel.Sum;
|
||||
model.Count = vmodel.Count;
|
||||
|
||||
var result = _orderStorage.Update(model);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Перевод заказа в состояние выполнения
|
||||
public bool TakeOrderInWork(OrderBindingModel model)
|
||||
|
@ -15,17 +15,11 @@ namespace DiningRoomBusinessLogic.BusinessLogic
|
||||
_componentStorage = ComponentStorage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение отчёта для Word или Excel
|
||||
/// </summary>
|
||||
public List<ReportComponentOrderViewModel> GetReportComponentsWithShipments(List<ComponentSearchModel> SelectedComponents)
|
||||
public List<ReportComponentOrderViewModel> GetReportComponentsWithOrders(List<ComponentSearchModel> SelectedComponents)
|
||||
{
|
||||
return _componentStorage.GetComponentsOrders(SelectedComponents);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение отчёта для отправки на почту
|
||||
/// </summary>
|
||||
public List<ReportComponentByDateViewModel> GetReportComponentsByCardDate(ReportBindingModel Report)
|
||||
{
|
||||
return _componentStorage.GetComponentsByDate(Report);
|
||||
|
@ -11,7 +11,6 @@ namespace DiningRoomContracts.BindingModels
|
||||
public class CardBindingModel : ICardModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? DrinkId { get; set; }
|
||||
public string CardName { get; set; } = string.Empty;
|
||||
public DateTime DateCardCreate { get; set; } = DateTime.Now;
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace DiningRoomContracts.BindingModels
|
||||
public class DrinkBindingModel : IDrinkModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CardId { get; set; }
|
||||
public string CardName { get; set; } = string.Empty;
|
||||
|
||||
public string DrinkName { get; set; } = string.Empty;
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace DiningRoomContracts.BusinessLogicContracts
|
||||
/// <summary>
|
||||
/// Получение отчёта для Word или Excel
|
||||
/// </summary>
|
||||
List<ReportComponentOrderViewModel> GetReportComponentsWithShipments(List<ComponentSearchModel> SelectedComponents);
|
||||
List<ReportComponentOrderViewModel> GetReportComponentsWithOrders(List<ComponentSearchModel> SelectedComponents);
|
||||
|
||||
/// <summary>
|
||||
/// Получение отчёта для отправки на почту
|
||||
|
@ -6,6 +6,8 @@ namespace DiningRoomContracts.ViewModels
|
||||
public class DrinkViewModel : IDrinkModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CardId { get; set; }
|
||||
[DisplayName("Алкогольная карта")]
|
||||
public string CardName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Название товара")]
|
||||
|
@ -15,10 +15,11 @@
|
||||
/// Стоимость товара
|
||||
/// </summary>
|
||||
double Cost { get; }
|
||||
public int CardId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Список продуктов
|
||||
/// </summary>
|
||||
Dictionary<int, (IComponentModel, int)> DrinkComponents { get; }
|
||||
/// <summary>
|
||||
/// Список продуктов
|
||||
/// </summary>
|
||||
Dictionary<int, (IComponentModel, int)> DrinkComponents { get; }
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ namespace DiningRoomDataModels.Models
|
||||
/// </summary>
|
||||
DateTime DateCreate { get; }
|
||||
int ProductId { get; }
|
||||
string ProductName { get; }
|
||||
/// <summary>
|
||||
/// Статус заказа
|
||||
/// </summary>
|
||||
|
@ -14,7 +14,6 @@ namespace DiningRoomDatabaseImplement.Implements
|
||||
{
|
||||
public class CardStorage : ICardStorage
|
||||
{
|
||||
//id пользователя учитывается в GetFilteredList
|
||||
public List<CardViewModel> GetFullList()
|
||||
{
|
||||
using var context = new DiningRoomDatabase();
|
||||
|
@ -13,7 +13,8 @@ namespace DiningRoomDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new DiningRoomDatabase();
|
||||
return context.Drinks
|
||||
.Include(x => x.Components)
|
||||
.Include(x => x.Card)
|
||||
.Include(x => x.Components)
|
||||
.ThenInclude(x => x.Component)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
@ -28,7 +29,8 @@ namespace DiningRoomDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new DiningRoomDatabase();
|
||||
return context.Drinks
|
||||
.Include(x => x.Components)
|
||||
.Include(x => x.Card)
|
||||
.Include(x => x.Components)
|
||||
.ThenInclude(x => x.Component)
|
||||
.Where(x => x.DrinkName.Contains(model.DrinkName))
|
||||
.ToList()
|
||||
@ -44,7 +46,8 @@ namespace DiningRoomDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new DiningRoomDatabase();
|
||||
return context.Drinks
|
||||
.Include(x => x.Components)
|
||||
.Include(x => x.Card)
|
||||
.Include(x => x.Components)
|
||||
.ThenInclude(x => x.Component)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.DrinkName) && x.DrinkName == model.DrinkName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
|
@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace DiningRoomDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(DiningRoomDatabase))]
|
||||
[Migration("20240525195148_InitialCreate")]
|
||||
[Migration("20240526010428_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -25,21 +25,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CardDrink", b =>
|
||||
{
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DrinkId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("CardId", "DrinkId");
|
||||
|
||||
b.HasIndex("DrinkId");
|
||||
|
||||
b.ToTable("CardDrink");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -101,6 +86,9 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
@ -113,6 +101,8 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Drinks");
|
||||
@ -161,10 +151,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -259,21 +245,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CardDrink", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Card", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Drink", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DrinkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.User", null)
|
||||
@ -290,9 +261,17 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Drink", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Card", "Card")
|
||||
.WithMany("Drinks")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.User", null)
|
||||
.WithMany("Drinks")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Card");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.DrinkComponent", b =>
|
||||
@ -355,6 +334,11 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("Drinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("DrinkComponents");
|
@ -68,26 +68,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Drinks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DrinkName = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Drinks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Drinks_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
@ -109,54 +89,30 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CardDrink",
|
||||
name: "Drinks",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DrinkName = table.Column<string>(type: "text", nullable: false),
|
||||
CardId = table.Column<int>(type: "integer", nullable: false),
|
||||
DrinkId = table.Column<int>(type: "integer", nullable: false)
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false),
|
||||
UserId = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CardDrink", x => new { x.CardId, x.DrinkId });
|
||||
table.PrimaryKey("PK_Drinks", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CardDrink_Cards_CardId",
|
||||
name: "FK_Drinks_Cards_CardId",
|
||||
column: x => x.CardId,
|
||||
principalTable: "Cards",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CardDrink_Drinks_DrinkId",
|
||||
column: x => x.DrinkId,
|
||||
principalTable: "Drinks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DrinkComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DrinkId = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DrinkComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DrinkComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DrinkComponents_Drinks_DrinkId",
|
||||
column: x => x.DrinkId,
|
||||
principalTable: "Drinks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
name: "FK_Drinks_Users_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -166,7 +122,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProductId = table.Column<int>(type: "integer", nullable: false),
|
||||
ProductName = table.Column<string>(type: "text", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false),
|
||||
Sum = table.Column<double>(type: "double precision", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
@ -216,10 +171,32 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CardDrink_DrinkId",
|
||||
table: "CardDrink",
|
||||
column: "DrinkId");
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DrinkComponents",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
DrinkId = table.Column<int>(type: "integer", nullable: false),
|
||||
ComponentId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DrinkComponents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DrinkComponents_Components_ComponentId",
|
||||
column: x => x.ComponentId,
|
||||
principalTable: "Components",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_DrinkComponents_Drinks_DrinkId",
|
||||
column: x => x.DrinkId,
|
||||
principalTable: "Drinks",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cards_UserId",
|
||||
@ -241,6 +218,11 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
table: "DrinkComponents",
|
||||
column: "DrinkId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Drinks_CardId",
|
||||
table: "Drinks",
|
||||
column: "CardId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Drinks_UserId",
|
||||
table: "Drinks",
|
||||
@ -275,9 +257,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CardDrink");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DrinkComponents");
|
||||
|
||||
@ -287,9 +266,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProductComponents");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Drinks");
|
||||
|
||||
@ -299,6 +275,9 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
@ -22,21 +22,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("CardDrink", b =>
|
||||
{
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DrinkId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("CardId", "DrinkId");
|
||||
|
||||
b.HasIndex("DrinkId");
|
||||
|
||||
b.ToTable("CardDrink");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -98,6 +83,9 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
@ -110,6 +98,8 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Drinks");
|
||||
@ -158,10 +148,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -256,21 +242,6 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CardDrink", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Card", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Drink", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("DrinkId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.User", null)
|
||||
@ -287,9 +258,17 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Drink", b =>
|
||||
{
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.Card", "Card")
|
||||
.WithMany("Drinks")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("DiningRoomDatabaseImplement.Models.User", null)
|
||||
.WithMany("Drinks")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Card");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.DrinkComponent", b =>
|
||||
@ -352,6 +331,11 @@ namespace DiningRoomDatabaseImplement.Migrations
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("Drinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiningRoomDatabaseImplement.Models.Component", b =>
|
||||
{
|
||||
b.Navigation("DrinkComponents");
|
||||
|
@ -14,11 +14,11 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
|
||||
[Required]
|
||||
public string DrinkName { get; private set; } = string.Empty;
|
||||
public int CardId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Required]
|
||||
public double Cost { get; private set; }
|
||||
[ForeignKey("DrinkId")]
|
||||
public virtual List<Card> Card { get; set; } = new();
|
||||
public virtual Card Card { get; set; }
|
||||
|
||||
[ForeignKey("DrinkId")]
|
||||
public virtual List<DrinkComponent> Components { get; set; } = new();
|
||||
@ -48,7 +48,8 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
{
|
||||
Id = Model.Id,
|
||||
DrinkName = Model.DrinkName,
|
||||
Cost = Model.Cost,
|
||||
CardId = Model.CardId,
|
||||
Cost = Model.Cost,
|
||||
Components = Model.DrinkComponents.Select(x => new DrinkComponent
|
||||
{
|
||||
Component = Context.Components.First(y => y.Id == x.Key),
|
||||
@ -60,6 +61,7 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
{
|
||||
DrinkName = model.DrinkName;
|
||||
Cost = model.Cost;
|
||||
CardId = model.CardId;
|
||||
}
|
||||
public DrinkViewModel GetViewModel
|
||||
{
|
||||
@ -72,7 +74,9 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
Id = Id,
|
||||
DrinkName = DrinkName,
|
||||
Cost = Cost,
|
||||
DrinkComponents = DrinkComponents
|
||||
CardId = CardId,
|
||||
CardName = context.Cards.FirstOrDefault(x => x.Id == CardId)?.CardName ?? string.Empty,
|
||||
DrinkComponents = DrinkComponents
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
[Required]
|
||||
public int ProductId { get; set; }
|
||||
[Required]
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
[Required]
|
||||
public double Sum { get; set; }
|
||||
@ -27,6 +25,7 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
public OrderStatus Status { get; set; }
|
||||
[Required]
|
||||
public DateTime DateCreate { get; set; }
|
||||
|
||||
public virtual Product Product { get; set; }
|
||||
|
||||
|
||||
@ -40,7 +39,6 @@ namespace DiningRoomDatabaseImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
ProductId = model.ProductId,
|
||||
ProductName = model.ProductName,
|
||||
DateCreate = model.DateCreate,
|
||||
Status = model.Status,
|
||||
Count = model.Count,
|
||||
|
125
DiningRoom/DiningRoomView/FormCards.Designer.cs
generated
Normal file
125
DiningRoom/DiningRoomView/FormCards.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
||||
namespace DiningRoomView
|
||||
{
|
||||
partial class FormCards
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
ButtonAdd = new Button();
|
||||
ButtonUpd = new Button();
|
||||
ButtonDel = new Button();
|
||||
ButtonRef = new Button();
|
||||
textBoxName = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(433, 448);
|
||||
dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(439, 116);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(225, 23);
|
||||
ButtonAdd.TabIndex = 1;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// ButtonUpd
|
||||
//
|
||||
ButtonUpd.Location = new Point(439, 145);
|
||||
ButtonUpd.Name = "ButtonUpd";
|
||||
ButtonUpd.Size = new Size(225, 23);
|
||||
ButtonUpd.TabIndex = 2;
|
||||
ButtonUpd.Text = "Изменить";
|
||||
ButtonUpd.UseVisualStyleBackColor = true;
|
||||
ButtonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(439, 174);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(225, 23);
|
||||
ButtonDel.TabIndex = 3;
|
||||
ButtonDel.Text = "Удалить";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(439, 203);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(225, 23);
|
||||
ButtonRef.TabIndex = 4;
|
||||
ButtonRef.Text = "Обновить";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(439, 30);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(225, 23);
|
||||
textBoxName.TabIndex = 5;
|
||||
//
|
||||
// FormCards
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(668, 450);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(ButtonRef);
|
||||
Controls.Add(ButtonDel);
|
||||
Controls.Add(ButtonUpd);
|
||||
Controls.Add(ButtonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormCards";
|
||||
Text = "Изделия";
|
||||
Load += FormWoods_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dataGridView;
|
||||
private System.Windows.Forms.Button ButtonAdd;
|
||||
private System.Windows.Forms.Button ButtonUpd;
|
||||
private System.Windows.Forms.Button ButtonDel;
|
||||
private System.Windows.Forms.Button ButtonRef;
|
||||
private TextBox textBoxName;
|
||||
}
|
||||
}
|
141
DiningRoom/DiningRoomView/FormCards.cs
Normal file
141
DiningRoom/DiningRoomView/FormCards.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using DiningRoomContracts.BindingModels;
|
||||
using DiningRoomContracts.BusinessLogicContracts;
|
||||
using DiningRoomContracts.SearchModels;
|
||||
using DiningRoomDataModels.Models;
|
||||
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;
|
||||
using static System.Windows.Forms.DataFormats;
|
||||
|
||||
namespace DiningRoomView
|
||||
{
|
||||
public partial class FormCards : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ICardLogic _logic;
|
||||
public FormCards(ILogger<FormCards> logger, ICardLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
private void FormWoods_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["CardName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
|
||||
}
|
||||
_logger.LogInformation("Загрузка карт");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки карт");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение карты");
|
||||
try
|
||||
{
|
||||
var model = new CardBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
CardName = textBoxName.Text,
|
||||
};
|
||||
var operationResult =_logic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения карты");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение карты");
|
||||
try
|
||||
{
|
||||
int _id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
var model = new CardBindingModel
|
||||
{
|
||||
Id = _id,
|
||||
CardName = textBoxName.Text,
|
||||
};
|
||||
var operationResult = _logic.Update(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения карты");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Удаление карты");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new CardBindingModel { Id = id }))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления продукта");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
DiningRoom/DiningRoomView/FormCards.resx
Normal file
120
DiningRoom/DiningRoomView/FormCards.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
143
DiningRoom/DiningRoomView/FormCreateOrder.Designer.cs
generated
Normal file
143
DiningRoom/DiningRoomView/FormCreateOrder.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
||||
namespace DiningRoomView
|
||||
{
|
||||
partial class FormCreateOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
labelProduct = new Label();
|
||||
labelCount = new Label();
|
||||
labelSum = new Label();
|
||||
comboBoxProduct = new ComboBox();
|
||||
textBoxCount = new TextBox();
|
||||
textBoxSum = new TextBox();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelProduct
|
||||
//
|
||||
labelProduct.AutoSize = true;
|
||||
labelProduct.Location = new Point(12, 8);
|
||||
labelProduct.Name = "labelProduct";
|
||||
labelProduct.Size = new Size(53, 15);
|
||||
labelProduct.TabIndex = 0;
|
||||
labelProduct.Text = "Изделие";
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(12, 37);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(72, 15);
|
||||
labelCount.TabIndex = 1;
|
||||
labelCount.Text = "Количество";
|
||||
//
|
||||
// labelSum
|
||||
//
|
||||
labelSum.AutoSize = true;
|
||||
labelSum.Location = new Point(12, 66);
|
||||
labelSum.Name = "labelSum";
|
||||
labelSum.Size = new Size(45, 15);
|
||||
labelSum.TabIndex = 2;
|
||||
labelSum.Text = "Сумма";
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(121, 5);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(292, 23);
|
||||
comboBoxProduct.TabIndex = 3;
|
||||
comboBoxProduct.SelectedIndexChanged += comboBoxProduct_SelectedIndexChanged;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(121, 34);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(292, 23);
|
||||
textBoxCount.TabIndex = 4;
|
||||
textBoxCount.TextChanged += textBoxCount_TextChanged;
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
textBoxSum.Location = new Point(121, 63);
|
||||
textBoxSum.Name = "textBoxSum";
|
||||
textBoxSum.Size = new Size(292, 23);
|
||||
textBoxSum.TabIndex = 5;
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(257, 92);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(75, 23);
|
||||
ButtonSave.TabIndex = 6;
|
||||
ButtonSave.Text = "Сохранить";
|
||||
ButtonSave.UseVisualStyleBackColor = true;
|
||||
ButtonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(338, 92);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(75, 23);
|
||||
ButtonCancel.TabIndex = 7;
|
||||
ButtonCancel.Text = "Отмена";
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(425, 127);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(textBoxSum);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(labelSum);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(labelProduct);
|
||||
Name = "FormCreateOrder";
|
||||
Text = "Заказ";
|
||||
Load += FormCreateOrder_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label labelProduct;
|
||||
private System.Windows.Forms.Label labelCount;
|
||||
private System.Windows.Forms.Label labelSum;
|
||||
private System.Windows.Forms.ComboBox comboBoxProduct;
|
||||
private System.Windows.Forms.TextBox textBoxCount;
|
||||
private System.Windows.Forms.TextBox textBoxSum;
|
||||
private System.Windows.Forms.Button ButtonSave;
|
||||
private System.Windows.Forms.Button ButtonCancel;
|
||||
}
|
||||
}
|
117
DiningRoom/DiningRoomView/FormCreateOrder.cs
Normal file
117
DiningRoom/DiningRoomView/FormCreateOrder.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using DiningRoomBusinessLogic.BusinessLogic;
|
||||
using DiningRoomContracts.BindingModels;
|
||||
using DiningRoomContracts.BusinessLogicContracts;
|
||||
using DiningRoomContracts.SearchModels;
|
||||
using DiningRoomContracts.ViewModels;
|
||||
using DiningRoomDataModels.Enums;
|
||||
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 DiningRoomView
|
||||
{
|
||||
public partial class FormCreateOrder : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IProductLogic _logicP;
|
||||
private readonly IOrderLogic _logicO;
|
||||
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IProductLogic logicP, IOrderLogic logicO)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicO = logicO;
|
||||
|
||||
}
|
||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Загрузка изделий для заказа");
|
||||
// прописать логику
|
||||
List<ProductViewModel> list = _logicP.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxProduct.DisplayMember = "ProductName";
|
||||
comboBoxProduct.ValueMember = "Id";
|
||||
comboBoxProduct.DataSource = list;
|
||||
comboBoxProduct.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
private void CalcSum()
|
||||
{
|
||||
if (comboBoxProduct.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(comboBoxProduct.SelectedValue);
|
||||
var product = _logicP.ReadElement(new ProductSearchModel { Id = id });
|
||||
int count = Convert.ToInt32(textBoxCount.Text);
|
||||
textBoxSum.Text = Math.Round(count * (product?.Cost ?? 0), 2).ToString();
|
||||
_logger.LogInformation("Расчет суммы заказа");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка расчета суммы заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void textBoxCount_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void comboBoxProduct_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
CalcSum();
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCount.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (comboBoxProduct.SelectedValue == null)
|
||||
{
|
||||
MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Создание заказа");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicO.Create(new OrderBindingModel
|
||||
{
|
||||
ProductId = Convert.ToInt32(comboBoxProduct.SelectedValue),
|
||||
ProductName = comboBoxProduct.Text,
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text),
|
||||
Status = OrderStatus.Принят
|
||||
});
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка создания заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
DiningRoom/DiningRoomView/FormCreateOrder.resx
Normal file
120
DiningRoom/DiningRoomView/FormCreateOrder.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
128
DiningRoom/DiningRoomView/FormDrink.Designer.cs
generated
128
DiningRoom/DiningRoomView/FormDrink.Designer.cs
generated
@ -37,12 +37,14 @@
|
||||
ID = new DataGridViewTextBoxColumn();
|
||||
ComponentName = new DataGridViewTextBoxColumn();
|
||||
Count = new DataGridViewTextBoxColumn();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
ButtonRef = new Button();
|
||||
ButtonDel = new Button();
|
||||
ButtonUpd = new Button();
|
||||
ButtonAdd = new Button();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
comboBoxCards = new ComboBox();
|
||||
label1 = new Label();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -67,14 +69,14 @@
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(94, 6);
|
||||
textBoxName.Location = new Point(133, 6);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(247, 23);
|
||||
textBoxName.TabIndex = 2;
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.Location = new Point(94, 38);
|
||||
textBoxPrice.Location = new Point(133, 38);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(100, 23);
|
||||
textBoxPrice.TabIndex = 3;
|
||||
@ -82,13 +84,15 @@
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(dataGridView);
|
||||
groupBox1.Controls.Add(ButtonSave);
|
||||
groupBox1.Controls.Add(ButtonCancel);
|
||||
groupBox1.Controls.Add(ButtonRef);
|
||||
groupBox1.Controls.Add(ButtonDel);
|
||||
groupBox1.Controls.Add(ButtonUpd);
|
||||
groupBox1.Controls.Add(ButtonAdd);
|
||||
groupBox1.Location = new Point(12, 67);
|
||||
groupBox1.Location = new Point(12, 122);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(510, 338);
|
||||
groupBox1.Size = new Size(510, 389);
|
||||
groupBox1.TabIndex = 4;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Компонент";
|
||||
@ -98,7 +102,7 @@
|
||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ID, ComponentName, Count });
|
||||
dataGridView.Location = new Point(0, 21);
|
||||
dataGridView.Location = new Point(6, 35);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowTemplate.Height = 25;
|
||||
dataGridView.Size = new Size(394, 311);
|
||||
@ -122,49 +126,9 @@
|
||||
Count.HeaderText = "Количество";
|
||||
Count.Name = "Count";
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(400, 169);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(106, 28);
|
||||
ButtonRef.TabIndex = 4;
|
||||
ButtonRef.Text = "Обновить";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(400, 135);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(106, 28);
|
||||
ButtonDel.TabIndex = 3;
|
||||
ButtonDel.Text = "Удалить";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonUpd
|
||||
//
|
||||
ButtonUpd.Location = new Point(400, 101);
|
||||
ButtonUpd.Name = "ButtonUpd";
|
||||
ButtonUpd.Size = new Size(106, 28);
|
||||
ButtonUpd.TabIndex = 2;
|
||||
ButtonUpd.Text = "Изменить";
|
||||
ButtonUpd.UseVisualStyleBackColor = true;
|
||||
ButtonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(400, 67);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(106, 28);
|
||||
ButtonAdd.TabIndex = 1;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(354, 415);
|
||||
ButtonSave.Location = new Point(354, 352);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(75, 23);
|
||||
ButtonSave.TabIndex = 5;
|
||||
@ -174,7 +138,7 @@
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(435, 415);
|
||||
ButtonCancel.Location = new Point(435, 352);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(75, 23);
|
||||
ButtonCancel.TabIndex = 6;
|
||||
@ -182,13 +146,71 @@
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(404, 137);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(106, 28);
|
||||
ButtonRef.TabIndex = 4;
|
||||
ButtonRef.Text = "Обновить";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(404, 103);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(106, 28);
|
||||
ButtonDel.TabIndex = 3;
|
||||
ButtonDel.Text = "Удалить";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonUpd
|
||||
//
|
||||
ButtonUpd.Location = new Point(404, 69);
|
||||
ButtonUpd.Name = "ButtonUpd";
|
||||
ButtonUpd.Size = new Size(106, 28);
|
||||
ButtonUpd.TabIndex = 2;
|
||||
ButtonUpd.Text = "Изменить";
|
||||
ButtonUpd.UseVisualStyleBackColor = true;
|
||||
ButtonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(404, 35);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(106, 28);
|
||||
ButtonAdd.TabIndex = 1;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// comboBoxCards
|
||||
//
|
||||
comboBoxCards.BackColor = SystemColors.Window;
|
||||
comboBoxCards.FormattingEnabled = true;
|
||||
comboBoxCards.Location = new Point(133, 75);
|
||||
comboBoxCards.Name = "comboBoxCards";
|
||||
comboBoxCards.Size = new Size(247, 23);
|
||||
comboBoxCards.TabIndex = 7;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 78);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(115, 15);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Алкогольная карта:";
|
||||
//
|
||||
// FormDrink
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(536, 450);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
ClientSize = new Size(536, 505);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxCards);
|
||||
Controls.Add(groupBox1);
|
||||
Controls.Add(textBoxPrice);
|
||||
Controls.Add(textBoxName);
|
||||
@ -220,5 +242,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ComponentName;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Count;
|
||||
private ComboBox comboBoxCards;
|
||||
private Label label1;
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
using DiningRoomContracts.BindingModels;
|
||||
using DiningRoomContracts.BusinessLogicContracts;
|
||||
using DiningRoomContracts.SearchModels;
|
||||
using DiningRoomContracts.ViewModels;
|
||||
using DiningRoomDataModels.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@ -19,15 +21,46 @@ namespace DiningRoomView
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDrinkLogic _logic;
|
||||
private readonly ICardLogic _cardLogic;
|
||||
private int? _id;
|
||||
|
||||
private Dictionary<int, (IComponentModel, int)> _drinkComponents;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormDrink(ILogger<FormDrink> logger, IDrinkLogic logic)
|
||||
public int Id { get { return Convert.ToInt32(comboBoxCards.SelectedValue); } set { comboBoxCards.SelectedValue = value; _id = value; } }
|
||||
|
||||
private readonly List<CardViewModel>? _list;
|
||||
public ICardModel? CardModel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_list == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (var elem in _list)
|
||||
{
|
||||
if (elem.Id == Id)
|
||||
{
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public FormDrink(ILogger<FormDrink> logger, IDrinkLogic logic, ICardLogic cardLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_cardLogic = cardLogic;
|
||||
_drinkComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||
_list = _cardLogic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
comboBoxCards.DisplayMember = "CardName";
|
||||
comboBoxCards.ValueMember = "Id";
|
||||
comboBoxCards.DataSource = _list;
|
||||
comboBoxCards.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
private void FormDrink_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -167,6 +200,7 @@ namespace DiningRoomView
|
||||
Id = _id ?? 0,
|
||||
DrinkName = textBoxName.Text,
|
||||
Cost = Convert.ToDouble(textBoxPrice.Text),
|
||||
CardId = Convert.ToInt32(comboBoxCards.SelectedValue),
|
||||
DrinkComponents = _drinkComponents
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
|
26
DiningRoom/DiningRoomView/FormMain.Designer.cs
generated
26
DiningRoom/DiningRoomView/FormMain.Designer.cs
generated
@ -32,8 +32,8 @@
|
||||
dataGridView2 = new DataGridView();
|
||||
menuStrip1 = new MenuStrip();
|
||||
продуктыToolStripMenuItem = new ToolStripMenuItem();
|
||||
клиентыToolStripMenuItem = new ToolStripMenuItem();
|
||||
поставщикиToolStripMenuItem = new ToolStripMenuItem();
|
||||
заказыToolStripMenuItem = new ToolStripMenuItem();
|
||||
алкогольныеКартыToolStripMenuItem = new ToolStripMenuItem();
|
||||
button1 = new Button();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
@ -68,7 +68,7 @@
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { продуктыToolStripMenuItem, клиентыToolStripMenuItem, поставщикиToolStripMenuItem });
|
||||
menuStrip1.Items.AddRange(new ToolStripItem[] { продуктыToolStripMenuItem, заказыToolStripMenuItem, алкогольныеКартыToolStripMenuItem });
|
||||
menuStrip1.Location = new Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new Size(666, 24);
|
||||
@ -82,15 +82,19 @@
|
||||
продуктыToolStripMenuItem.Text = "Продукты";
|
||||
продуктыToolStripMenuItem.Click += ПродуктыToolStripMenuItem_Click;
|
||||
//
|
||||
// клиентыToolStripMenuItem
|
||||
// заказыToolStripMenuItem
|
||||
//
|
||||
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
|
||||
клиентыToolStripMenuItem.Size = new Size(12, 20);
|
||||
заказыToolStripMenuItem.Name = "заказыToolStripMenuItem";
|
||||
заказыToolStripMenuItem.Size = new Size(58, 20);
|
||||
заказыToolStripMenuItem.Text = "Заказы";
|
||||
заказыToolStripMenuItem.Click += ЗаказыToolStripMenuItem_Click;
|
||||
//
|
||||
// поставщикиToolStripMenuItem
|
||||
// алкогольныеКартыToolStripMenuItem
|
||||
//
|
||||
поставщикиToolStripMenuItem.Name = "поставщикиToolStripMenuItem";
|
||||
поставщикиToolStripMenuItem.Size = new Size(12, 20);
|
||||
алкогольныеКартыToolStripMenuItem.Name = "алкогольныеКартыToolStripMenuItem";
|
||||
алкогольныеКартыToolStripMenuItem.Size = new Size(130, 20);
|
||||
алкогольныеКартыToolStripMenuItem.Text = "Алкогольные карты";
|
||||
алкогольныеКартыToolStripMenuItem.Click += КартыToolStripMenuItem_Click;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
@ -216,8 +220,6 @@
|
||||
private DataGridView dataGridView2;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem продуктыToolStripMenuItem;
|
||||
private ToolStripMenuItem клиентыToolStripMenuItem;
|
||||
private ToolStripMenuItem поставщикиToolStripMenuItem;
|
||||
private Button button1;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
@ -227,5 +229,7 @@
|
||||
private Button button5;
|
||||
private Button button6;
|
||||
private Button button7;
|
||||
private ToolStripMenuItem заказыToolStripMenuItem;
|
||||
private ToolStripMenuItem алкогольныеКартыToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -79,6 +79,22 @@ namespace DiningRoomView
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ЗаказыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormOrders));
|
||||
if (service is FormOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void КартыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCards));
|
||||
if (service is FormCards form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
private void ButtonAddProduct_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormProduct));
|
||||
@ -142,12 +158,12 @@ namespace DiningRoomView
|
||||
}
|
||||
private void ButtonUpdDrink_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView1.SelectedRows.Count == 1)
|
||||
if (dataGridView2.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDrink));
|
||||
if (service is FormDrink form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
|
||||
form.Id = Convert.ToInt32(dataGridView2.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
|
127
DiningRoom/DiningRoomView/FormOrders.Designer.cs
generated
Normal file
127
DiningRoom/DiningRoomView/FormOrders.Designer.cs
generated
Normal file
@ -0,0 +1,127 @@
|
||||
namespace DiningRoomView
|
||||
{
|
||||
partial class FormOrders
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
ButtonCreateOrder = new Button();
|
||||
ButtonRef = new Button();
|
||||
ButtonIssuedOrder = new Button();
|
||||
ButtonOrderReady = new Button();
|
||||
ButtonTakeOrderInWork = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.EnableHeadersVisualStyles = false;
|
||||
dataGridView.Location = new Point(12, 12);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.Size = new Size(600, 371);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// ButtonCreateOrder
|
||||
//
|
||||
ButtonCreateOrder.Location = new Point(618, 12);
|
||||
ButtonCreateOrder.Name = "ButtonCreateOrder";
|
||||
ButtonCreateOrder.Size = new Size(122, 23);
|
||||
ButtonCreateOrder.TabIndex = 2;
|
||||
ButtonCreateOrder.Text = "Создать заказ";
|
||||
ButtonCreateOrder.UseVisualStyleBackColor = true;
|
||||
ButtonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(618, 147);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(122, 23);
|
||||
ButtonRef.TabIndex = 6;
|
||||
ButtonRef.Text = "Обновить список";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// ButtonIssuedOrder
|
||||
//
|
||||
ButtonIssuedOrder.Location = new Point(618, 118);
|
||||
ButtonIssuedOrder.Name = "ButtonIssuedOrder";
|
||||
ButtonIssuedOrder.Size = new Size(122, 23);
|
||||
ButtonIssuedOrder.TabIndex = 5;
|
||||
ButtonIssuedOrder.Text = "Заказ выдан";
|
||||
ButtonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
ButtonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||
//
|
||||
// ButtonOrderReady
|
||||
//
|
||||
ButtonOrderReady.Location = new Point(618, 89);
|
||||
ButtonOrderReady.Name = "ButtonOrderReady";
|
||||
ButtonOrderReady.Size = new Size(122, 23);
|
||||
ButtonOrderReady.TabIndex = 4;
|
||||
ButtonOrderReady.Text = "Заказ готов";
|
||||
ButtonOrderReady.UseVisualStyleBackColor = true;
|
||||
ButtonOrderReady.Click += ButtonOrderReady_Click;
|
||||
//
|
||||
// ButtonTakeOrderInWork
|
||||
//
|
||||
ButtonTakeOrderInWork.Location = new Point(618, 41);
|
||||
ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
|
||||
ButtonTakeOrderInWork.Size = new Size(122, 42);
|
||||
ButtonTakeOrderInWork.TabIndex = 3;
|
||||
ButtonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||
ButtonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||
ButtonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||
//
|
||||
// FormOrders
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(752, 391);
|
||||
Controls.Add(ButtonRef);
|
||||
Controls.Add(ButtonIssuedOrder);
|
||||
Controls.Add(ButtonOrderReady);
|
||||
Controls.Add(ButtonTakeOrderInWork);
|
||||
Controls.Add(ButtonCreateOrder);
|
||||
Controls.Add(dataGridView);
|
||||
Name = "FormOrders";
|
||||
Text = "Заказы";
|
||||
Load += FormMain_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.DataGridView dataGridView;
|
||||
private System.Windows.Forms.Button ButtonCreateOrder;
|
||||
private System.Windows.Forms.Button ButtonRef;
|
||||
private Button ButtonIssuedOrder;
|
||||
private Button ButtonOrderReady;
|
||||
private Button ButtonTakeOrderInWork;
|
||||
}
|
||||
}
|
131
DiningRoom/DiningRoomView/FormOrders.cs
Normal file
131
DiningRoom/DiningRoomView/FormOrders.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using DiningRoomBusinessLogic.BusinessLogic;
|
||||
using DiningRoomContracts.BindingModels;
|
||||
using DiningRoomContracts.BusinessLogicContracts;
|
||||
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 DiningRoomView
|
||||
{
|
||||
public partial class FormOrders : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
public FormOrders(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
}
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
// прописать логику
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["ProductId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка продуктов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки продуктов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||
if (service is FormCreateOrder form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
DiningRoom/DiningRoomView/FormOrders.resx
Normal file
120
DiningRoom/DiningRoomView/FormOrders.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -54,6 +54,9 @@ namespace DiningRoomView
|
||||
services.AddTransient<FormProductComponent>();
|
||||
services.AddTransient<FormDrink>();
|
||||
services.AddTransient<FormDrinkComponent>();
|
||||
services.AddTransient<FormCreateOrder>();
|
||||
services.AddTransient<FormOrders>();
|
||||
services.AddTransient<FormCards>();
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user