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 { ExaminationAssignedId = (int)Session["DeleteId"]; ExaminationAssigned = (from da in ctx.ExaminationAssigneds where da.ExaminationAssignedId == ExaminationAssignedId select da).FirstOrDefault <ExaminationAssigned>(); ctx.Delete(ExaminationAssigned); 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 == "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"]); examinationAssigned = CntAriCli.GetExaminationAssigned(examinationAssignedId, ctx); LoadData(examinationAssigned); } 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; } }
protected void UnloadData(ExaminationAssigned da) { da.Patient = CntAriCli.GetPatient(int.Parse(rdcPatient.SelectedValue), ctx); da.ExaminationDate = (DateTime)rdpExaminationDate.SelectedDate; da.Examination = CntAriCli.GetExamination(int.Parse(rdcExamination.SelectedValue), ctx); if (visit != null) { da.BaseVisit = visit; } da.Comments = txtComments.Text; }
protected void LoadData(ExaminationAssigned da) { // Load patient data rdcPatient.Items.Clear(); rdcPatient.Items.Add(new RadComboBoxItem(da.Patient.FullName, da.Patient.PersonId.ToString())); // Load Examination data rdcExamination.Items.Clear(); rdcExamination.Items.Add(new RadComboBoxItem(da.Examination.Name, da.Examination.ExaminationId.ToString())); rdpExaminationDate.SelectedDate = da.ExaminationDate; txtComments.Text = da.Comments; }
protected bool CreateChange() { if (!DataOk()) { return(false); } if (examinationAssigned == null) { examinationAssigned = new ExaminationAssigned(); UnloadData(examinationAssigned); ctx.Add(examinationAssigned); } else { examination = CntAriCli.GetExamination(examinationId, ctx); UnloadData(examinationAssigned); } ctx.SaveChanges(); return(true); }