public void PopulateGradeDetails(int?pathologyId) { // clear fields CICHelper.ClearCaisisInputControlValues(GradeDetailsPanel); if (pathologyId.HasValue) { // set pathstagegrade PathologyStageGrade pathStageGrade = BusinessObject.GetByParent <PathologyStageGrade>(pathologyId.Value).FirstOrDefault(); if (pathStageGrade != null) { int pathologyStageGradeId = (int)pathStageGrade[PathologyStageGrade.PathologyStageGradeId]; CICHelper.SetFieldValues(this.Controls, pathStageGrade); PathologyStageGradeId.Value = pathologyStageGradeId + ""; } } }
public IEnumerable <BusinessObject> SaveGradeDetails(int pathologyId) { List <BusinessObject> records = new List <BusinessObject>(); bool formIsDirty = dirtyControls.Contains(GradeDetailsPanel); if (formIsDirty) { var inputs = CICHelper.GetCaisisInputControls(GradeDetailsPanel); var stageGradeFields = CICHelper.GetInputControlsByTable <PathologyStageGrade>(inputs); bool stageGradeHasValue = CICHelper.InputControlsHaveValue(stageGradeFields); if (stageGradeHasValue) { int?pathStageGradeId = null; if (!string.IsNullOrEmpty(PathologyStageGradeId.Value)) { pathStageGradeId = int.Parse(PathologyStageGradeId.Value); } PathologyStageGrade pathStageGrade = new PathologyStageGrade(); // udpate if (pathStageGradeId.HasValue) { pathStageGrade.Get(pathStageGradeId.Value); } // insert else { pathStageGrade[PathologyStageGrade.PathologyId] = pathologyId; } CICHelper.SetBOValues(GradeDetailsPanel.Controls, pathStageGrade, pathologyId); base.SaveBizo(pathStageGrade); if (pathStageGrade.PrimaryKeyHasValue) { pathStageGradeId = (int)pathStageGrade[PathologyStageGrade.PathologyStageGradeId]; PathologyStageGradeId.Value = pathStageGradeId + ""; records.Add(pathStageGrade); } } } return(records.ToArray()); }
public override void Populate() { Procedure diagnosticProcedure = GetBaselineBiopsy(); int? diagnosticProcedureId = null; if (diagnosticProcedure != null) { // set procedure diagnosticProcedureId = (int)diagnosticProcedure[Procedure.ProcedureId]; ProcedureId.Value = diagnosticProcedureId + ""; Procedure procedure = new Procedure(); procedure.Get(diagnosticProcedureId.Value); CICHelper.SetFieldValues(DiagnosticBiopsyFields.Controls, procedure); // set path stage grade PathologyStageGradeId.Value = ""; Pathology pathology = BusinessObject.GetByFields <Pathology>(new Dictionary <string, object> { { Pathology.PatientId, base.patientId }, { Pathology.ProcedureId, diagnosticProcedureId.Value } }).FirstOrDefault(); if (pathology != null) { int pathologyId = (int)pathology[Pathology.PathologyId]; PathologyId.Value = pathologyId + ""; CICHelper.SetFieldValues(DiagnosticBiopsyFields.Controls, pathology); PathologyStageGrade stageGrade = BusinessObject.GetByParent <PathologyStageGrade>(pathologyId).FirstOrDefault(); PathologyStageGradeId.Value = stageGrade != null ? stageGrade[PathologyStageGrade.PathologyStageGradeId].ToString() : ""; if (stageGrade != null) { CICHelper.SetFieldValues(StageGradePanel.Controls, stageGrade); } } } else { PathologyStageGradeId.Value = ""; } // populate // static controls // Control clearBtn = e.Item.FindControl("ClearBtn"); // Control lockImg = e.Item.FindControl("LockImage"); // clearBtn.Visible = false; // lockImg.Visible = false; // get procedure int?procedureId = null; if (!string.IsNullOrEmpty(ProcedureId.Value)) { procedureId = int.Parse(ProcedureId.Value); } // valida row if (procedureId.HasValue) { Procedure procedure = new Procedure(); procedure.Get(procedureId.Value); CICHelper.SetFieldValues(this.Controls, procedure); ProcedureId.Value = procedureId.Value + ""; // set button states bool isLocked = (procedure[Procedure.LockedBy] + "") != ""; // lockImg.Visible = isLocked; // get pathology Pathology pathology = BusinessObject.GetByFields <Pathology>(new Dictionary <string, object> { { Patient.PatientId, base.patientId }, { Pathology.ProcedureId, procedureId.Value } }).FirstOrDefault(); if (pathology != null && pathology.PrimaryKeyHasValue) { // populate pathology int pathologyId = (int)pathology[Pathology.PathologyId]; CICHelper.SetFieldValues(this.Controls, pathology); PathologyId.Value = pathologyId + ""; // populate path BiopsyProstatePathology biopsyPath = BusinessObject.GetByParent <BiopsyProstatePathology>(pathologyId).FirstOrDefault(); if (biopsyPath != null && biopsyPath.PrimaryKeyHasValue) { CICHelper.SetFieldValues(this.Controls, biopsyPath); } } } // blank row else { // clearBtn.Visible = true; } // set script string script = string.Format("calculateBxResult('{0}', '{1}', '{2}');", PathGG1.ClientID, PathGG2.ClientID, PathGGS.ClientID); PathGG1.Attributes["onchange"] = script; PathGG2.Attributes["onchange"] = script; }
public override IEnumerable <BusinessObject> Save() { // save diag biopsy List <BusinessObject> records = new List <BusinessObject>(); IEnumerable <ICaisisInputControl> stageGradeFields = CICHelper.GetCaisisInputControls(StageGradePanel); int?procedureId = null; if (!string.IsNullOrEmpty(ProcedureId.Value)) { procedureId = int.Parse(ProcedureId.Value); } int?pathologyId = null; if (!string.IsNullOrEmpty(PathologyId.Value)) { pathologyId = int.Parse(PathologyId.Value); } var inputs = CICHelper.GetCaisisInputControls(this); var procFields = CICHelper.GetInputControlsByTable <Procedure>(inputs); var pathFields = CICHelper.GetInputControlsByTable <Pathology>(inputs); var biopsyPathFields = CICHelper.GetInputControlsByTable <BiopsyProstatePathology>(inputs); // validation if (CICHelper.InputControlsHaveValue(pathFields)) { // step 1: create procedure Procedure procedure = new Procedure(); if (procedureId.HasValue) { procedure.Get(procedureId.Value); } else { procedure[Procedure.PatientId] = base.patientId; } // copy field values procedure[Procedure.ProcName] = PathSpecimenType.Value; procedure[Procedure.ProcDateText] = ProcDateText.Value; procedure[Procedure.ProcDate] = ProcDate.Value; procedure[Procedure.ProcSite] = PathSite.Value; // get special stamp procedure.AppendToUserName(GetEnteredBySuffix()); procedure.Save(); //base.SaveBizo(procedure); procedureId = (int)procedure[Procedure.ProcedureId]; ProcedureId.Value = procedureId + ""; records.Add(procedure); // step 2: create path Pathology pathology = new Pathology(); if (pathologyId.HasValue) { pathology.Get(pathologyId.Value); } else { pathology[Pathology.PatientId] = base.patientId; pathology[Pathology.ProcedureId] = procedureId; pathology[Pathology.PathDateText] = ProcDateText.Value; pathology[Pathology.PathDate] = ProcDate.Value; } pathology[Pathology.PathSpecimenType] = PathSpecimenType.Value; pathology[Pathology.PathSite] = PathSite.Value; CICHelper.SetBOValues(this.Controls, pathology, base.patientId); base.SaveBizo(pathology); pathologyId = (int)pathology[Pathology.PathologyId]; PathologyId.Value = pathologyId + ""; records.Add(pathology); // step 3: create biopsy path if (CICHelper.InputControlsHaveValue(biopsyPathFields)) { BiopsyProstatePathology biopsyPath = BusinessObject.GetByParent <BiopsyProstatePathology>(pathologyId.Value).FirstOrDefault(); // new if (biopsyPath == null) { biopsyPath = new BiopsyProstatePathology(); biopsyPath[BiopsyProstatePathology.PathologyId] = pathologyId.Value; } CICHelper.SetBOValues(this.Controls, biopsyPath, pathologyId.Value); base.SaveBizo(biopsyPath); } // step 4: save path stage grade if (CICHelper.InputControlsHaveValue(stageGradeFields) && !string.IsNullOrEmpty(PathStageT.Value)) { int?stageGradeId = null; // load by pri key if (!string.IsNullOrEmpty(PathologyStageGradeId.Value)) { stageGradeId = int.Parse(PathologyStageGradeId.Value); } // get par key for save else if (!string.IsNullOrEmpty(PathologyId.Value)) { pathologyId = int.Parse(PathologyId.Value); } if (pathologyId.HasValue || stageGradeId.HasValue) { PathologyStageGrade stageGrade = base.SaveRecord <PathologyStageGrade>(StageGradePanel, pathologyId, stageGradeId); PathologyStageGradeId.Value = stageGrade[PathologyStageGrade.PathologyStageGradeId] + ""; records.Add(stageGrade); } } } //Populate(); return(records); }