private void AddPatientBtn_Click(object sender, EventArgs e) { if (people != null) { if (!checkRepository.IsExistPatient(people.CodeMelli, ClinicId)) { Patient patient = new Patient() { PeopleId = people.Id, ClinicId = this.ClinicId, }; patientRepository.AddPatient(patient); var result = MessageBox.Show("عملیات با موفقیت انجام شد", "موفق", MessageBoxButtons.OK); if (result == DialogResult.OK) { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("بیمار قبلا در سامانه ثبت شده است ", "خطا", MessageBoxButtons.OK); } } else { MessageBox.Show("لطفا ابتدا یک کدملی معتبر را وارد نموده و بر روی دکمه بررسی کد ملی کلیک نمایید ", "خطا", MessageBoxButtons.OK); } }