public frmPatientDataUpdate(string PatientID) { InitializeComponent(); dtpVST.DateTime = DateTime.Now.Date; PID = PatientID; Patient p = new Patient(); PatientContext px = new PatientContext(); p = px.GetPatient(PatientID); txtPID.Text = p.ID; txtPNM.Text = p.PatientName; txtADR.Text = p.Address; txtPHN.Text = p.PhoneNo; MedicineContext mx = new MedicineContext(); ServerToClient sc = new ServerToClient(); sc = mx.GetMedicines(); for (int i = 0; i <= sc.Count - 1; i++) { cboMED.Properties.Items.Add(sc.DT.Rows[i].ItemArray[0].ToString()); } }
private void cboMED_KeyDown(object sender, KeyEventArgs e) { ServerToClient sc = new ServerToClient(); MedicineContext mx = new MedicineContext(); Medicine m = new Medicine(); if (e.KeyCode == Keys.Enter) { if (!dxValidationProvider1.Validate()) { return; } if (cboMED.SelectedIndex == -1) { m.MedicineName = cboMED.Text; sc = mx.AddMedicine(m); } lstMED.Items.Add(cboMED.Text); cboMED.SelectedIndex = -1; } }