Вроде почти всё :)

This commit is contained in:
Programmist73 2023-04-25 23:47:33 +04:00
parent 9c00ec5694
commit 2aed31b3c5
8 changed files with 1148 additions and 1125 deletions

View File

@ -160,7 +160,7 @@
Controls.Add(labelSurname); Controls.Add(labelSurname);
Controls.Add(labelName); Controls.Add(labelName);
Name = "FormCreateClient"; Name = "FormCreateClient";
Text = "FormClient"; Text = "Клиент";
Load += FormCreateClient_Load; Load += FormCreateClient_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -80,7 +80,7 @@
Controls.Add(textBoxTransport); Controls.Add(textBoxTransport);
Controls.Add(label1); Controls.Add(label1);
Name = "FormCreateTransport"; Name = "FormCreateTransport";
Text = "FormCreateTransport"; Text = "Транспорт";
Load += FormCreateTransport_Load; Load += FormCreateTransport_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -204,7 +204,7 @@
Controls.Add(label1); Controls.Add(label1);
Controls.Add(labelCLient); Controls.Add(labelCLient);
Name = "FormCreateTrucking"; Name = "FormCreateTrucking";
Text = "FormCreateTrucking"; Text = "Перевозка";
Load += FormCreateTrucking_Load; Load += FormCreateTrucking_Load;
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View File

@ -43,6 +43,7 @@
comboBoxEmails = new ComboBox(); comboBoxEmails = new ComboBox();
label1 = new Label(); label1 = new Label();
checkBoxSorted = new CheckBox(); checkBoxSorted = new CheckBox();
checkBoxForFilterMode = new CheckBox();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout(); menuStrip.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -165,19 +166,30 @@
// checkBoxSorted // checkBoxSorted
// //
checkBoxSorted.AutoSize = true; checkBoxSorted.AutoSize = true;
checkBoxSorted.Location = new Point(541, 35); checkBoxSorted.Location = new Point(632, 35);
checkBoxSorted.Name = "checkBoxSorted"; checkBoxSorted.Name = "checkBoxSorted";
checkBoxSorted.Size = new Size(239, 24); checkBoxSorted.Size = new Size(316, 24);
checkBoxSorted.TabIndex = 10; checkBoxSorted.TabIndex = 10;
checkBoxSorted.Text = "Сортировать по возрастанию"; checkBoxSorted.Text = "Сортировать по возрастанию стоимости";
checkBoxSorted.UseVisualStyleBackColor = true; checkBoxSorted.UseVisualStyleBackColor = true;
checkBoxSorted.CheckedChanged += CheckBoxSorted_CheckedChanged; checkBoxSorted.CheckedChanged += CheckBoxSorted_CheckedChanged;
// //
// checkBoxForFilterMode
//
checkBoxForFilterMode.AutoSize = true;
checkBoxForFilterMode.Location = new Point(370, 35);
checkBoxForFilterMode.Name = "checkBoxForFilterMode";
checkBoxForFilterMode.Size = new Size(212, 24);
checkBoxForFilterMode.TabIndex = 11;
checkBoxForFilterMode.Text = "Включить режим фильтра";
checkBoxForFilterMode.UseVisualStyleBackColor = true;
//
// FormTrucking // FormTrucking
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1297, 496); ClientSize = new Size(1297, 496);
Controls.Add(checkBoxForFilterMode);
Controls.Add(checkBoxSorted); Controls.Add(checkBoxSorted);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(comboBoxEmails); Controls.Add(comboBoxEmails);
@ -226,5 +238,6 @@
private ComboBox comboBoxEmails; private ComboBox comboBoxEmails;
private Label label1; private Label label1;
private CheckBox checkBoxSorted; private CheckBox checkBoxSorted;
private CheckBox checkBoxForFilterMode;
} }
} }

View File

@ -1,8 +1,10 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.ComponentModel; using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using TransportCompanyContracts.BusinessLogicsContracts; using TransportCompanyContracts.BusinessLogicsContracts;
using TransportCompanyContracts.SearchModels; using TransportCompanyContracts.SearchModels;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace TransportCompany namespace TransportCompany
{ {
@ -148,12 +150,20 @@ namespace TransportCompany
private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e) private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e)
{ {
if(!checkBoxForFilterMode.Checked)
{
//dataGridView.DataSource = _truckingLogic.ReadList(null);
LoadData();
}
else
{
dataGridView.DataSource = _truckingLogic.ReadList(null).Where(x => x.ClientId == comboBoxEmails.SelectedIndex).ToList();
}
} }
private void CheckBoxSorted_CheckedChanged(object sender, EventArgs e) private void CheckBoxSorted_CheckedChanged(object sender, EventArgs e)
{ {
//dataGridView. Sort(dataGridView.Columns[7], ListSortDirection.Ascending); dataGridView.DataSource = _truckingLogic.ReadList(null).OrderByDescending(x => x.Price).ToList();
} }
} }
} }