protected bool CreateChange() { if (!DataOk()) { return(false); } if (mot == null) { mot = new MotAppend(); mot.OphthalmologicVisit = oVisit; UnloadData(mot); ctx.Add(mot); } else { mot = CntAriCli.GetMotAppend(mot.Id, ctx); UnloadData(mot); } ctx.SaveChanges(); RadAjaxManager1.ResponseScripts.Add(String.Format("showDialog('{0}','{1}','success',null,0,0)" , Resources.GeneralResource.Success , Resources.GeneralResource.CorrectlyStored)); Response.Redirect(String.Format("MotAppendForm.aspx?MotAppendId={0}", mot.Id)); return(true); }
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["MotAppendId"] != null) { id = Int32.Parse(Request.QueryString["MotAppendId"]); mot = CntAriCli.GetMotAppend(id, ctx); oVisit = mot.OphthalmologicVisit; LoadData(mot); } if (Request.QueryString["OphVisitId"] != null) { id = int.Parse(Request.QueryString["OphVisitId"]); oVisit = (OphthalmologicVisit)CntAriCli.GetVisit(id, ctx); if (oVisit.MotAppends.Count > 0) { mot = oVisit.MotAppends[0]; LoadData(mot); } } }
public static void ImportVisits(OleDbConnection con, AriClinicContext ctx) { int id = 0; // (0) Borra tipos previos ctx.Delete(ctx.MotAppends); ctx.Delete(ctx.AntSegments); ctx.Delete(ctx.Fundus); ctx.Delete(ctx.OphthalmologicVisits); ctx.Delete(ctx.BaseVisits); ctx.SaveChanges(); // (1) Dar de alta las visitas importadas string sql = "SELECT * FROM HistVisitas"; cmd = new OleDbCommand(sql, con); da = new OleDbDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "ConVisitas"); int nreg = ds.Tables["ConVisitas"].Rows.Count; int reg = 0; foreach (DataRow dr in ds.Tables["ConVisitas"].Rows) { reg++; Boolean newVisit = false; Console.WriteLine("Visitas {0:#####0} de {1:#####0} {2}", reg, nreg, "VISITAS"); BaseVisit visit = (from v in ctx.BaseVisits where v.OftRefVisita == (int)dr["RefVisita"] select v).FirstOrDefault<BaseVisit>(); if (visit == null) { visit = new BaseVisit(); newVisit = true; } visit.OftRefVisita = (int)dr["RefVisita"]; visit.VisitDate = (DateTime)dr["Fecha"]; id = (int)dr["IdTipCit"]; visit.AppointmentType = (from apt in ctx.AppointmentTypes where apt.OftId == id select apt).FirstOrDefault<AppointmentType>(); id = (int)dr["IdMot"]; visit.VisitReason = (from vr in ctx.VisitReasons where vr.OftId == id select vr).FirstOrDefault<VisitReason>(); id = (int)dr["IdMed"]; visit.Professional = (from p in ctx.Professionals where p.OftId == id select p).FirstOrDefault<Professional>(); id = (int)dr["NumHis"]; visit.Patient = (from p in ctx.Patients where p.OftId == id select p).FirstOrDefault<Patient>(); if (dr["Observaciones"] != DBNull.Value) visit.Comments = (string)dr["Observaciones"]; if ((decimal)(float)dr["TOOD"] != 0 || (decimal)(float)dr["TOOI"] != 0) { OphthalmologicVisit ophVisit; if (newVisit) { ophVisit = new OphthalmologicVisit(); } else { ophVisit = (OphthalmologicVisit)visit; } ophVisit.OftRefVisita = visit.OftRefVisita; ophVisit.AppointmentType = visit.AppointmentType; ophVisit.VisitReason = visit.VisitReason; ophVisit.VisitDate = visit.VisitDate; ophVisit.Patient = visit.Patient; ophVisit.Professional = visit.Professional; ophVisit.Comments = visit.Comments; ophVisit.VType = "ophvisit"; if (newVisit) ctx.Add(ophVisit); ctx.SaveChanges(); // Motilidad y anejos MotAppend mot; if (newVisit) { mot = new MotAppend(); } else { mot = ophVisit.MotAppends[0]; } if (dr["MotOcular"] != DBNull.Value) mot.EyeMotility = (string)dr["MotOcular"]; if (dr["cejas"] != DBNull.Value) mot.Eyebrows = (string)dr["Cejas"]; if (dr["AreaPeriocular"] != DBNull.Value) mot.PeriocularArea = (string)dr["AreaPeriocular"]; mot.C1RE = (decimal)(float)dr["C1OD"]; mot.C1LE = (decimal)(float)dr["C1OI"]; mot.C2RE = (decimal)(float)dr["C2OD"]; mot.C2LE = (decimal)(float)dr["C2OI"]; mot.C3RE = (decimal)(float)dr["C3OD"]; mot.C3LE = (decimal)(float)dr["C3OI"]; mot.C4RE = (decimal)(float)dr["C4OD"]; mot.C4LE = (decimal)(float)dr["C4OI"]; mot.C5RE = (decimal)(float)dr["C5OD"]; mot.C5LE = (decimal)(float)dr["C5OI"]; mot.C6RE = (decimal)(float)dr["C6OD"]; mot.C6LE = (decimal)(float)dr["C6OI"]; mot.C7RE = (decimal)(float)dr["C7OD"]; mot.C7LE = (decimal)(float)dr["C7OI"]; mot.C8RE = (decimal)(float)dr["C8OD"]; mot.C8LE = (decimal)(float)dr["C8OI"]; mot.C9RE = (decimal)(float)dr["C9OD"]; mot.C9LE = (decimal)(float)dr["C9OI"]; mot.C10RE = (decimal)(float)dr["C10OD"]; mot.C10LE = (decimal)(float)dr["C10OI"]; mot.C11RE = (decimal)(float)dr["C11OD"]; mot.C11LE = (decimal)(float)dr["C11OI"]; mot.C12RE = (decimal)(float)dr["C12OD"]; mot.C12LE = (decimal)(float)dr["C12OI"]; mot.OphthalmologicVisit = ophVisit; if (newVisit) ctx.Add(mot); ctx.SaveChanges(); // Segmento anterior AntSegment ant; if (newVisit) { ant = new AntSegment(); } else { ant = ophVisit.AntSegments[0]; } if (dr["ObsParpados"] != DBNull.Value) ant.EyebrowsComments = (string)dr["ObsParpados"]; if (dr["Conjuntiva"].GetType() == typeof(DBNull)) { } if (dr["Conjuntiva"] != DBNull.Value) ant.Conjunctiva = (string)dr["Conjuntiva"]; if (dr["Cornea"] != DBNull.Value) ant.Cornea = (string)dr["Cornea"]; if (dr["Camara"] != DBNull.Value) ant.Chamber = (string)dr["Camara"]; if (dr["Tyndall"] != DBNull.Value) ant.Tyndall = (string)dr["Tyndall"]; if (dr["Pupila"] != DBNull.Value) ant.Pupil = (string)dr["Pupila"]; if (dr["Cristalino"] != DBNull.Value) ant.Crystalline = (string)dr["Cristalino"]; ant.EyestrainLE = (decimal)(float)dr["TOOI"]; ant.EyestrainRE = (decimal)(float)dr["TOOD"]; ant.OphthalmologicVisit = ophVisit; if (newVisit) ctx.Add(ant); ctx.SaveChanges(); // Fondo de ojo Fundus fundus; if (newVisit) { fundus = new Fundus(); } else { fundus = ophVisit.Fundus[0]; } if (dr["NervioOptico"] != DBNull.Value) fundus.OpticNerve = (string)dr["NervioOptico"]; if (dr["Vasos"] != DBNull.Value) fundus.Vessels = (string)dr["Vasos"]; if (dr["Macula"] != DBNull.Value) fundus.Macula = (string)dr["Macula"]; if (dr["Vitreo"] != DBNull.Value) fundus.Vitreous = (string)dr["Vitreo"]; if (dr["Periferia"] != DBNull.Value) fundus.Periphery = (string)dr["Periferia"]; fundus.OphthalmologicVisit = ophVisit; if (newVisit) ctx.Add(fundus); ctx.SaveChanges(); } else { visit.VType = "general"; if (newVisit) ctx.Add(visit); ctx.SaveChanges(); } } }
protected void UnloadData(MotAppend mot) { mot.EyeMotility = txtEyeMotility.Text; mot.Eyebrows = txtEyebrows.Text; mot.PeriocularArea = txtPeriocularArea.Text; mot.Comments = txtComments.Text; if (txtC1RE.Value != null) { mot.C1RE = (decimal)txtC1RE.Value; } if (txtC1LE.Value != null) { mot.C1LE = (decimal)txtC1LE.Value; } if (txtC2RE.Value != null) { mot.C2RE = (decimal)txtC2RE.Value; } if (txtC2LE.Value != null) { mot.C2LE = (decimal)txtC2LE.Value; } if (txtC3RE.Value != null) { mot.C3RE = (decimal)txtC3RE.Value; } if (txtC3LE.Value != null) { mot.C3LE = (decimal)txtC3LE.Value; } if (txtC4RE.Value != null) { mot.C4RE = (decimal)txtC4RE.Value; } if (txtC4LE.Value != null) { mot.C4LE = (decimal)txtC4LE.Value; } if (txtC5RE.Value != null) { mot.C5RE = (decimal)txtC5RE.Value; } if (txtC5LE.Value != null) { mot.C5LE = (decimal)txtC5LE.Value; } if (txtC6RE.Value != null) { mot.C6RE = (decimal)txtC6RE.Value; } if (txtC6LE.Value != null) { mot.C6LE = (decimal)txtC6LE.Value; } if (txtC7RE.Value != null) { mot.C7RE = (decimal)txtC7RE.Value; } if (txtC7LE.Value != null) { mot.C7LE = (decimal)txtC7LE.Value; } if (txtC8RE.Value != null) { mot.C8RE = (decimal)txtC8RE.Value; } if (txtC8LE.Value != null) { mot.C8LE = (decimal)txtC8LE.Value; } if (txtC9RE.Value != null) { mot.C9RE = (decimal)txtC9RE.Value; } if (txtC9LE.Value != null) { mot.C9LE = (decimal)txtC9LE.Value; } if (txtC10RE.Value != null) { mot.C10RE = (decimal)txtC10RE.Value; } if (txtC10LE.Value != null) { mot.C10LE = (decimal)txtC10LE.Value; } if (txtC11RE.Value != null) { mot.C11RE = (decimal)txtC11RE.Value; } if (txtC11LE.Value != null) { mot.C11LE = (decimal)txtC11LE.Value; } if (txtC12RE.Value != null) { mot.C12RE = (decimal)txtC12RE.Value; } if (txtC12LE.Value != null) { mot.C12LE = (decimal)txtC12LE.Value; } }
protected void LoadData(MotAppend mot) { txtEyeMotility.Text = mot.EyeMotility; txtEyebrows.Text = mot.Eyebrows; txtPeriocularArea.Text = mot.PeriocularArea; txtComments.Text = mot.Comments; if (mot.C1RE != null) { txtC1RE.Value = (double)mot.C1RE; } if (mot.C1LE != null) { txtC1LE.Value = (double)mot.C1LE; } if (mot.C2RE != null) { txtC2RE.Value = (double)mot.C2RE; } if (mot.C2LE != null) { txtC2LE.Value = (double)mot.C2LE; } if (mot.C3RE != null) { txtC3RE.Value = (double)mot.C3RE; } if (mot.C3LE != null) { txtC3LE.Value = (double)mot.C3LE; } if (mot.C4RE != null) { txtC4RE.Value = (double)mot.C4RE; } if (mot.C4LE != null) { txtC4LE.Value = (double)mot.C4LE; } if (mot.C5RE != null) { txtC5RE.Value = (double)mot.C5RE; } if (mot.C5LE != null) { txtC5LE.Value = (double)mot.C5LE; } if (mot.C6RE != null) { txtC6RE.Value = (double)mot.C6RE; } if (mot.C6LE != null) { txtC6LE.Value = (double)mot.C6LE; } if (mot.C7RE != null) { txtC7RE.Value = (double)mot.C7RE; } if (mot.C7LE != null) { txtC7LE.Value = (double)mot.C7LE; } if (mot.C8RE != null) { txtC8RE.Value = (double)mot.C8RE; } if (mot.C8LE != null) { txtC8LE.Value = (double)mot.C8LE; } if (mot.C9RE != null) { txtC9RE.Value = (double)mot.C9RE; } if (mot.C9LE != null) { txtC9LE.Value = (double)mot.C9LE; } if (mot.C10RE != null) { txtC10RE.Value = (double)mot.C10RE; } if (mot.C10LE != null) { txtC10LE.Value = (double)mot.C10LE; } if (mot.C11RE != null) { txtC11RE.Value = (double)mot.C11RE; } if (mot.C11LE != null) { txtC11LE.Value = (double)mot.C11LE; } if (mot.C12RE != null) { txtC12RE.Value = (double)mot.C12RE; } if (mot.C12LE != null) { txtC12LE.Value = (double)mot.C12LE; } }