private void btnAdd_Click(object sender, EventArgs e) { try { bool isAdmin; if (rbAuthorized.Checked) { isAdmin = true; } else { isAdmin = false; } if (staffManager.AddControl(tbUserName.Text, mtbIdentityNumber.Text, tbMail.Text)) { MessageBox.Show("Bu kişi sistemde kayıtlıdır."); } else { if (!string.IsNullOrEmpty(tbFirstName.Text) && !string.IsNullOrEmpty(tbLastName.Text) && !string.IsNullOrEmpty(mtbSalary.Text) && mtbIdentityNumber.Text.Length == 11 && !string.IsNullOrEmpty(tbMail.Text) && !string.IsNullOrEmpty(tbPassword.Text) && mtbPhone.Text.Length == 11 && !string.IsNullOrEmpty(tbUserName.Text) && (rbAuthorized.Checked || rbNonAuthorized.Checked)) { staffManager.Add(new Staff { FirstName = tbFirstName.Text, LastName = tbLastName.Text, Salary = Convert.ToInt32(mtbSalary.Text), IdentityNumber = mtbIdentityNumber.Text, Mail = tbMail.Text, Password = tbPassword.Text, Phone = mtbPhone.Text, UserName = tbUserName.Text, IsAdmin = isAdmin }); MessageBox.Show("Çalışan başarıyla eklendi."); GetData(); AddClear(); } else { MessageBox.Show("Lütfen tüm alanları eksiksiz doldurunuz."); } } } catch (Exception exception) { MessageBox.Show(exception.Message); } }