//Departman EKLEME private void btnAdd_Click(object sender, EventArgs e) { Departmans departmans = new Departmans(); try { string departmanName = txtDepartman.Text.ToUpper(); departmans.Departman = departmanName; departmans.Aciklama = txtAciklama.Text; foreach (var item in departmanBLL.GetDepartmans()) { if (item.Departman == departmanName) { MessageBox.Show("Departman İsmi Zaten Var"); ClearBox(); return; } } departmanBLL.AddDepartman(departmans); MessageBox.Show("Departman Başarıyla Eklenmiştir"); ClearBox(); ListDepartman(); } catch (Exception ex) { MessageBox.Show(ex.Message); ClearBox(); } }
void ComboGetDepartment() { cbDepartment.DisplayMember = "Departman"; cbDepartment.ValueMember = "DepartmanID"; cbDepartment.DataSource = _departmanBLL.GetDepartmans(); //Dictionary<int, string> departments = new Dictionary<int, string>(); //List<Departmans> lstdDepartments = _departmanBLL.GetDepartmans(); //Dictionary<int, string> lstId = lstdDepartments.ToDictionary(m => m.DepartmanID, m => m.Departman); }