private void but_CreateStaff_Click(object sender, EventArgs e) { string out_Message = string.Empty; if (!isValidateCreateForm(out out_Message)) { MessageBox.Show(out_Message, "Lỗi tạo nhân viên", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //Get data from form string nameStaff = txt_StaffName.Text; int jobtitleStaff = int.TryParse(cbo_StaffJobtitle.EditValue.ToString(), out jobtitleStaff) ? jobtitleStaff : 0; DateTime birthdayStaff = dtm_StaffBirthday.DateTime; bool genderStaff = bool.TryParse(cbo_StaffGender.EditValue.ToString(), out genderStaff) ? genderStaff : false; int permissionStaff = int.TryParse(gridLook_Permission.EditValue.ToString(), out permissionStaff) ? permissionStaff : 0; int paymentStoreStaff = int.TryParse(gridLook_PaymentStore.EditValue.ToString(), out paymentStoreStaff) ? paymentStoreStaff : 0; string shortNameStaff = Extensions.ConvertToUnSign(Extensions.GetShortName(nameStaff)).ToLower(); string addressStaff = txt_StaffAddress.Text; string emailStaff = txt_StaffEmail.Text; string phoneNumberStaff = txt_StaffPhoneNumber.Text; //Call function create staff string msg_CreateStaff = string.Empty; NhanVienBus _nvBus = new NhanVienBus(); if (!_nvBus.CreateStaffAndAccount(nameStaff, shortNameStaff, genderStaff, birthdayStaff, jobtitleStaff, paymentStoreStaff, permissionStaff, addressStaff, emailStaff, phoneNumberStaff, out msg_CreateStaff)) { MessageBox.Show(msg_CreateStaff, "Lỗi tạo nhân viên", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dialogResult = MessageBox.Show(msg_CreateStaff + "\nBạn có muốn tạo tiếp nhân viên?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.Yes) { RefreshForm(); } else { this.Close(); } } } }