private void luePTN_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 1) { frmPatient frm = new frmPatient(); if (frm.ShowDialog() == DialogResult.OK) { Patient p = new Patient(); p.ID = frm.ID; p.PatientName = frm.PatientName; p.Sex = frm.Sex; p.DateOfBirth = frm.DateOfBirth; p.PhoneNo = frm.PhoneNo; p.Address = frm.Address; p.Comments = frm.Comments; p.MedicalHistory = frm.MedicalHistory; ServerToClient sc = new ServerToClient(); PatientContext px = new PatientContext(); sc = px.AddPatient(p); if (sc.Message == null) { LoadPatients(); luePTN.EditValue = sc.Count; } else { XtraMessageBox.Show(sc.Message); } } } }
private void bNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { frmPatient frm = new frmPatient(); if (frm.ShowDialog() == DialogResult.OK) { Patient p = new Patient(); p.ID = frm.ID; p.PatientName = frm.PatientName; p.Sex = frm.Sex; p.DateOfBirth = frm.DateOfBirth; p.PhoneNo = frm.PhoneNo; p.Address = frm.Address; p.Comments = frm.Comments; p.MedicalHistory = frm.MedicalHistory; ServerToClient sc = new ServerToClient(); PatientContext px = new PatientContext(); sc = px.AddPatient(p); if (sc.Message == null) { //LoadPatients(); //luePTN.EditValue = sc.Count; XtraMessageBox.Show("New patient added successfully!"); } else { XtraMessageBox.Show(sc.Message); } } }