public void FilllbStaff(string DepID) { lbStaff.Items.Clear(); StaffTableAdapter dAdapt = new StaffTableAdapter(); ITO_DAL.dsITO.StaffDataTable staffTbl = new dsITO.StaffDataTable(); dAdapt.Fill(staffTbl); string filterString = "DepartmentID=" + DepID; DataRow[] staff = staffTbl.Select(filterString); //Отбражаем организационные единицы верхнего уровня UpDepID NULL for (int i = 0; i < staff.Length; i++) { ListElement le = new ListElement(staff[i]["UserID"].ToString(), staff[i]["LastName"].ToString() + " " + staff[i]["Name"].ToString() + " " + staff[i]["SecondName"].ToString()); lbStaff.Items.Add(le); //lbStaff.Items // lvStaff.Items.Add(staff[i]["UserID"].ToString(), staff[i]["LastName"].ToString() + " " + // staff[i]["Name"].ToString() + " " + staff[i]["SecondName"].ToString(),0); } }
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); checkedListBox1.Items.Clear(); ADMethodsAccountManagement ADcon = new ADMethodsAccountManagement(); StaffTableAdapter dAdapt = new StaffTableAdapter(); ITO_DAL.dsITO.StaffDataTable staffTbl = new dsITO.StaffDataTable(); dAdapt.Fill(staffTbl); string filterString = "State > 0"; // DataRow[] staff = staffTbl.Select(filterString); DataRow[] staff = staffTbl.Select(filterString); //Отбражаем организационные единицы верхнего уровня UpDepID NULL for (int i = 0; i < staff.Length; i++) { if (!ADcon.IsUserExisiting(staff[i]["Login"].ToString())) { listBox1.Items.Add(staff[i]["Login"].ToString() + " " + staff[i]["LastName"].ToString() + " " + staff[i]["Name"].ToString() + " " + staff[i]["SecondName"].ToString() + " not exist"); checkedListBox1.Items.Add(staff[i]["Login"].ToString()); } // staff[i]["Login"].ToString() //lbStaff.Items // lvStaff.Items.Add(staff[i]["UserID"].ToString(), staff[i]["LastName"].ToString() + " " + // staff[i]["Name"].ToString() + " " + staff[i]["SecondName"].ToString(),0); } }