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 == "diagnostic" select p).FirstOrDefault <Process>(); per = CntAriCli.GetPermission(user.UserGroup, proc, ctx); btnAccept.Visible = per.Modify; } // if (Request.QueryString["DiagnosticId"] != null) { DiagnosticId = Int32.Parse(Request.QueryString["DiagnosticId"]); diagnostic = CntAriCli.GetDiagnostic(DiagnosticId, ctx); LoadData(diagnostic); } }
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 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); }