public EmployeeForm(Employee emp) : this() { this.Text = "Просмотр и редактирование пользователя"; PutEmployeeOnForm(emp); Doc = DbWorker.GetDocument(empId: emp.Id); PutDocOnForm(Doc); Emp = emp; Phone = DbWorker.GetPhone(empId: emp.Id); PutPhoneOnForm(Phone); }
public static EmpPhone GetPhone(string phoneNumber = null, string empId = null) { EmpPhone phone = null; if (phoneNumber != null || empId != null) { connection.Open(); var par = phoneNumber == null ? ("employee_id", empId) : ("phone_number", phoneNumber); SqlDataReader reader = SelectData("Employee_Phones", par); if (reader.HasRows) { reader.Read(); phone = new EmpPhone(reader[0].ToString(), reader[1].ToString(), reader[2].ToString(), reader[3].ToString()); } connection.Close(); } return(phone); }
public void PutPhoneOnForm(EmpPhone phone) { phoneTextBox.Text = phone.PhoneNumber; phoneTypeCBox.SelectedIndex = Int32.Parse(phone.PhoneType); }