Работает через жопу
This commit is contained in:
parent
422eba9d32
commit
681a92d13f
@ -18,12 +18,17 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new PersonnelDepartmentDatabase();
|
using var context = new PersonnelDepartmentDatabase();
|
||||||
var element = context.Deals
|
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);
|
.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
context.Deals.Remove(element);
|
context.Deals.Remove(element);
|
||||||
|
context.SaveChanges();
|
||||||
return element.GetViewModel;
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
|
|||||||
.Include(x => x.Employee)
|
.Include(x => x.Employee)
|
||||||
.Include(x => x.Department)
|
.Include(x => x.Department)
|
||||||
.Include(x => x.Type)
|
.Include(x => x.Type)
|
||||||
.Include(x => x.Employee)
|
.Include(x => x.Position)
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && model.Id == x.Id) ||
|
.FirstOrDefault(x => (model.Id.HasValue && model.Id == x.Id) ||
|
||||||
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
|
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
|
||||||
(model.DateTo != null && x.DateTo == model.DateTo) ||
|
(model.DateTo != null && x.DateTo == model.DateTo) ||
|
||||||
@ -55,7 +60,7 @@ namespace PersonnelDepartmentDatabaseImplement.Implements
|
|||||||
.Include(x => x.Employee)
|
.Include(x => x.Employee)
|
||||||
.Include(x => x.Department)
|
.Include(x => x.Department)
|
||||||
.Include(x => x.Type)
|
.Include(x => x.Type)
|
||||||
.Include(x => x.Employee)
|
.Include(x => x.Position)
|
||||||
.Where(x => (model.Id.HasValue && model.Id == x.Id) ||
|
.Where(x => (model.Id.HasValue && model.Id == x.Id) ||
|
||||||
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
|
(model.DateFrom != null && x.DateFrom == model.DateFrom) ||
|
||||||
(model.DateTo != null && x.DateTo == model.DateTo) ||
|
(model.DateTo != null && x.DateTo == model.DateTo) ||
|
||||||
|
@ -68,7 +68,7 @@ namespace PersonnelDepartmentDatabaseImplement.Models
|
|||||||
TypeId = TypeId,
|
TypeId = TypeId,
|
||||||
PositionName = Position.Name,
|
PositionName = Position.Name,
|
||||||
DepartmentName = Department.Name,
|
DepartmentName = Department.Name,
|
||||||
EmployeeName = Employee.LastName + Employee.FirstName + Employee.Patronymic,
|
EmployeeName = Employee.LastName + " " + Employee.FirstName[0] + "." + Employee.Patronymic[0] + ".",
|
||||||
TypeName = Type.Name
|
TypeName = Type.Name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,7 @@
|
|||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Name = "FormDeal";
|
Name = "FormDeal";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Договор";
|
Text = "Договор";
|
||||||
Load += FormDeal_Load;
|
Load += FormDeal_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(textBoxName);
|
Controls.Add(textBoxName);
|
||||||
Name = "FormDepartment";
|
Name = "FormDepartment";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Отдел";
|
Text = "Отдел";
|
||||||
Load += FormDepartment_Load;
|
Load += FormDepartment_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormDepartments";
|
Name = "FormDepartments";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Таблица Отделов";
|
Text = "Таблица Отделов";
|
||||||
Load += FormDepartments_Load;
|
Load += FormDepartments_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
@ -120,6 +120,7 @@
|
|||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(textBoxFirstName);
|
Controls.Add(textBoxFirstName);
|
||||||
Name = "FormEmployee";
|
Name = "FormEmployee";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Сотрудник";
|
Text = "Сотрудник";
|
||||||
Load += FormEmployee_Load;
|
Load += FormEmployee_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormEmployees";
|
Name = "FormEmployees";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Таблица Сотрудников";
|
Text = "Таблица Сотрудников";
|
||||||
Load += FormEmployees_Load;
|
Load += FormEmployees_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(textBoxName);
|
Controls.Add(textBoxName);
|
||||||
Name = "FormPosition";
|
Name = "FormPosition";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Должность";
|
Text = "Должность";
|
||||||
Load += FormPosition_Load;
|
Load += FormPosition_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormPositions";
|
Name = "FormPositions";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Таблица Должностей";
|
Text = "Таблица Должностей";
|
||||||
Load += FormPositions_Load;
|
Load += FormPositions_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(textBoxName);
|
Controls.Add(textBoxName);
|
||||||
Name = "FormType";
|
Name = "FormType";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Тип договора";
|
Text = "Тип договора";
|
||||||
Load += FormType_Load;
|
Load += FormType_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
Controls.Add(buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormTypes";
|
Name = "FormTypes";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
Text = "Таблица Типов";
|
Text = "Таблица Типов";
|
||||||
Load += FormTypes_Load;
|
Load += FormTypes_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user