Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
 public void PutPhoneOnForm(EmpPhone phone)
 {
     phoneTextBox.Text           = phone.PhoneNumber;
     phoneTypeCBox.SelectedIndex = Int32.Parse(phone.PhoneType);
 }