protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) { RefreshGrid(true); if (e.Argument == "new") { RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1; RadGrid1.Rebind(); } if (e.Argument == "yes") { if (Session["DeleteId"] != null) { try { diagnosticAssignedId = (int)Session["DeleteId"]; diagnosticAssigned = (from da in ctx.DiagnosticAssigneds where da.DiagnosticAssignedId == diagnosticAssignedId select da).FirstOrDefault <DiagnosticAssigned>(); ctx.Delete(diagnosticAssigned); ctx.SaveChanges(); RefreshGrid(true); Session["DeleteId"] = null; } catch (Exception ex) { Session["Exception"] = ex; string command = String.Format("showDialog('Error','{0}','error',null, 0, 0)" , Resources.GeneralResource.DeleteRecordFail); RadAjaxManager1.ResponseScripts.Add(command); } } } }
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 == "diagnosticassigned" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["DiagnosticAssignedId"] != null) { diagnosticAssignedId = Int32.Parse(Request.QueryString["DiagnosticAssignedId"]); diagnosticAssigned = CntAriCli.GetDiagnosticAssigned(diagnosticAssignedId, ctx); LoadData(diagnosticAssigned); } else { rdpDiagnosticDate.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; // by default disgnostic assigned date is the visit date rdpDiagnosticDate.SelectedDate = visit.VisitDate; } }
protected void UnloadData(DiagnosticAssigned da) { da.Patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); da.DiagnosticDate = (DateTime)rdpDiagnosticDate.SelectedDate; da.Diagnostic = CntAriCli.GetDiagnostic(int.Parse(rdcDiagnostic.SelectedValue), ctx); if (visit != null) { da.BaseVisit = visit; } da.Comments = txtComments.Text; }
protected void LoadData(DiagnosticAssigned da) { // Load patient data rdcPatient.Items.Clear(); rdcPatient.Items.Add(new RadComboBoxItem(da.Patient.FullName, da.Patient.PersonId.ToString())); rdcPatient.SelectedValue = da.Patient.PersonId.ToString(); // Load diagnostic data rdcDiagnostic.Items.Clear(); rdcDiagnostic.Items.Add(new RadComboBoxItem(da.Diagnostic.Name, da.Diagnostic.DiagnosticId.ToString())); rdcDiagnostic.SelectedValue = da.Diagnostic.DiagnosticId.ToString(); rdpDiagnosticDate.SelectedDate = da.DiagnosticDate; txtComments.Text = da.Comments; }
protected bool CreateChange() { if (!DataOk()) { return(false); } if (diagnosticAssigned == null) { diagnosticAssigned = new DiagnosticAssigned(); UnloadData(diagnosticAssigned); ctx.Add(diagnosticAssigned); } else { diagnostic = CntAriCli.GetDiagnostic(diagnosticId, ctx); UnloadData(diagnosticAssigned); } ctx.SaveChanges(); return(true); }
public static void LoadDiagnostics(RdcModel ctxRid, AriClinicContext ctx) { // definiciones int nr = 0, r = 0; // numero de registros, registro actual // primero hay que cargar los diagnosticos en general. nr = ctxRid.Diagnosticos.Count(); r = 0; foreach (Diagnostico d in ctxRid.Diagnosticos) { Console.WriteLine("Diagnostics -> {1:000000}/{2:000000} {0} ", d.Nom_diagnostico, ++r, nr); Diagnostic dg = new Diagnostic(); dg.Name = d.Nom_diagnostico; dg.OftId = d.Id_diagnostico; ctx.Add(dg); ctx.SaveChanges(); } // y ahora los asignados nr = ctxRid.Diagnostico_asignados.Count(); r = 0; foreach (Diagnostico_asignado da in ctxRid.Diagnostico_asignados) { Console.WriteLine("Diagnostics ASSIGNED -> {1:000000}/{2:000000} {0} ", da.Fecha, ++r, nr); DiagnosticAssigned das = new DiagnosticAssigned(); Diagnostic d = (from dg in ctx.Diagnostics where dg.OftId == da.Id_diagnostico select dg).FirstOrDefault <Diagnostic>(); das.Diagnostic = d; Patient patient = (from p in ctx.Patients where p.OftId == da.Id_historia select p).FirstOrDefault <Patient>(); das.Patient = patient; das.DiagnosticDate = da.Fecha; das.Comments = da.Observaciones; ctx.Add(das); ctx.SaveChanges(); } }