доработал лабу 3

This commit is contained in:
Stepan 2024-11-12 23:06:42 +04:00
parent 07b4a0d7bd
commit 2be92b4f12
9 changed files with 210 additions and 161 deletions

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Contracts.BusinessLogicsContracts namespace Contracts.BusinessLogicsContracts
{ {
/// <summary> /// <summary>
/// Интерфейс для описания работы бизнес-логики для сущности "Счет" /// Интерфейс для описания работы бизнес-логики для сущности "Книга"
/// </summary> /// </summary>
public interface IBookLogic public interface IBookLogic
{ {

View File

@ -40,7 +40,6 @@
dataGridView.Dock = DockStyle.Fill; dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(0, 0); dataGridView.Location = new Point(0, 0);
dataGridView.Name = "dataGridView"; dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(384, 211); dataGridView.Size = new Size(384, 211);
dataGridView.TabIndex = 0; dataGridView.TabIndex = 0;
dataGridView.CellEndEdit += dataGridView_CellEndEdit; dataGridView.CellEndEdit += dataGridView_CellEndEdit;
@ -53,11 +52,10 @@
ClientSize = new Size(384, 211); ClientSize = new Size(384, 211);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Name = "FormAuthor"; Name = "FormAuthor";
Text = "Блюда"; Text = "Авторы";
Load += FormAuthor_Load; Load += FormAuthor_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion

View File

@ -49,7 +49,7 @@ namespace Forms
var operatingResult = id != 0 ? _authorLogic.Update(model) : _authorLogic.Create(model); var operatingResult = id != 0 ? _authorLogic.Update(model) : _authorLogic.Create(model);
if (!operatingResult) if (!operatingResult)
{ {
throw new Exception("Ошибка при создании сущности 'Заказанное блюдо'!"); throw new Exception("Ошибка при создании сущности 'Автор'!");
} }
} }
else else

View File

@ -41,18 +41,16 @@
// //
// textBoxTitleFullName // textBoxTitleFullName
// //
textBoxTitleFullName.Location = new Point(13, 33); textBoxTitleFullName.Location = new Point(11, 25);
textBoxTitleFullName.Margin = new Padding(3, 4, 3, 4);
textBoxTitleFullName.Name = "textBoxTitleFullName"; textBoxTitleFullName.Name = "textBoxTitleFullName";
textBoxTitleFullName.Size = new Size(250, 27); textBoxTitleFullName.Size = new Size(219, 23);
textBoxTitleFullName.TabIndex = 0; textBoxTitleFullName.TabIndex = 0;
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(13, 545); buttonSave.Location = new Point(11, 409);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(114, 31); buttonSave.Size = new Size(100, 23);
buttonSave.TabIndex = 1; buttonSave.TabIndex = 1;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -60,10 +58,9 @@
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(177, 545); buttonCancel.Location = new Point(155, 409);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(86, 31); buttonCancel.Size = new Size(75, 23);
buttonCancel.TabIndex = 2; buttonCancel.TabIndex = 2;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -72,35 +69,35 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(13, 9); label1.Location = new Point(11, 7);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(129, 20); label1.Size = new Size(64, 15);
label1.TabIndex = 6; label1.TabIndex = 6;
label1.Text = "ФИО официанта*"; label1.Text = "Название*";
// //
// labelAuthor // labelAuthor
// //
labelAuthor.AutoSize = true; labelAuthor.AutoSize = true;
labelAuthor.Location = new Point(13, 117); labelAuthor.Location = new Point(11, 88);
labelAuthor.Name = "labelAuthor"; labelAuthor.Name = "labelAuthor";
labelAuthor.Size = new Size(146, 20); labelAuthor.Size = new Size(45, 15);
labelAuthor.TabIndex = 7; labelAuthor.TabIndex = 7;
labelAuthor.Text = "Заказанное блюдо*"; labelAuthor.Text = "Автор*";
// //
// customTextBox1 // customTextBox1
// //
customTextBox1.DatePattern = null; customTextBox1.DatePattern = null;
customTextBox1.Location = new Point(13, 401); customTextBox1.Location = new Point(11, 301);
customTextBox1.Margin = new Padding(3, 4, 3, 4);
customTextBox1.Name = "customTextBox1"; customTextBox1.Name = "customTextBox1";
customTextBox1.Size = new Size(242, 89); customTextBox1.Size = new Size(212, 67);
customTextBox1.TabIndex = 9; customTextBox1.TabIndex = 9;
// //
// textBoxScan // textBoxScan
// //
textBoxScan.Location = new Point(13, 87); textBoxScan.Location = new Point(11, 65);
textBoxScan.Margin = new Padding(3, 2, 3, 2);
textBoxScan.Name = "textBoxScan"; textBoxScan.Name = "textBoxScan";
textBoxScan.Size = new Size(125, 27); textBoxScan.Size = new Size(110, 23);
textBoxScan.TabIndex = 10; textBoxScan.TabIndex = 10;
textBoxScan.Text = "Нажми сюда"; textBoxScan.Text = "Нажми сюда";
textBoxScan.Click += textBoxScan_Click; textBoxScan.Click += textBoxScan_Click;
@ -108,26 +105,26 @@
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(13, 64); label2.Location = new Point(11, 48);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(77, 20); label2.Size = new Size(58, 15);
label2.TabIndex = 12; label2.TabIndex = 12;
label2.Text = "Скан чека"; label2.Text = "Обложка";
// //
// controlSelectedListBoxSingle // controlSelectedListBoxSingle
// //
controlSelectedListBoxSingle.Location = new Point(13, 142); controlSelectedListBoxSingle.Location = new Point(11, 106);
controlSelectedListBoxSingle.Margin = new Padding(4, 5, 4, 5); controlSelectedListBoxSingle.Margin = new Padding(4);
controlSelectedListBoxSingle.Name = "controlSelectedListBoxSingle"; controlSelectedListBoxSingle.Name = "controlSelectedListBoxSingle";
controlSelectedListBoxSingle.SelectedElement = ""; controlSelectedListBoxSingle.SelectedElement = "";
controlSelectedListBoxSingle.Size = new Size(250, 233); controlSelectedListBoxSingle.Size = new Size(219, 175);
controlSelectedListBoxSingle.TabIndex = 13; controlSelectedListBoxSingle.TabIndex = 13;
// //
// FormBook // FormBook
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(275, 589); ClientSize = new Size(241, 442);
Controls.Add(controlSelectedListBoxSingle); Controls.Add(controlSelectedListBoxSingle);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(textBoxScan); Controls.Add(textBoxScan);
@ -137,9 +134,8 @@
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(textBoxTitleFullName); Controls.Add(textBoxTitleFullName);
Margin = new Padding(3, 4, 3, 4);
Name = "FormBook"; Name = "FormBook";
Text = "Счет"; Text = "Книга";
Load += FormBook_Load; Load += FormBook_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -88,22 +88,22 @@ namespace WinForms
if (string.IsNullOrEmpty(textBoxTitleFullName.Text)) if (string.IsNullOrEmpty(textBoxTitleFullName.Text))
{ {
MessageBox.Show("Заполните ФИО официанта!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Заполните Название!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (string.IsNullOrEmpty(textBoxScan.Text)) if (string.IsNullOrEmpty(textBoxScan.Text))
{ {
MessageBox.Show("Приложите скан чека!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Приложите обложку!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (string.IsNullOrEmpty(controlSelectedListBoxSingle.SelectedElement)) if (string.IsNullOrEmpty(controlSelectedListBoxSingle.SelectedElement))
{ {
MessageBox.Show("Выберите блюдо!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Выберите автора!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
if (string.IsNullOrEmpty(customTextBox1.TextBoxValue)) if (string.IsNullOrEmpty(customTextBox1.TextBoxValue))
{ {
MessageBox.Show("Введите дату заказа!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Введите дату издания!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
@ -121,10 +121,10 @@ namespace WinForms
var operatingResult = _id.HasValue ? _bookLogic.Update(model) : _bookLogic.Create(model); var operatingResult = _id.HasValue ? _bookLogic.Update(model) : _bookLogic.Create(model);
if (!operatingResult) if (!operatingResult)
{ {
throw new Exception("Ошибка при создании сущности 'Счет'!"); throw new Exception("Ошибка при создании сущности 'Книга'!");
} }
MessageBox.Show("Создание сущности 'Счет' прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Создание сущности 'Книга' прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();
} }

View File

@ -1,4 +1,6 @@
namespace Forms using System.Windows.Forms;
namespace Forms
{ {
partial class FormMain partial class FormMain
{ {
@ -33,109 +35,108 @@
tableComponent = new Components.NonVisualComponents.TableComponent(components); tableComponent = new Components.NonVisualComponents.TableComponent(components);
pdfImage = new ComponentProgramming.NonVisualComponents.PdfImage(components); pdfImage = new ComponentProgramming.NonVisualComponents.PdfImage(components);
componentDocumentWithChartBarWord = new COP_V6.NoVisualComponent.HistogramToDoc(components); componentDocumentWithChartBarWord = new COP_V6.NoVisualComponent.HistogramToDoc(components);
button1 = new Button(); книгаToolStripMenuItem = new ToolStripMenuItem();
button2 = new Button(); созToolStripMenuItem = new ToolStripMenuItem();
button3 = new Button(); редактироватьToolStripMenuItem = new ToolStripMenuItem();
button4 = new Button(); удалитьToolStripMenuItem = new ToolStripMenuItem();
button5 = new Button(); авторToolStripMenuItem = new ToolStripMenuItem();
button6 = new Button(); документыToolStripMenuItem = new ToolStripMenuItem();
button7 = new Button(); wordToolStripMenuItem = new ToolStripMenuItem();
excelToolStripMenuItem = new ToolStripMenuItem();
pdfToolStripMenuItem = new ToolStripMenuItem();
contextMenuStrip = new ContextMenuStrip(components);
contextMenuStrip.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// controlDataGridView1 // controlDataGridView1
// //
controlDataGridView1.Location = new Point(174, 14); controlDataGridView1.Location = new Point(60, 14);
controlDataGridView1.Margin = new Padding(4, 5, 4, 5); controlDataGridView1.Margin = new Padding(4, 5, 4, 5);
controlDataGridView1.Name = "controlDataGridView1"; controlDataGridView1.Name = "controlDataGridView1";
controlDataGridView1.Size = new Size(613, 275); controlDataGridView1.Size = new Size(678, 344);
controlDataGridView1.TabIndex = 1; controlDataGridView1.TabIndex = 1;
// //
// button1 // книгаToolStripMenuItem
// //
button1.Location = new Point(35, 28); книгаToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { созToolStripMenuItem, редактироватьToolStripMenuItem, удалитьToolStripMenuItem });
button1.Name = "button1"; книгаToolStripMenuItem.Name = "книгаToolStripMenuItem";
button1.Size = new Size(75, 23); книгаToolStripMenuItem.Size = new Size(137, 22);
button1.TabIndex = 2; книгаToolStripMenuItem.Text = "Книга";
button1.Text = "Добавить";
button1.UseVisualStyleBackColor = true;
button1.Click += btnAdd_Click;
// //
// button2 // созToolStripMenuItem
// //
button2.Location = new Point(35, 57); созToolStripMenuItem.Name = "созToolStripMenuItem";
button2.Name = "button2"; созToolStripMenuItem.Size = new Size(154, 22);
button2.Size = new Size(75, 23); созToolStripMenuItem.Text = "Создать";
button2.TabIndex = 3; созToolStripMenuItem.Click += созToolStripMenuItem_Click;
button2.Text = "Обновить";
button2.UseVisualStyleBackColor = true;
button2.Click += btnUpdate_Click;
// //
// button3 // редактироватьToolStripMenuItem
// //
button3.Location = new Point(35, 86); редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
button3.Name = "button3"; редактироватьToolStripMenuItem.Size = new Size(154, 22);
button3.Size = new Size(75, 23); редактироватьToolStripMenuItem.Text = "Редактировать";
button3.TabIndex = 4; редактироватьToolStripMenuItem.Click += редактироватьToolStripMenuItem_Click;
button3.Text = "Удалить";
button3.UseVisualStyleBackColor = true;
button3.Click += btnDelete_Click;
// //
// button4 // удалитьToolStripMenuItem
// //
button4.Location = new Point(35, 115); удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
button4.Name = "button4"; удалитьToolStripMenuItem.Size = new Size(154, 22);
button4.Size = new Size(75, 23); удалитьToolStripMenuItem.Text = "Удалить";
button4.TabIndex = 5; удалитьToolStripMenuItem.Click += удалитьToolStripMenuItem_Click;
button4.Text = "Word";
button4.UseVisualStyleBackColor = true;
button4.Click += btnCreateWord_Click;
// //
// button5 // авторToolStripMenuItem
// //
button5.Location = new Point(35, 144); авторToolStripMenuItem.Name = "авторToolStripMenuItem";
button5.Name = "button5"; авторToolStripMenuItem.Size = new Size(137, 22);
button5.Size = new Size(75, 23); авторToolStripMenuItem.Text = "Автор";
button5.TabIndex = 6; авторToolStripMenuItem.Click += авторToolStripMenuItem_Click;
button5.Text = "Excel";
button5.UseVisualStyleBackColor = true;
button5.Click += btnCreateExcel_Click;
// //
// button6 // документыToolStripMenuItem
// //
button6.Location = new Point(35, 173); документыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { wordToolStripMenuItem, excelToolStripMenuItem, pdfToolStripMenuItem });
button6.Name = "button6"; документыToolStripMenuItem.Name = окументыToolStripMenuItem";
button6.Size = new Size(75, 23); документыToolStripMenuItem.Size = new Size(137, 22);
button6.TabIndex = 7; документыToolStripMenuItem.Text = "Документы";
button6.Text = "Pdf";
button6.UseVisualStyleBackColor = true;
button6.Click += btnCreatePdf_Click;
// //
// button7 // wordToolStripMenuItem
// //
button7.Location = new Point(35, 202); wordToolStripMenuItem.Name = "wordToolStripMenuItem";
button7.Name = "button7"; wordToolStripMenuItem.Size = new Size(103, 22);
button7.Size = new Size(75, 23); wordToolStripMenuItem.Text = "Word";
button7.TabIndex = 8; wordToolStripMenuItem.Click += wordToolStripMenuItem_Click;
button7.Text = "Авторы"; //
button7.UseVisualStyleBackColor = true; // excelToolStripMenuItem
button7.Click += btnShowFormAuthor_Click; //
excelToolStripMenuItem.Name = "excelToolStripMenuItem";
excelToolStripMenuItem.Size = new Size(103, 22);
excelToolStripMenuItem.Text = "Excel";
excelToolStripMenuItem.Click += excelToolStripMenuItem_Click;
//
// pdfToolStripMenuItem
//
pdfToolStripMenuItem.Name = "pdfToolStripMenuItem";
pdfToolStripMenuItem.Size = new Size(103, 22);
pdfToolStripMenuItem.Text = "Pdf";
pdfToolStripMenuItem.Click += pdfToolStripMenuItem_Click;
//
// contextMenuStrip
//
contextMenuStrip.ImageScalingSize = new Size(20, 20);
contextMenuStrip.Items.AddRange(new ToolStripItem[] { книгаToolStripMenuItem, авторToolStripMenuItem, документыToolStripMenuItem });
contextMenuStrip.Name = "contextMenuStrip";
contextMenuStrip.Size = new Size(138, 70);
contextMenuStrip.Text = "Управление";
// //
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 426); ClientSize = new Size(800, 426);
Controls.Add(button7);
Controls.Add(button6);
Controls.Add(button5);
Controls.Add(button4);
Controls.Add(button3);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(controlDataGridView1); Controls.Add(controlDataGridView1);
Name = "FormMain"; Name = "FormMain";
Text = "FormMain"; Text = "FormMain";
Load += FormMain_Load; Load += FormMain_Load;
contextMenuStrip.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
} }
@ -144,12 +145,15 @@
private ComponentProgramming.NonVisualComponents.PdfImage pdfImage; private ComponentProgramming.NonVisualComponents.PdfImage pdfImage;
private COP_V6.NoVisualComponent.HistogramToDoc componentDocumentWithChartBarWord; private COP_V6.NoVisualComponent.HistogramToDoc componentDocumentWithChartBarWord;
private COP_V6.ControlDataGridView controlDataGridView1; private COP_V6.ControlDataGridView controlDataGridView1;
private Button button1; private ContextMenuStrip contextMenuStrip;
private Button button2; private ToolStripMenuItem книгаToolStripMenuItem;
private Button button3; private ToolStripMenuItem созToolStripMenuItem;
private Button button4; private ToolStripMenuItem редактироватьToolStripMenuItem;
private Button button5; private ToolStripMenuItem удалитьToolStripMenuItem;
private Button button6; private ToolStripMenuItem авторToolStripMenuItem;
private Button button7; private ToolStripMenuItem документыToolStripMenuItem;
private ToolStripMenuItem wordToolStripMenuItem;
private ToolStripMenuItem excelToolStripMenuItem;
private ToolStripMenuItem pdfToolStripMenuItem;
} }
} }

View File

@ -98,7 +98,7 @@ namespace Forms
var selectedBook = controlDataGridView1.GetRow<BookViewModel>(); var selectedBook = controlDataGridView1.GetRow<BookViewModel>();
if (selectedBook == null) if (selectedBook == null)
{ {
MessageBox.Show("Выберите счет для редактирования!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Выберите книгу для редактирования!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; return;
} }
@ -156,7 +156,7 @@ namespace Forms
} }
string[] imagesArray = images.ToArray(); string[] imagesArray = images.ToArray();
pdfImage.CreatePdfDoc(new DataForImage(fileName, "Сканы чеков", imagesArray)); pdfImage.CreatePdfDoc(new DataForImage(fileName, "Обложки", imagesArray));
} }
} }
catch (Exception ex) catch (Exception ex)
@ -182,14 +182,14 @@ namespace Forms
List<MergeCells> mergeCells = new List<MergeCells>() List<MergeCells> mergeCells = new List<MergeCells>()
{ {
new MergeCells("Счет", new int[] { 1, 2}) new MergeCells("Книга", new int[] { 1, 2})
}; };
List<ColumnInfo> columns = new List<ColumnInfo>() List<ColumnInfo> columns = new List<ColumnInfo>()
{ {
new ColumnInfo("Id", "Идент.", 10), new ColumnInfo("Id", "Идент.", 10),
new ColumnInfo("TitleFullName", "ФИО официанта", 20), new ColumnInfo("TitleFullName", "Название", 20),
new ColumnInfo("Author", "Блюдо", 20), new ColumnInfo("Author", "Автор", 20),
new ColumnInfo("BookDate", "Дата оплаты чека", 30), new ColumnInfo("BookDate", "Дата издания", 30),
new ColumnInfo("", "заглушка", 0), new ColumnInfo("", "заглушка", 0),
}; };
@ -264,40 +264,88 @@ namespace Forms
private void btnAdd_Click(object sender, EventArgs e) private void созToolStripMenuItem_Click(object sender, EventArgs e)
{ {
AddElement(); AddElement();
} }
private void btnUpdate_Click(object sender, EventArgs e) private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
{ {
UpdateElement(); UpdateElement();
} }
private void btnDelete_Click(object sender, EventArgs e) private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
{ {
DeleteElement(); DeleteElement();
} }
private void btnCreateWord_Click(object sender, EventArgs e) private void wordToolStripMenuItem_Click(object sender, EventArgs e)
{ {
CreateWord(); CreateWord();
} }
private void btnCreateExcel_Click(object sender, EventArgs e) private void excelToolStripMenuItem_Click(object sender, EventArgs e)
{ {
CreateExcel(); CreateExcel();
} }
private void btnCreatePdf_Click(object sender, EventArgs e) private void pdfToolStripMenuItem_Click(object sender, EventArgs e)
{ {
CreatePdf(); CreatePdf();
} }
private void btnShowFormAuthor_Click(object sender, EventArgs e) private void авторToolStripMenuItem_Click(object sender, EventArgs e)
{ {
ShowFormAuthor(); ShowFormAuthor();
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
// Ctrl+A - добавить запись
if (keyData == (Keys.Control | Keys.A))
{
AddElement();
return true;
}
// Ctrl+U - редактировать запись
if (keyData == (Keys.Control | Keys.U))
{
UpdateElement();
return true;
}
// Ctrl+D - удалить запись
if (keyData == (Keys.Control | Keys.D))
{
DeleteElement();
return true;
}
// Ctrl+S - создать документ Word
if (keyData == (Keys.Control | Keys.S))
{
CreateWord();
return true;
}
// Ctrl+T - создать документ Excel
if (keyData == (Keys.Control | Keys.T))
{
CreateExcel();
return true;
}
// Ctrl+C - создать документ Pdf
if (keyData == (Keys.Control | Keys.C))
{
CreatePdf();
return true;
}
// Ctrl+M - вывести форму списка авторов
if (keyData == (Keys.Control | Keys.M))
{
ShowFormAuthor();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void ShowFormAuthor() private void ShowFormAuthor()
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormAuthor)); var service = Program.ServiceProvider?.GetService(typeof(FormAuthor));

View File

@ -126,4 +126,7 @@
<metadata name="componentDocumentWithChartBarWord.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="componentDocumentWithChartBarWord.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>415, 17</value> <value>415, 17</value>
</metadata> </metadata>
<metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>