public async Task <Biometry> AddBiometryForUser(Biometry biometry) { _context.Biometry.Add(biometry); await _context.SaveChangesAsync(); return(_context.Biometry.FirstOrDefaultAsync(b => b.Id == biometry.Id).Result); }
protected void UnloadData(Biometry bio) { bio.Patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); bio.ExaminationDate = (DateTime)rdpExaminationDate.SelectedDate; bio.Examination = CntAriCli.GetExamination(int.Parse(rdcExamination.SelectedValue), ctx); if (visit != null) { bio.BaseVisit = visit; } bio.Formula = txtFormula.Text; if (txtLIOLeft.Value != null) { bio.LioLeftEye = (decimal)txtLIOLeft.Value; } if (txtLIORight.Value != null) { bio.LioRightEye = (decimal)txtLIORight.Value; } if (txtALXLeft.Value != null) { bio.AlxLeftEye = (decimal)txtALXLeft.Value; } if (txtALXRight.Value != null) { bio.AlxRightEye = (decimal)txtALXRight.Value; } bio.Comments = txtComments.Text; }
protected void LoadData(Biometry bio) { // Load patient data rdcPatient.Items.Clear(); rdcPatient.Items.Add(new RadComboBoxItem(bio.Patient.FullName, bio.Patient.PersonId.ToString())); rdcPatient.SelectedValue = bio.Patient.PersonId.ToString(); // Load Examination data rdcExamination.Items.Clear(); rdcExamination.Items.Add(new RadComboBoxItem(bio.Examination.Name, bio.Examination.ExaminationId.ToString())); rdcExamination.SelectedValue = bio.Examination.ExaminationId.ToString(); txtFormula.Text = bio.Formula; if (bio.LioLeftEye != null) { txtLIOLeft.Value = (double)bio.LioLeftEye; } if (bio.LioRightEye != null) { txtLIORight.Value = (double)bio.LioRightEye; } if (bio.AlxLeftEye != null) { txtALXLeft.Value = (double)bio.AlxLeftEye; } if (bio.AlxRightEye != null) { txtALXRight.Value = (double)bio.AlxRightEye; } rdpExaminationDate.SelectedDate = bio.ExaminationDate; txtComments.Text = bio.Comments; }
protected void Page_Init(object sender, EventArgs e) { ctx = new AriClinicContext("AriClinicContext"); // security control, it must be a user logged if (Session["User"] == null) { Response.Redirect("Default.aspx"); } else { user = (User)Session["User"]; user = CntAriCli.GetUser(user.UserId, ctx); Process proc = (from p in ctx.Processes where p.Code == "examinationassigned" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["ExaminationAssignedId"] != null) { examinationAssignedId = Int32.Parse(Request.QueryString["ExaminationAssignedId"]); biometry = (Biometry)CntAriCli.GetExaminationAssigned(examinationAssignedId, ctx); LoadData(biometry); } else { rdpExaminationDate.SelectedDate = DateTime.Now; } // if (Request.QueryString["PatientId"] != null) { patientId = int.Parse(Request.QueryString["PatientId"]); patient = CntAriCli.GetPatient(patientId, ctx); // fix rdc with patient rdcPatient.Items.Clear(); rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName, patient.PersonId.ToString())); rdcPatient.SelectedValue = patient.PersonId.ToString(); rdcPatient.Enabled = false; } // if (Request.QueryString["VisitId"] != null) { visitId = int.Parse(Request.QueryString["VisitId"]); visit = CntAriCli.GetVisit(visitId, ctx); patientId = visit.Patient.PersonId; patient = CntAriCli.GetPatient(patientId, ctx); // fix rdc with patient rdcPatient.Items.Clear(); rdcPatient.Items.Add(new RadComboBoxItem(patient.FullName, patient.PersonId.ToString())); rdcPatient.SelectedValue = patient.PersonId.ToString(); rdcPatient.Enabled = false; // rdpExaminationDate.SelectedDate = visit.VisitDate; } }
public async Task <Biometry> UpdateBiometryForUser(Biometry biometry) { var biometryFromDb = await _context.Biometry.FindAsync(biometry.Id); if (biometryFromDb != null) { throw new HwolException("Sorry object not found for update"); } _context.Entry(biometryFromDb).CurrentValues.SetValues(biometry); await _context.SaveChangesAsync(); return(await _context.Biometry.FindAsync(biometry.Id)); }
protected bool CreateChange() { if (!DataOk()) { return(false); } if (biometry == null) { biometry = new Biometry(); UnloadData(biometry); ctx.Add(biometry); } else { biometry = (Biometry)CntAriCli.GetExaminationAssigned(examinationAssignedId, ctx); UnloadData(biometry); } ctx.SaveChanges(); return(true); }
public async Task <Biometry> Post([FromBody] Biometry biometry) { return(await _biometryRepository.AddBiometryForUser(biometry)); }