Работает через жопу

This commit is contained in:
maxnes3 2023-05-02 23:10:47 +04:00
parent 422eba9d32
commit 681a92d13f
11 changed files with 17 additions and 3 deletions

View File

@ -18,12 +18,17 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
{
using var context = new PersonnelDepartmentDatabase();
var element = context.Deals
.Include(x => x.Employee)
.Include(x => x.Department)
.Include(x => x.Type)
.Include(x => x.Position)
.FirstOrDefault(x => x.Id == model.Id);
if (element == null)
{
return null;
}
context.Deals.Remove(element);
context.SaveChanges();
return element.GetViewModel;
}
@ -38,7 +43,7 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
.Include(x => x.Employee)
.Include(x => x.Department)
.Include(x => x.Type)
.Include(x => x.Employee)
.Include(x => x.Position)
.FirstOrDefault(x => (model.Id.HasValue && model.Id == x.Id) ||
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
(model.DateTo != null && x.DateTo == model.DateTo) ||
@ -55,7 +60,7 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
.Include(x => x.Employee)
.Include(x => x.Department)
.Include(x => x.Type)
.Include(x => x.Employee)
.Include(x => x.Position)
.Where(x => (model.Id.HasValue && model.Id == x.Id) ||
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
(model.DateTo != null && x.DateTo == model.DateTo) ||

View File

@ -68,7 +68,7 @@ namespace PersonnelDepartmentDatabaseImplement.Models
TypeId = TypeId,
PositionName = Position.Name,
DepartmentName = Department.Name,
EmployeeName = Employee.LastName + Employee.FirstName + Employee.Patronymic,
EmployeeName = Employee.LastName + " " + Employee.FirstName[0] + "." + Employee.Patronymic[0] + ".",
TypeName = Type.Name
};
}

View File

@ -194,6 +194,7 @@
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Name = "FormDeal";
StartPosition = FormStartPosition.CenterScreen;
Text = "Договор";
Load += FormDeal_Load;
ResumeLayout(false);

View File

@ -100,6 +100,7 @@
Controls.Add(label1);
Controls.Add(textBoxName);
Name = "FormDepartment";
StartPosition = FormStartPosition.CenterScreen;
Text = "Отдел";
Load += FormDepartment_Load;
ResumeLayout(false);

View File

@ -96,6 +96,7 @@
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "FormDepartments";
StartPosition = FormStartPosition.CenterScreen;
Text = "Таблица Отделов";
Load += FormDepartments_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();

View File

@ -120,6 +120,7 @@
Controls.Add(label1);
Controls.Add(textBoxFirstName);
Name = "FormEmployee";
StartPosition = FormStartPosition.CenterScreen;
Text = "Сотрудник";
Load += FormEmployee_Load;
ResumeLayout(false);

View File

@ -96,6 +96,7 @@
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "FormEmployees";
StartPosition = FormStartPosition.CenterScreen;
Text = "Таблица Сотрудников";
Load += FormEmployees_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();

View File

@ -80,6 +80,7 @@
Controls.Add(label1);
Controls.Add(textBoxName);
Name = "FormPosition";
StartPosition = FormStartPosition.CenterScreen;
Text = "Должность";
Load += FormPosition_Load;
ResumeLayout(false);

View File

@ -96,6 +96,7 @@
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "FormPositions";
StartPosition = FormStartPosition.CenterScreen;
Text = "Таблица Должностей";
Load += FormPositions_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();

View File

@ -80,6 +80,7 @@
Controls.Add(label1);
Controls.Add(textBoxName);
Name = "FormType";
StartPosition = FormStartPosition.CenterScreen;
Text = "Тип договора";
Load += FormType_Load;
ResumeLayout(false);

View File

@ -96,6 +96,7 @@
Controls.Add(buttonAdd);
Controls.Add(dataGridView);
Name = "FormTypes";
StartPosition = FormStartPosition.CenterScreen;
Text = "Таблица Типов";
Load += FormTypes_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();