приделал базу к харде и харду к базе

This commit is contained in:
Данила Мочалов 2023-04-23 23:05:26 +04:00
parent 7a22a82042
commit 2d7ffc80ca
9 changed files with 49 additions and 57 deletions

View File

@ -1,5 +1,6 @@
using LawFirm;
using LawFirmContracts.BusinessLogicContracts;
using LawFirmContracts.DI;
using LawFirmContracts.ViewModels;
using Microsoft.Extensions.Logging;
using System;
@ -42,7 +43,7 @@ namespace LawFirmView
{
Page = currentPage,
PageSize = pageSize,
});
}));
_logger.LogInformation("Загрузка писем");
_logger.LogInformation("Загрузка писем");
@ -94,13 +95,10 @@ namespace LawFirmView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormMail));
if (service is FormMail form)
{
form.MessageId = (string)(dataGridView.SelectedRows[0].Cells["MessageId"].Value);
form.ShowDialog();
LoadMail();
}
var form = DependencyManager.Instance.Resolve<FormMail>();
form.MessageId = (string)(dataGridView.SelectedRows[0].Cells["MessageId"].Value);
form.ShowDialog();
LoadMail();
}
}
}

View File

@ -62,7 +62,7 @@
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботToolStripMenuItem, создатьБэкапToolStripMenuItem });
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, отчетыToolStripMenuItem, запускРаботыToolStripMenuItem, создатьБэкапToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1139, 28);
@ -71,7 +71,7 @@
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { бланкиToolStripMenuItem, документыToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem, письмаToolStripMenuItem });
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { бланкиToolStripMenuItem, документыToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem, письмаToolStripMenuItem, магазиныToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(117, 24);
справочникиToolStripMenuItem.Text = "Справочники";
@ -121,7 +121,7 @@
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокДокументовToolStripMenuItem, бланкиПоДокументамToolStripMenuItem, списокЗаказовToolStripMenuItem });
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокДокументовToolStripMenuItem, бланкиПоДокументамToolStripMenuItem, списокЗаказовToolStripMenuItem, списокМагазиновToolStripMenuItem, списокЗаказовПоДатеToolStripMenuItem, документыВМагазинахToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Text = "Отчеты";

View File

@ -119,30 +119,21 @@ namespace LawFirmView
private void документыВМагазинахToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopDocuments));
if (service is FormReportShopDocuments form)
{
form.ShowDialog();
}
}
var form = DependencyManager.Instance.Resolve<FormReportShopDocuments>();
form.ShowDialog();
}
private void списокЗаказовПоДатеToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportDateOrders));
if (service is FormReportDateOrders form)
{
form.ShowDialog();
}
}
var form = DependencyManager.Instance.Resolve<FormReportDateOrders>();
form.ShowDialog();
}
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
if (service is FormShops form)
{
form.ShowDialog();
}
}
var form = DependencyManager.Instance.Resolve<FormShops>();
form.ShowDialog();
}
private void buttonCreateOrder_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
@ -184,30 +175,22 @@ namespace LawFirmView
private void buttonSupplyShop_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShopSupply));
if (service is FormShopSupply form)
{
form.ShowDialog();
}
}
var form = DependencyManager.Instance.Resolve<FormShopSupply>();
form.ShowDialog();
}
private void buttonSellDocuments_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShopSell));
if (service is FormShopSell form)
{
form.ShowDialog();
}
}
var form = DependencyManager.Instance.Resolve<FormShopSell>();
form.ShowDialog();
}
private void запускРаботыToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormMails>();

View File

@ -1,6 +1,7 @@
using LawFirm;
using LawFirmContracts.BindingModels;
using LawFirmContracts.BusinessLogicContracts;
using LawFirmContracts.DI;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
@ -62,22 +63,19 @@ namespace LawFirmView
private void buttonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
if (service is FormShop form)
var form = DependencyManager.Instance.Resolve<FormShop>();
if (form.ShowDialog() == DialogResult.OK)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
LoadData();
}
}
private void buttonEdit_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
var service = DependencyManager.Instance.Resolve<FormShop>();
if (service is FormShop form)
{

View File

@ -22,6 +22,7 @@ namespace LawFirmDatabaseImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IDocumentStorage, DocumentStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}

View File

@ -8,19 +8,25 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace LawFirmDatabaseImplement.Models
{
[DataContract]
public class Shop : IShopModel
{
[DataMember]
public int Id { get; set; }
[Required]
[DataMember]
public string Name { get; set; } = string.Empty;
[Required]
[DataMember]
public string Adress { get; set; } = string.Empty;
[Required]
[DataMember]
public DateTime OpeningDate { get; set; }
[ForeignKey("ShopId")]
@ -29,6 +35,7 @@ namespace LawFirmDatabaseImplement.Models
private Dictionary<int, (IDocumentModel, int)>? _shopDocuments = null;
[NotMapped]
[DataMember]
public Dictionary<int, (IDocumentModel, int)> ShopDocuments
{
get

View File

@ -22,6 +22,7 @@ namespace LawFirmFileImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IDocumentStorage, DocumentStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}

View File

@ -5,28 +5,31 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace LawFirmFileImplement.Models
{
[DataContract]
public class Shop : IShopModel
{
[DataMember]
public int Id { get; private set; }
[DataMember]
public string Name { get; private set; } = string.Empty;
[DataMember]
public string Adress { get; private set; } = string.Empty;
[DataMember]
public int MaxCountDocuments { get; private set; }
[DataMember]
public DateTime OpeningDate { get; private set; }
public Dictionary<int, int> Documents { get; private set; } = new();
private Dictionary<int, (IDocumentModel, int)>? _shopDocuments = null;
[DataMember]
public Dictionary<int, (IDocumentModel, int)> ShopDocuments
{
get

View File

@ -22,6 +22,7 @@ namespace LawFirmListImplements
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IDocumentStorage, DocumentStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}