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["CycloplegiaId"] != null) { id = Int32.Parse(Request.QueryString["CycloplegiaId"]); Cycloplegia = CntAriCli.GetCycloplegia(id, ctx); refractometry = Cycloplegia.Refractometry; LoadData(Cycloplegia); } if (Request.QueryString["RefractometryId"] != null) { id = int.Parse(Request.QueryString["RefractometryId"]); refractometry = (Refractometry)CntAriCli.GetExaminationAssigned(id, ctx); } }
protected bool CreateChange() { if (!DataOk()) { return(false); } if (Cycloplegia == null) { Cycloplegia = new Cycloplegia(); Cycloplegia.Refractometry = refractometry; UnloadData(Cycloplegia); ctx.Add(Cycloplegia); } else { Cycloplegia = CntAriCli.GetCycloplegia(Cycloplegia.Id, ctx); UnloadData(Cycloplegia); } ctx.SaveChanges(); RadAjaxManager1.ResponseScripts.Add(String.Format("showDialog('{0}','{1}','success',null,0,0)" , Resources.GeneralResource.Success , Resources.GeneralResource.CorrectlyStored)); Response.Redirect(String.Format("CycloplegiaForm.aspx?CycloplegiaId={0}", Cycloplegia.Id)); return(true); }
protected void UnloadData(Cycloplegia gt) { gt.FarAcuity = txtFarAcuity.Text; gt.FarAxisLeftEye = txtFarAxisLeftEye.Text; gt.FarAxisRightEye = txtFarAxisRightEye.Text; gt.FarCenters = txtFarCenter.Text; gt.FarCylinderLeftEye = txtFarCylinderLeftEye.Text; gt.FarCylinderRightEye = txtFarCylinderRightEye.Text; gt.FarPrismLeftEye = txtFarPrismLeftEye.Text; gt.FarPrimsRightEye = txtFarPrismRightEye.Text; gt.FarSphericityLeftEye = txtFarSphericityLefttEye.Text; gt.FarSphericityRightEye = txtFarSphericityRightEye.Text; gt.FarVisualAcuityLeftEye = txtFarVisualAcuityLeftEye.Text; gt.FarVisualAcuityRightEye = txtFarVisualAcuityRightEye.Text; gt.CloseAcuity = txtCloseAcuity.Text; gt.CloseAxisLeftEye = txtCloseAxisLeftEye.Text; gt.CloseAxisRightEye = txtCloseAxisRightEye.Text; gt.CloseCenters = txtCloseCenter.Text; gt.CloseCylinderLeftEye = txtCloseCylinderLeftEye.Text; gt.CloseCylinderRightEye = txtCloseCylinderRightEye.Text; gt.ClosePrismLeftEye = txtClosePrismLeftEye.Text; gt.ClosePrismRightEye = txtClosePrismRightEye.Text; gt.CloseSphericityLeftEye = txtCloseSphericityLefttEye.Text; gt.CloseSphericityRightEye = txtCloseSphericityRightEye.Text; gt.CloseAcuityLeftEye = txtCloseVisualAcuityLeftEye.Text; gt.CloseAcuityRightEye = txtCloseVisualAcuityRightEye.Text; gt.BothAcuity = txtBothAcuity.Text; gt.BothAxisLeftEye = txtBothAxisLeftEye.Text; gt.BothAxisRightEye = txtBothAxisRightEye.Text; gt.BothCenters = txtBothCenter.Text; gt.BothCylinderLeftEye = txtBothCylinderLeftEye.Text; gt.BothCylinderRightEye = txtBothCylinderRightEye.Text; gt.BothPrismLeftEye = txtBothPrismLeftEye.Text; gt.BothPrismRightEye = txtBothPrismRightEye.Text; gt.BothSphericityLeftEye = txtBothSphericityLefttEye.Text; gt.BothSphericityRightEye = txtBothSphericityRightEye.Text; gt.BothAcuityLeftEye = txtBothVisualAcuityLeftEye.Text; gt.BothAcuityRightEye = txtBothVisualAcuityRightEye.Text; gt.Comments = txtComments.Text; }