public Prescription(Doctor _doctor, Database.DTO.Customer _customer) { InitializeComponent(); doctor = _doctor; customer = _customer; lblDoctor.Text += doctor.Name; lblCustomer.Text += customer.Name; _drugBLL = new DrugBLL(); }
private void btnOk_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtName.Text) || string.IsNullOrEmpty(txtAddress.Text)) { MessageBox.Show("Vui lòng nhập thông tin"); return; } Database.DTO.Customer customer = new Database.DTO.Customer { Name = txtName.Text, Address = txtAddress.Text, Phone = txtPhone.Text, BirthDate = txtBirthDate.Text, }; int id = -1; try { id = int.Parse(txtId.Text); } catch (Exception) { } customer.Id = id; if (rbFemale.Checked) { customer.Gender = 1; } else { customer.Gender = 0; } _customerBLL.AddOrUpdate(customer); var _id = _customerBLL.GetByPhone(customer.Phone).Id; customer.Id = _id; MessageBox.Show("Cập nhật thông tin khách hàng thành công"); PrescriptionLog pre = new PrescriptionLog(this.currentDoctor, customer); pre.Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }