private void FillInoculationsGrid() { dgvInoculations.DataSource = InoculationManager.GetInoculations(inoculation => inoculation.PatientId == Patient.Id) .Select(inoculation => new InoculationVm { Name = inoculation.Name, Date = inoculation.Date?.ToFormattedArabicDate() }).ToList(); }
private void dgvInoculations_DoubleClick(object sender, EventArgs e) { if (ShowConfirmationDialog("هل أنت متأكد من أنك تريد حذف التطعيم المحدد؟") != DialogResult.Yes) { return; } Cursor = Cursors.WaitCursor; var inoculation = InoculationManager.GetInoculationByNameAndPatientId( dgvInoculations.SelectedRows[0].Cells[0].Value.ToString(), Patient.Id); if (inoculation == null) { return; } InoculationManager.DeleteInoculation(inoculation); FillInoculationsGrid(); Cursor = Cursors.Default; }
private void btnAddInoculation_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; if (string.IsNullOrEmpty(txtInoculationName.Text.FullTrim())) { ShowErrorMsg("يجب إدخال اسم التطعيم"); Cursor = Cursors.Default; return; } var inoculation = new Inoculation { Name = txtInoculationName.Text.FullTrim(), Date = dtInoculationDate.Value != default(DateTime) ? dtInoculationDate.Value : (DateTime?)null, PatientId = Patient.Id }; InoculationManager.AddInoculation(inoculation); Patient.Inoculations.Add(inoculation); ClearInoculationInputs(); FillGrid(); Cursor = Cursors.Default; }