コード例 #1
0
        private void LoadDepartments()
        {
            departmentBusinessComponent = new DepartmentBusinessComponent();
            var departments = departmentBusinessComponent.FetchDepartments();

            if (departments != null && departments.Count > 0)
            {
                comboBoxDepartments.DataSource    = departments;
                comboBoxDepartments.DisplayMember = "DepartmentName";
            }
            else
            {
                MessageBox.Show("no department records found");
            }
        }
コード例 #2
0
 private void EmployeeRecordsForm_Load(object sender, EventArgs e)
 {
     dgvEmployees.AutoGenerateColumns = false;
     try
     {
         departmentBusinessComponent = new DepartmentBusinessComponent();
         var departments = departmentBusinessComponent.FetchDepartments();
         if (departments != null && departments.Count > 0)
         {
             comboBoxDepartments.DataSource    = departments;
             comboBoxDepartments.DisplayMember = "DepartmentName";
         }
         else
         {
             MessageBox.Show("no department records found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }