Прямее ровнее
This commit is contained in:
parent
87391c25c1
commit
be017f5d16
@ -29,6 +29,7 @@ namespace DepartmentStaffDatabase
|
|||||||
using var conn = GetConnect();
|
using var conn = GetConnect();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE department SET name = @name, head = @head WHERE id = @Id", conn);
|
using var cmd = new NpgsqlCommand($"UPDATE department SET name = @name, head = @head WHERE id = @Id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@Id", department.Id);
|
||||||
cmd.Parameters.AddWithValue("@name", department.DepartmentName);
|
cmd.Parameters.AddWithValue("@name", department.DepartmentName);
|
||||||
cmd.Parameters.AddWithValue("@head", department.Head);
|
cmd.Parameters.AddWithValue("@head", department.Head);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
@ -119,6 +120,7 @@ namespace DepartmentStaffDatabase
|
|||||||
using var conn = GetConnect();
|
using var conn = GetConnect();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE position SET name = @name, salary = @salary, departmentId = @departmentId WHERE id = @Id", conn);
|
using var cmd = new NpgsqlCommand($"UPDATE position SET name = @name, salary = @salary, departmentId = @departmentId WHERE id = @Id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@Id", position.Id);
|
||||||
cmd.Parameters.AddWithValue("@name", position.PositionName);
|
cmd.Parameters.AddWithValue("@name", position.PositionName);
|
||||||
cmd.Parameters.AddWithValue("@salary", position.Salary);
|
cmd.Parameters.AddWithValue("@salary", position.Salary);
|
||||||
cmd.Parameters.AddWithValue("@departmentId", position.DepartmentId);
|
cmd.Parameters.AddWithValue("@departmentId", position.DepartmentId);
|
||||||
@ -217,6 +219,7 @@ namespace DepartmentStaffDatabase
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE employee SET name = @name, birthdate = @birthdate, " +
|
using var cmd = new NpgsqlCommand($"UPDATE employee SET name = @name, birthdate = @birthdate, " +
|
||||||
$"address = @address, phoneNumber = @phoneNumber, email = @email, positionId = @positionId WHERE id = @Id", conn);
|
$"address = @address, phoneNumber = @phoneNumber, email = @email, positionId = @positionId WHERE id = @Id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@Id", employee.Id);
|
||||||
cmd.Parameters.AddWithValue("@name", employee.EmployeeName);
|
cmd.Parameters.AddWithValue("@name", employee.EmployeeName);
|
||||||
cmd.Parameters.AddWithValue("@Birthdate", employee.Birthdate);
|
cmd.Parameters.AddWithValue("@Birthdate", employee.Birthdate);
|
||||||
cmd.Parameters.AddWithValue("@Address", employee.Address);
|
cmd.Parameters.AddWithValue("@Address", employee.Address);
|
||||||
@ -323,6 +326,7 @@ namespace DepartmentStaffDatabase
|
|||||||
using var conn = GetConnect();
|
using var conn = GetConnect();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE contract SET dateOfConclusion = @dateOfConclusion, duration = @duration, employeeId = @employeeId WHERE id = @Id", conn);
|
using var cmd = new NpgsqlCommand($"UPDATE contract SET dateOfConclusion = @dateOfConclusion, duration = @duration, employeeId = @employeeId WHERE id = @Id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@Id", contract.Id);
|
||||||
cmd.Parameters.AddWithValue("@dateOfConclusion", contract.DateOfConclusion);
|
cmd.Parameters.AddWithValue("@dateOfConclusion", contract.DateOfConclusion);
|
||||||
cmd.Parameters.AddWithValue("@duration", contract.Duration);
|
cmd.Parameters.AddWithValue("@duration", contract.Duration);
|
||||||
cmd.Parameters.AddWithValue("@employeeId", contract.EmployeeId);
|
cmd.Parameters.AddWithValue("@employeeId", contract.EmployeeId);
|
||||||
@ -399,6 +403,7 @@ namespace DepartmentStaffDatabase
|
|||||||
using var conn = GetConnect();
|
using var conn = GetConnect();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using var cmd = new NpgsqlCommand($"UPDATE course SET eventDateb = @eventDateb, hoursNumber = @hoursNumber, result = @result WHERE id = @Id", conn);
|
using var cmd = new NpgsqlCommand($"UPDATE course SET eventDateb = @eventDateb, hoursNumber = @hoursNumber, result = @result WHERE id = @Id", conn);
|
||||||
|
cmd.Parameters.AddWithValue("@Id", course.Id);
|
||||||
cmd.Parameters.AddWithValue("@EventDateb", course.DateOfEvent);
|
cmd.Parameters.AddWithValue("@EventDateb", course.DateOfEvent);
|
||||||
cmd.Parameters.AddWithValue("@HoursNumber", course.HoursNumber);
|
cmd.Parameters.AddWithValue("@HoursNumber", course.HoursNumber);
|
||||||
cmd.Parameters.AddWithValue("@Result", course.Result);
|
cmd.Parameters.AddWithValue("@Result", course.Result);
|
||||||
|
@ -25,11 +25,18 @@ namespace DepartmentStaffView
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
|
if (string.IsNullOrEmpty(textBoxAddress.Text))
|
||||||
//{
|
{
|
||||||
// MessageBox.Show("Заполните поля. Они все обязательные!");
|
textBoxAddress.Text = "None";
|
||||||
// return;
|
}
|
||||||
//}
|
if (string.IsNullOrEmpty(textBoxEmail.Text))
|
||||||
|
{
|
||||||
|
textBoxEmail.Text = "None";
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(textBoxPhone.Text))
|
||||||
|
{
|
||||||
|
textBoxPhone.Text = "None";
|
||||||
|
}
|
||||||
if (EmployeeId.HasValue)
|
if (EmployeeId.HasValue)
|
||||||
{
|
{
|
||||||
db.UpdateEmployee(new()
|
db.UpdateEmployee(new()
|
||||||
|
Loading…
Reference in New Issue
Block a user