+createBackup

This commit is contained in:
malimova 2024-06-02 22:08:54 +04:00
parent 686d459fe1
commit 78d1fd1d8c
2 changed files with 46 additions and 9 deletions

View File

@ -40,12 +40,13 @@
componentPastryToolStripMenuItem = new ToolStripMenuItem(); componentPastryToolStripMenuItem = new ToolStripMenuItem();
ordersListToolStripMenuItem = new ToolStripMenuItem(); ordersListToolStripMenuItem = new ToolStripMenuItem();
startWorkToolStripMenuItem = new ToolStripMenuItem(); startWorkToolStripMenuItem = new ToolStripMenuItem();
mailToolStripMenuItem = new ToolStripMenuItem();
buttonCreateOrder = new Button(); buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button(); buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button(); buttonOrderReady = new Button();
buttonIssuedOrder = new Button(); buttonIssuedOrder = new Button();
buttonRef = new Button(); buttonRef = new Button();
mailToolStripMenuItem = new ToolStripMenuItem(); createBackupToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout(); menuStrip.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -63,7 +64,7 @@
// menuStrip // menuStrip
// //
menuStrip.ImageScalingSize = new Size(24, 24); menuStrip.ImageScalingSize = new Size(24, 24);
menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчетыToolStripMenuItem, startWorkToolStripMenuItem, mailToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчетыToolStripMenuItem, startWorkToolStripMenuItem, mailToolStripMenuItem, createBackupToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(1921, 33); menuStrip.Size = new Size(1921, 33);
@ -140,6 +141,13 @@
startWorkToolStripMenuItem.Text = "Запуск работ"; startWorkToolStripMenuItem.Text = "Запуск работ";
startWorkToolStripMenuItem.Click += startWorkToolStripMenuItem_Click; startWorkToolStripMenuItem.Click += startWorkToolStripMenuItem_Click;
// //
// mailToolStripMenuItem
//
mailToolStripMenuItem.Name = "mailToolStripMenuItem";
mailToolStripMenuItem.Size = new Size(78, 29);
mailToolStripMenuItem.Text = "Почта";
mailToolStripMenuItem.Click += mailToolStripMenuItem_Click;
//
// buttonCreateOrder // buttonCreateOrder
// //
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
@ -195,12 +203,12 @@
buttonRef.UseVisualStyleBackColor = true; buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += buttonRef_Click; buttonRef.Click += buttonRef_Click;
// //
// mailToolStripMenuItem // createBackupToolStripMenuItem
// //
mailToolStripMenuItem.Name = "mailToolStripMenuItem"; createBackupToolStripMenuItem.Name = "createBackupToolStripMenuItem";
mailToolStripMenuItem.Size = new Size(78, 29); createBackupToolStripMenuItem.Size = new Size(145, 29);
mailToolStripMenuItem.Text = "Почта"; createBackupToolStripMenuItem.Text = "Создать бекап";
mailToolStripMenuItem.Click += mailToolStripMenuItem_Click; createBackupToolStripMenuItem.Click += createBackupToolStripMenuItem_Click;
// //
// FormMain // FormMain
// //
@ -245,5 +253,6 @@
private ToolStripMenuItem implementersToolStripMenuItem; private ToolStripMenuItem implementersToolStripMenuItem;
private ToolStripMenuItem startWorkToolStripMenuItem; private ToolStripMenuItem startWorkToolStripMenuItem;
private ToolStripMenuItem mailToolStripMenuItem; private ToolStripMenuItem mailToolStripMenuItem;
private ToolStripMenuItem createBackupToolStripMenuItem;
} }
} }

View File

@ -1,4 +1,5 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryBusinessLogic;
using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
@ -19,14 +20,16 @@ namespace ConfectioneryView
private readonly IOrderLogic _orderLogic; private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic; private readonly IReportLogic _reportLogic;
private readonly IWorkProcess _workProcess; private readonly IWorkProcess _workProcess;
private readonly IBackUpLogic _backUpLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess) public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_orderLogic = orderLogic; _orderLogic = orderLogic;
_reportLogic = reportLogic; _reportLogic = reportLogic;
_workProcess = workProcess; _workProcess = workProcess;
_backUpLogic = backUpLogic;
} }
private void FormMain_Load(object sender, EventArgs e) private void FormMain_Load(object sender, EventArgs e)
{ {
@ -221,5 +224,30 @@ namespace ConfectioneryView
form.ShowDialog(); form.ShowDialog();
} }
} }
private void createBackupToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (_backUpLogic != null)
{
var fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
_backUpLogic.CreateBackUp(new BackUpSaveBinidngModel
{
FolderName = fbd.SelectedPath
});
MessageBox.Show("Бекап создан", "Сообщение",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка создания бекапа", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
} }
} }