public EditPatientsPage(Models.Patients patients) { var EditViewModel = new EditPatientsViewModel(); EditViewModel.TheSelectedPatient = patients; BindingContext = EditViewModel; InitializeComponent(); }
public ActionResult Delete(int Id) { Models.Patients foundPatient = db.Patients.FirstOrDefault(p => p.Id == Id); if (foundPatient != null) { db.Patients.Remove(foundPatient); db.SaveChanges(); } else { return(HttpNotFound()); } return(RedirectToAction("Index")); }
private void usersListListBox_DoubleClick(object sender, System.EventArgs e) { Models.Patients selectedpatient = usersListListBox.SelectedItem as Models.Patients; if (selectedpatient != null) { UpdatePatientProfileForm updateProfile = new UpdatePatientProfileForm { Selectedpatient = selectedpatient, }; updateProfile.ShowDialog(); Search(); } }
public ActionResult PatientsGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Patients item) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model unitOfWork.PatientsRepo.Update(item); unitOfWork.Save(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } var model = unitOfWork.PatientsRepo.Get(); return(PartialView("_PatientsGridViewPartial", model)); }
public ActionResult Create(IFormCollection collection) { try { //validar dpi de 13 digitos //string dpi = collection["DPI"].ToString(); //if (dpi.Length != 13) //{ // ModelState.AddModelError("DPI", "Please enter 13-digit DPI number"); // return View("Create"); //} var pat = new Models.Patients { Name = collection["Name"], LastName = collection["LastName"], DPI = Convert.ToInt32(collection["DPI"]), town = collection["town"], Department = collection["Department"], Priority = collection["Priority"], Date = Convert.ToDateTime(collection["Date"]) }; Singleton.Instance.MClientsList.Add(pat); nvac = nvac + 1; //HASH de personas no vacunadas int Code = tableH.Fhash(pat.Name, pat.LastName); tableH.array[Code].Add(pat); #region envio //Enviar codigo hash a AVL para ordenar //AVLPatients.Add(pat.DPI); #endregion return(RedirectToAction(nameof(Simulation))); } catch { return(View()); } }
private void UpdatePatientProfileForm_Load(object sender, System.EventArgs e) { Models.DatabaseContext databaseContext = null; //show information user try { databaseContext = new Models.DatabaseContext(); Models.Patients foundedPatient = databaseContext.Patient .Where(current => current.Id == Selectedpatient.Id) .FirstOrDefault(); if (foundedPatient == null) { System.Windows.Forms.MessageBox.Show("There Is No Such A User Anymore!"); Close(); } patientCodeTextBox.Text = Selectedpatient.Id; firstNameTextBox.Text = Selectedpatient.FirstName; lastNameTextBox.Text = Selectedpatient.LastName; if (foundedPatient.IsMan == true) { maleRadioButton.Checked = true; femaleRadioButton.Checked = false; } else { maleRadioButton.Checked = false; femaleRadioButton.Checked = true; } if (foundedPatient.IsMarried == true) { marridCheckBox.Checked = true; singleCheckBox.Checked = false; } else { marridCheckBox.Checked = false; singleCheckBox.Checked = true; } ageTextBox.Text = foundedPatient.Age; typeOfDiseaseTextBox.Text = foundedPatient.Disease; addressTextBox.Text = foundedPatient.Address; phoneTextBox.Text = foundedPatient.Phone; mobileTextBox.Text = foundedPatient.Mobile; postalCodeTextBox.Text = foundedPatient.PostalCode; descriptionTextBox.Text = foundedPatient.Description; } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return; } finally { if (databaseContext != null) { databaseContext.Dispose(); databaseContext = null; } } }
private void registerButton_Click(object sender, System.EventArgs e) { if (deleteCheckBox.Checked == true) { System.Windows.Forms.MessageBox.Show("با فعال بودن گزینه حذف این کاربر از سامانه حذف می شود."); } Models.DatabaseContext databaseContext = null; try { databaseContext = new Models.DatabaseContext(); Models.Patients foundedPatient = databaseContext.Patient .Where(current => current.Id == patientCodeTextBox.Text) .FirstOrDefault(); if (foundedPatient == null) { System.Windows.Forms.MessageBox.Show("There Is No Such A User Anymore!"); Close(); } if (deleteCheckBox.Checked == true) { databaseContext.Patient.Remove(foundedPatient); databaseContext.SaveChanges(); Close(); } else { foundedPatient.FirstName = firstNameTextBox.Text; foundedPatient.LastName = lastNameTextBox.Text; if (maleRadioButton.Checked == true) { foundedPatient.IsMan = true; } if (femaleRadioButton.Checked == true) { foundedPatient.IsMan = false; } if (marridCheckBox.Checked == true) { foundedPatient.IsMarried = true; } if (singleCheckBox.Checked == true) { foundedPatient.IsMarried = false; } foundedPatient.Age = ageTextBox.Text; foundedPatient.Disease = typeOfDiseaseTextBox.Text; foundedPatient.Address = addressTextBox.Text; foundedPatient.Phone = phoneTextBox.Text; foundedPatient.Mobile = mobileTextBox.Text; foundedPatient.PostalCode = postalCodeTextBox.Text; foundedPatient.Description = descriptionTextBox.Text; databaseContext.SaveChanges(); System.Windows.Forms.MessageBox.Show("Register done!"); Close(); } } catch (System.Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return; } finally { if (databaseContext != null) { databaseContext.Dispose(); databaseContext = null; } } }