/// <summary> /// Returns the Pathology(key) AND (ProstatectomyPathology OR BiopsyProstatePathology)(value) used for calulating gleason score. /// </summary> /// <param name="patientProtocolId"></param> /// <returns></returns> public static KeyValuePair <Pathology, BusinessObject>?GetGleasonPathologyRecord(int patientProtocolId) { Pathology path = PatientProtocolController.GetPatientRelatedRecords <Pathology>(patientProtocolId).FirstOrDefault(); if (path != null && !path.IsEmpty) { int pathologyId = (int)path[Pathology.PathologyId]; string pathType = path[Pathology.PathSpecimenType].ToString(); // manuall set child records if (pathType.Equals("Prostatectomy")) { var prostatectomy = BusinessObject.GetByParent <ProstatectomyPathology>(pathologyId).FirstOrDefault(); if (prostatectomy != null) { return(new KeyValuePair <Pathology, BusinessObject>(path, prostatectomy)); } } else if (pathType == "Biopsy") { var biopsy = BusinessObject.GetByParent <BiopsyProstatePathology>(pathologyId).FirstOrDefault(); if (biopsy != null) { return(new KeyValuePair <Pathology, BusinessObject>(path, biopsy)); } } } return(null); }
private void PopulateProstatectomyDetails() { // build Prostatectomy: single entry int? prostatectomyId = null; int? pathologyId = null; Procedure prostatectomy = GetProstatectomy(); if (prostatectomy != null && prostatectomy.PrimaryKeyHasValue) { prostatectomyId = (int?)prostatectomy[Procedure.ProcedureId]; Pathology pathology = GetPathology(prostatectomyId.Value); if (pathology != null && pathology.PrimaryKeyHasValue) { pathologyId = (int)pathology[Pathology.PathologyId]; } } PopulateProstatectomyFields(prostatectomyId); // determine missed event ProstatectomyAbsentEvent.SetAbsentEvent(base.patientId); // set "yes" if (prostatectomyId.HasValue) { ProstatectomyAbsentEvent.YesChecked = true; } // populate Grade Details PopulateGradeDetails(pathologyId); }
public ActionResult DeleteConfirmed(int id) { Pathology pathology = db.Pathologies.Find(id); db.Pathologies.Remove(pathology); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Pathologies/Create public ActionResult Create(int?id, string num, int refid, string checkname, int detailid) { Pathology pathology = new Pathology(); pathology.rawid = refid; pathology.detailid = detailid; pathology.rawname = checkname; pathology.pathologynum = num; return(View(pathology)); }
// GET: Pathologies/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pathology pathology = db.Pathologies.Find(id); if (pathology == null) { return(HttpNotFound()); } return(View(pathology)); }
protected void PopulateProstatectomyFields(int?procedureId) { // static controls LockImage.Visible = false; // valida row if (procedureId.HasValue) { Procedure procedure = new Procedure(); procedure.Get(procedureId.Value); CICHelper.SetFieldValues(ProstatectomyDetailsFields.Controls, procedure); ProcedureId.Value = procedureId.Value + ""; // set button states bool isLocked = (procedure[Procedure.LockedBy] + "") != ""; LockImage.Visible = isLocked; // lock fields if (isLocked) { base.SetControlsLockState(ProstatectomyDetailsFields, true); } // get pathology Pathology pathology = GetPathology(procedureId.Value); if (pathology != null && pathology.PrimaryKeyHasValue) { // populate pathology int pathologyId = (int)pathology[Pathology.PathologyId]; CICHelper.SetFieldValues(ProstatectomyDetailsFields.Controls, pathology); PathologyId.Value = pathologyId + ""; // populate path ProstatectomyPathology prostatePath = BusinessObject.GetByParent <ProstatectomyPathology>(pathologyId).FirstOrDefault(); if (prostatePath != null && prostatePath.PrimaryKeyHasValue) { CICHelper.SetFieldValues(ProstatectomyDetailsFields.Controls, prostatePath); } } // no path: hide else { //e.Item.Visible = false; } } // 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 ActionResult <IEnumerable <PathologyReadDTO> > CreatePathology([FromBody] Pathology newPathology) { var patFromRepo = _repository.ExistPathology(newPathology.Name); if (patFromRepo != null) { return(new BadRequestObjectResult(new { message = "Existing Pathology", currentDate = DateTime.Now })); } _repository.CreatePathology(newPathology); _repository.SaveChanges(); var pathology = _mapper.Map <PathologyReadDTO>(newPathology); return(Created("https://cotecapi.com/pathologies", pathology)); }
private void BuildGleasonInterface() { int patientProtocolId = int.Parse(PatientProtocolId); KeyValuePair <Pathology, BusinessObject>?gleasonPair = ProtocolMgmtUtil.GetGleasonPathologyRecord(patientProtocolId); if (gleasonPair.HasValue) { // get pair, determin type of pathology Pathology path = gleasonPair.Value.Key; BusinessObject pathProcedure = gleasonPair.Value.Value; // validation if (path.IsEmpty) { return; } int pathologyId = (int)path[Pathology.PathologyId]; string pathType = path[Pathology.PathSpecimenType].ToString(); // manually set Path Fields PathDateText.Value = path[Pathology.PathDateText].ToString(); PathDate.Value = path[Pathology.PathDate].ToString(); PathSpecimenType.Value = pathType; // manuall set child records if (pathProcedure is ProstatectomyPathology) { ProstatectomyPathology prostatectomy = pathProcedure as ProstatectomyPathology; GleasonField1.Text = prostatectomy[ProstatectomyPathology.PathGG1].ToString(); GleasonField2.Text = prostatectomy[ProstatectomyPathology.PathGG2].ToString(); GleasonFieldSum.Text = prostatectomy[ProstatectomyPathology.PathGGS].ToString(); } else if (pathProcedure is BiopsyProstatePathology) { BiopsyProstatePathology biopsy = pathProcedure as BiopsyProstatePathology; GleasonField1.Text = biopsy[BiopsyProstatePathology.PathGG1].ToString(); GleasonField2.Text = biopsy[BiopsyProstatePathology.PathGG2].ToString(); GleasonFieldSum.Text = biopsy[BiopsyProstatePathology.PathGGS].ToString(); } else { CICHelper.ClearCaisisInputControlValues(GleasonFields); } } else { CICHelper.ClearCaisisInputControlValues(GleasonFields); } }
public ActionResult PathologyTest(Pathology p) { HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"]; string addedid = rxgoAdminCookie.Values["Hid"]; p.AddedBy = addedid; try { if (dl.InsertPathologyTest_Sp(p) > 0) { TempData["MSG"] = "Data Saved Successfully."; } } catch (Exception ex) { TempData["MSG"] = "Something went wrong."; return(Redirect("/Pathology/PathologyTest")); } TempData["MSG"] = "Data Saved Successfully."; return(Redirect("/Pathology/PathologyTest")); }
public QResponse First(string token, int p_id, int lang) { QResponse result = new QResponse(); try { using (ISession session = ApplicationCore.Instance.SessionFactory.OpenSession()) { if (LoginManager.Check(session, token)) { using (session.BeginTransaction()) { ICriteria criteria = session.CreateCriteria <Pathology>(); Pathology pat = session.Get <Pathology>(p_id); //session.Update(pat); result.value = session.Get <Question>(pat.QIdFirstQuestion); result.value = TranslateManager.Translate <Question>(session, lang, result.value); for (int i = 0; i < result.value.Answers.Count; i++) { result.value.Answers[i] = TranslateManager.Translate <Answer>(session, lang, result.value.Answers[i]); } session.Transaction.Commit(); } } else { LoginManager.NoValidToken(token); } } } catch (Exception ex) { result.error = new SerializedError(ex); } return(result); }
/*-------------------------------- * PATHOLOGIES *--------------------------------*/ /// <summary> /// Add a new pathology to the database. /// </summary> /// <param name="pathology">Pathology to add.</param> public void CreatePathology(Pathology pathology) { _context.Pathologies.Add(pathology); }
public ActionResult Create(Pathology pathology) { if (ModelState.IsValid) { pathology.pathologynum = Request.Form["pathologynum"]; string aa = Request.Form["detailid"]; int bb = Convert.ToInt32(aa); if (pathology.parts == null) { } else if (pathology.parts != null) { InsertPathlogy(pathology.pathologynum, pathology.parts, pathology.chronic, pathology.acute, pathology.atrophy, pathology.intestinal, pathology.dysplasia, pathology.lymphoid, pathology.pitepithelial, pathology.Mucosal); } if (pathology.parts1 == null) { } else if (pathology.parts1 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts1, pathology.chronic1, pathology.acute1, pathology.atrophy1, pathology.intestinal1, pathology.dysplasia1, pathology.lymphoid1, pathology.pitepithelial1, pathology.Mucosal1); } if (pathology.parts2 == null) { } else if (pathology.parts2 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts2, pathology.chronic2, pathology.acute2, pathology.atrophy2, pathology.intestinal2, pathology.dysplasia2, pathology.lymphoid2, pathology.pitepithelial2, pathology.Mucosal2); } if (pathology.parts3 == null) { } else if (pathology.parts3 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts3, pathology.chronic3, pathology.acute3, pathology.atrophy3, pathology.intestinal3, pathology.dysplasia3, pathology.lymphoid3, pathology.pitepithelial3, pathology.Mucosal3); } if (pathology.parts4 == null) { } else if (pathology.parts4 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts4, pathology.chronic4, pathology.acute4, pathology.atrophy4, pathology.intestinal4, pathology.dysplasia4, pathology.lymphoid4, pathology.pitepithelial4, pathology.Mucosal4); } return(RedirectToAction("Details/" + bb, "Visits")); } else { List <string> Keys = ModelState.Keys.ToList(); //获取每一个key对应的ModelStateDictionary foreach (var key in Keys) { var errors = ModelState[key].Errors.ToList(); //将错误描述输出到控制台 foreach (var error in errors) { Console.WriteLine(error.ErrorMessage); } } } return(View(pathology)); }
private void BulkUpload(bool isPreview) { // data source for preview/audit DataTable auditTable = new DataTable(); auditTable.Columns.AddRange(new DataColumn[] { new DataColumn("PathologyId"), new DataColumn("PathNum"), new DataColumn("Source"), new DataColumn("Target"), new DataColumn("DuplicatePathologyId", typeof(bool)), new DataColumn("DuplicateTargetFileId", typeof(bool)) }); // validation if (!string.IsNullOrEmpty(FILE_DESTINATION_TARGET) && !string.IsNullOrEmpty(FILE_SOURCE_ROOT)) { try { // validate source and files DirectoryInfo sourceDirectory = new DirectoryInfo(FILE_SOURCE_ROOT); if (!sourceDirectory.Exists) { Message.Text = "Source directory does not exists."; return; } FileInfo[] sourceFiles = sourceDirectory.GetFiles(); if (sourceFiles.Count() == 0) { Message.Text = "No Files to copy."; return; } DirectoryInfo targetDirectory = new DirectoryInfo(FILE_DESTINATION_TARGET); // create target upload directory if needed if (!targetDirectory.Exists) { targetDirectory = System.IO.Directory.CreateDirectory(FILE_DESTINATION_TARGET); } // for each source file, upload foreach (FileInfo source_file in sourceFiles) { // locals int pathologyId = int.MinValue; string pathNum = string.Empty; string sourceFullFileName = string.Empty; string targetFileFullName = string.Empty; bool duplicatePathologyId = false; bool duplicateTargetFile = false; string sourceFileName = source_file.Name; sourceFullFileName = source_file.FullName; string fileExtension = source_file.Extension.ToLower(); // validate mime types if (string.IsNullOrEmpty(fileExtension) || !MIME_TYPES.Keys.Contains(fileExtension)) { continue; } string mimeType = MIME_TYPES[fileExtension]; // parse path num pathNum = Path.GetFileNameWithoutExtension(source_file.FullName); // cleanup int foundIndex = pathNum.IndexOf('_'); // PATH-NUM_C.jpg if (foundIndex > -1) { pathNum = pathNum.Substring(0, foundIndex); } // check for Pathology record if (!string.IsNullOrEmpty(pathNum)) { // search for pathology records IEnumerable <Pathology> pathologyRecords = BusinessObject.GetByFields <Pathology>(new Dictionary <string, object> { { Pathology.PathNum, pathNum } }); // do upload, only when single result found if (pathologyRecords.Count() == 1 || (pathologyRecords.Count() > 0 && isPreview)) { // get Pathology record Pathology pathologyRecord = pathologyRecords.First(); pathologyId = (int)pathologyRecord[Pathology.PathologyId]; // don't upload when Table=Pathology + TablePriKey = PathologyId + OriginalFileName = SourceFileName duplicateTargetFile = BusinessObject.GetByFields <UploadedFile>(new Dictionary <string, object> { { UploadedFile.TableName, pathologyRecord.TableName }, { UploadedFile.TablePrimaryKey, pathologyId }, { UploadedFile.OriginalFileName, sourceFileName } }).Count() > 0; // don't upload when if (!duplicateTargetFile || isPreview) { // only do insert when file doesn't exist if (!isPreview) { // create FileUpload record UploadedFile fileUpload = new UploadedFile(); fileUpload[UploadedFile.TableName] = pathologyRecord.TableName; fileUpload[UploadedFile.TablePrimaryKey] = pathologyId; fileUpload[UploadedFile.OriginalFileName] = source_file.Name; fileUpload[UploadedFile.FileExtension] = fileExtension; fileUpload[UploadedFile.FilePath] = targetDirectory.FullName; fileUpload[UploadedFile.FileType] = mimeType; fileUpload[UploadedFile.FileLabel] = FILE_LABEL; fileUpload[UploadedFile.OnFileServer] = 1; fileUpload.Save(); int fileId = (int)fileUpload[UploadedFile.FileId]; targetFileFullName = targetDirectory.FullName + System.IO.Path.DirectorySeparatorChar + fileId + fileExtension; string targetThumbFileName = targetDirectory.FullName + System.IO.Path.DirectorySeparatorChar + fileId + THUMB_EXTENSION + fileExtension; if (!File.Exists(targetFileFullName)) { // upload/copy file source_file.CopyTo(targetFileFullName, false); // create thumbnail System.Drawing.Bitmap sourceBitmap = new System.Drawing.Bitmap(targetFileFullName); System.Drawing.Image sourceFileThumb = sourceBitmap.GetThumbnailImage(THUMB_WIDTH, THUMB_HEIGHT, OnThumbnailCreationFail, IntPtr.Zero); sourceFileThumb.Save(targetThumbFileName); // cleanup after creation sourceFileThumb.Dispose(); sourceBitmap.Dispose(); } } } } } // add audit data object[] rowData = new object[] { pathologyId, pathNum, sourceFullFileName, targetFileFullName, duplicatePathologyId, duplicateTargetFile }; auditTable.Rows.Add(rowData); } // update message LivePanel.Visible = auditTable.Rows.Count > 0; if (isPreview) { if (auditTable.Rows.Count > 0) { Message.Text = "Review Files Below"; } else { Message.Text = "No Files to Preview"; } } else { Message.Text = "Files Below Uploaded"; } } catch (Exception ex) { Message.Text = ex.Message; } } else { Message.Text = "Please check upload settings"; } // update results var dataView = auditTable.DefaultView; dataView.Sort = "PathNum ASC, PathologyId ASC"; AuditGridView.DataSource = dataView; AuditGridView.DataBind(); // display number of acutal uploads TotalFiles.Text = dataView.Count.ToString(); // !important, filter then adjust counts dataView.RowFilter = "PathologyId > -1 AND DuplicateTargetFileId = 0"; TotalToUploadFiles.Text = dataView.Count.ToString(); TotalUploaded.Text = isPreview ? "0" : dataView.Count.ToString(); }
public ActionResult PathologyTest() { List <Pathology> PathologyList = new List <Pathology>(); Property p = new Property(); DataSet ds = new DataSet(); p.OnTable = "FetchPathologyTest"; ds = dl.FetchPathologyTest_sp(p); List <SelectListItem> CategoryList = new List <SelectListItem>(); CategoryList.Add(new SelectListItem { Text = "Select Category", Value = "" }); foreach (DataRow dr in ds.Tables[1].Rows) { CategoryList.Add(new SelectListItem { Text = dr["CategoryName"].ToString(), Value = dr["CategoryId"].ToString() }); } ViewBag.CategoryList = new SelectList(CategoryList, "Value", "Text"); List <SelectListItem> PatientList = new List <SelectListItem>(); PatientList.Add(new SelectListItem { Text = "Select Patient", Value = "" }); foreach (DataRow dr in ds.Tables[2].Rows) { PatientList.Add(new SelectListItem { Text = dr["Name"].ToString(), Value = dr["PatientId"].ToString() }); } ViewBag.PatientList = new SelectList(PatientList, "Value", "Text"); List <SelectListItem> DoctorList = new List <SelectListItem>(); DoctorList.Add(new SelectListItem { Text = "Select Doctor", Value = "" }); foreach (DataRow dr in ds.Tables[3].Rows) { DoctorList.Add(new SelectListItem { Text = dr["FullName"].ToString(), Value = dr["EmployeeId"].ToString() }); } ViewBag.DoctorList = new SelectList(DoctorList, "Value", "Text"); try { foreach (DataRow item in ds.Tables[0].Rows) { Pathology m = new Pathology(); m.PathologyId = item["PathologyId"].ToString(); m.TestName = item["TestName"].ToString(); m.ShortName = item["ShortName"].ToString(); m.TestType = item["TestType"].ToString(); m.SubCategoryId = item["SubCategoryId"].ToString(); m.CategoryId = item["CategoryId"].ToString(); m.CategoryName = item["CategoryName"].ToString(); m.SubCategoryName = item["SubCategoryName"].ToString(); m.Method = item["Method"].ToString(); m.ReportDays = item["ReportDays"].ToString(); m.Charge = item["Charge"].ToString(); m.IsActive = item["IsActive"].ToString(); PathologyList.Add(m); } ViewBag.PathologyList = PathologyList; } catch (Exception e) { } return(View()); }
public ActionResult Edit(Pathology pathology) { if (ModelState.IsValid) { pathology.pathologynum = Request.Form["pathologynum"]; string aa = Request.Form["detailid"]; int bb = Convert.ToInt32(aa); string a = Request.Form["Id2"]; int b = Convert.ToInt32(a); if (pathology.idd != 0) { UpdatePathlogy(pathology.idd, pathology.pathologynum, pathology.parts, pathology.chronic, pathology.acute, pathology.atrophy, pathology.intestinal, pathology.dysplasia, pathology.lymphoid, pathology.pitepithelial, pathology.Mucosal); } else if (pathology.idd == 0 && pathology.parts != null) { InsertPathlogy(pathology.pathologynum, pathology.parts, pathology.chronic, pathology.acute, pathology.atrophy, pathology.intestinal, pathology.dysplasia, pathology.lymphoid, pathology.pitepithelial, pathology.Mucosal); } if (pathology.id1 != 0) { UpdatePathlogy(pathology.id1, pathology.pathologynum, pathology.parts1, pathology.chronic1, pathology.acute1, pathology.atrophy1, pathology.intestinal1, pathology.dysplasia1, pathology.lymphoid1, pathology.pitepithelial1, pathology.Mucosal1); } else if (pathology.id1 == 0 && pathology.parts1 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts1, pathology.chronic1, pathology.acute1, pathology.atrophy1, pathology.intestinal1, pathology.dysplasia1, pathology.lymphoid1, pathology.pitepithelial1, pathology.Mucosal1); } if (pathology.id2 != 0) { UpdatePathlogy(pathology.id2, pathology.pathologynum, pathology.parts2, pathology.chronic2, pathology.acute2, pathology.atrophy2, pathology.intestinal2, pathology.dysplasia2, pathology.lymphoid2, pathology.pitepithelial2, pathology.Mucosal2); } else if (pathology.id2 == 0 && pathology.parts2 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts2, pathology.chronic2, pathology.acute2, pathology.atrophy2, pathology.intestinal2, pathology.dysplasia2, pathology.lymphoid2, pathology.pitepithelial2, pathology.Mucosal2); } if (pathology.id3 != 0) { UpdatePathlogy(pathology.id3, pathology.pathologynum, pathology.parts3, pathology.chronic3, pathology.acute3, pathology.atrophy3, pathology.intestinal3, pathology.dysplasia3, pathology.lymphoid3, pathology.pitepithelial3, pathology.Mucosal3); } else if (pathology.id3 == 0 && pathology.parts3 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts3, pathology.chronic3, pathology.acute3, pathology.atrophy3, pathology.intestinal3, pathology.dysplasia3, pathology.lymphoid3, pathology.pitepithelial3, pathology.Mucosal3); } if (pathology.id4 != 0) { UpdatePathlogy(pathology.id4, pathology.pathologynum, pathology.parts4, pathology.chronic4, pathology.acute4, pathology.atrophy4, pathology.intestinal4, pathology.dysplasia4, pathology.lymphoid4, pathology.pitepithelial4, pathology.Mucosal4); } else if (pathology.id4 == 0 && pathology.parts4 != null) { InsertPathlogy(pathology.pathologynum, pathology.parts4, pathology.chronic4, pathology.acute4, pathology.atrophy4, pathology.intestinal4, pathology.dysplasia4, pathology.lymphoid4, pathology.pitepithelial4, pathology.Mucosal4); } return(RedirectToAction("Details/" + bb, "Visits")); } return(View(pathology)); }
public override IEnumerable <BusinessObject> Save() { List <BusinessObject> records = new List <BusinessObject>(); IEnumerable <Control> dirtyControls = base.GetDirtyInputControls(BiopsiesRptr); foreach (RepeaterItem dirtyRow in dirtyControls) { // key controls HiddenField procIdField = dirtyRow.FindControl("ProcedureId") as HiddenField; HiddenField pathIdField = dirtyRow.FindControl("PathologyId") as HiddenField; int? procedureId = null; if (!string.IsNullOrEmpty(procIdField.Value)) { procedureId = int.Parse(procIdField.Value); } int?pathologyId = null; if (!string.IsNullOrEmpty(pathIdField.Value)) { pathologyId = int.Parse(pathIdField.Value); } var inputs = CICHelper.GetCaisisInputControls(dirtyRow); var procFields = CICHelper.GetInputControlsByTable <Procedure>(inputs); var pathFields = CICHelper.GetInputControlsByTable <Pathology>(inputs); var biopsyPathFields = CICHelper.GetInputControlsByTable <BiopsyProstatePathology>(inputs); // special fields ICaisisInputControl pathType = dirtyRow.FindControl("PathSpecimenType") as ICaisisInputControl; ICaisisInputControl procDateText = dirtyRow.FindControl("ProcDateText") as ICaisisInputControl; ICaisisInputControl procDate = dirtyRow.FindControl("ProcDate") as ICaisisInputControl; ICaisisInputControl pathSite = dirtyRow.FindControl("PathSite") as ICaisisInputControl; // 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] = pathType.Value; procedure[Procedure.ProcSite] = pathSite.Value; procedure[Procedure.ProcDateText] = procDateText.Value; procedure[Procedure.ProcDate] = procDate.Value; base.SaveBizo(procedure); procedureId = (int)procedure[Procedure.ProcedureId]; procIdField.Value = procedureId + ""; // 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] = pathType.Value; pathology[Pathology.PathSite] = pathSite.Value; CICHelper.SetBOValues(dirtyRow.Controls, pathology, base.patientId); base.SaveBizo(pathology); pathologyId = (int)pathology[Pathology.PathologyId]; pathIdField.Value = pathologyId + ""; // update biz list records.Add(procedure); records.Add(pathology); } // step 3: create biopsy path if (CICHelper.InputControlsHaveValue(biopsyPathFields) && pathologyId.HasValue) { BiopsyProstatePathology biopsyPath = new BiopsyProstatePathology(); // load existing biopsyPath.Get(pathologyId.Value); // else create if (biopsyPath.IsEmpty) { biopsyPath[BiopsyProstatePathology.PathologyId] = pathologyId; } CICHelper.SetBOValues(dirtyRow.Controls, biopsyPath, pathologyId.Value); base.SaveBizo(biopsyPath); records.Add(biopsyPath); } } //Populate(); 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); }
// define mapping of tables that have OPTIONAL KEYS: // - Procedures to Pathology // - Procedures to OperatingRoomDetails // - Pathology to OperatingRoomDetails private void SetLinksBasedOnTableRelationship(string currentTableName, string tableName, int currentTablePrimaryKeyValue) { bool isChildForm = false; // none of the forms in this mapping are children of the current table if (currentTablePrimaryKeyValue == 0) // key value not defined on new forms- just display an active link to relevant forms { AppendLinkToRelevantForm(tableName, 0, 0, 0, isChildForm); return; } Procedure procedure = new Procedure(); Pathology pathology = new Pathology(); OperatingRoomDetail orDetail = new OperatingRoomDetail(); string procedureTableName = procedure.TableName; string pathologyTableName = pathology.TableName; string orDetailsTableName = orDetail.TableName; switch (currentTableName) { case "Procedures": // see if this procedure record has an ORDetailId if (tableName.Equals(orDetailsTableName)) { // procedure.Find(Procedure.ProcedureId, currentTablePrimaryKeyValue); // ? procedure.Get(currentTablePrimaryKeyValue); int orDetailId = 0; if (procedure[Procedure.OperatingRoomDetailId] != System.DBNull.Value) { orDetailId = (int)procedure[Procedure.OperatingRoomDetailId]; } int recordCount = 0; if (orDetailId > 0) { recordCount = 1; // a procedure can be associated with at most one OperatingRoomDetail record } AppendLinkToRelevantForm(orDetailsTableName, orDetailId, 0, recordCount, isChildForm); } // see if the pathology table has any record with this procedureId else if (tableName.Equals(pathologyTableName)) { //pathology.Find(Pathology.ProcedureId, currentTablePrimaryKeyValue); //int recordCount = pathology.RecordCount; var conditions = new Dictionary <string, object>() { { Pathology.ProcedureId, currentTablePrimaryKeyValue } }; IEnumerable <Pathology> paths = BusinessObject.GetByFields <Pathology>(conditions); int recordCount = paths.Count(); int recordIndex = 0; if (recordCount > 0) // could be multiple path records all with the same procedure id { for (int i = 0; i < recordCount; i++) { if (recordCount > 1) { recordIndex = i + 1; } //DataRow dr = pathology.DataSourceView.Table.Rows[i]; //AppendLinkToRelevantForm(pathologyTableName, (int)dr[Pathology.PathologyId], recordIndex, recordCount, isChildForm); Pathology p = paths.ElementAt(i); AppendLinkToRelevantForm(pathologyTableName, (int)p[Pathology.PathologyId], recordIndex, recordCount, isChildForm); } } else { AppendLinkToRelevantForm(pathology.TableName, recordIndex, recordCount, isChildForm); } } break; case "Pathology": // see if this Pathogy Record has an ORDetailID OR a Procedure Id if (tableName.Equals(orDetailsTableName)) { pathology.Get(currentTablePrimaryKeyValue); int orDetailId = 0; if (pathology[Pathology.OperatingRoomDetailId] != System.DBNull.Value) { orDetailId = (int)pathology[Pathology.OperatingRoomDetailId]; } int recordCount = 0; if (orDetailId > 0) { recordCount = 1; // a pathology can be associated with at most one OperatingRoomDetail record } AppendLinkToRelevantForm(orDetailsTableName, orDetailId, 0, recordCount, isChildForm); } else if (tableName.Equals(procedureTableName)) { pathology.Get(currentTablePrimaryKeyValue); int procedureId = 0; if (pathology[Pathology.ProcedureId] != System.DBNull.Value) { procedureId = (int)pathology[Pathology.ProcedureId]; } int recordCount = 0; if (procedureId > 0) { recordCount = 1; // a pathology can be associated with at most one pathology record } AppendLinkToRelevantForm(procedureTableName, procedureId, 0, recordCount, isChildForm); } break; case "OperatingRoomDetails": // see if the Procedures table and the Pathology table have records with this ORDetailId if (tableName.Equals(pathologyTableName)) { //pathology.Find(Pathology.OperatingRoomDetailId, currentTablePrimaryKeyValue); //int recordCount = pathology.RecordCount; var conditions = new Dictionary <string, object>() { { Pathology.OperatingRoomDetailId, currentTablePrimaryKeyValue } }; IEnumerable <Pathology> paths = BusinessObject.GetByFields <Pathology>(conditions); int recordCount = paths.Count(); int recordIndex = 0; if (recordCount > 0) // could be multiple path records all with the same procedure id { for (int i = 0; i < recordCount; i++) { if (recordCount > 1) { recordIndex = i + 1; } //DataRow dr = pathology.DataSourceView.Table.Rows[i]; //AppendLinkToRelevantForm(pathologyTableName, (int)dr[Pathology.PathologyId], recordIndex, recordCount, isChildForm); Pathology p = paths.ElementAt(i); AppendLinkToRelevantForm(pathologyTableName, (int)p[Pathology.PathologyId], recordIndex, recordCount, isChildForm); } } else { AppendLinkToRelevantForm(pathologyTableName, recordIndex, recordCount, isChildForm); } } else if (tableName.Equals(procedureTableName)) { //procedure.Find(Procedure.OperatingRoomDetailId, currentTablePrimaryKeyValue); //int recordCount = procedure.RecordCount; var conditions = new Dictionary <string, object>() { { Procedure.OperatingRoomDetailId, currentTablePrimaryKeyValue } }; IEnumerable <Procedure> procs = BusinessObject.GetByFields <Procedure>(conditions); int recordCount = procs.Count(); int recordIndex = 0; if (recordCount > 0) // could be multiple path records all with the same procedure id { for (int i = 0; i < recordCount; i++) { if (recordCount > 1) { recordIndex = i + 1; } //DataRow dr = procedure.DataSourceView.Table.Rows[i]; //AppendLinkToRelevantForm(procedureTableName, (int)dr[Procedure.ProcedureId], recordIndex, recordCount, isChildForm); Procedure p = procs.ElementAt(i); AppendLinkToRelevantForm(procedureTableName, (int)p[Procedure.ProcedureId], recordIndex, recordCount, isChildForm); } } else { AppendLinkToRelevantForm(procedureTableName, recordIndex, recordCount, isChildForm); } } break; default: break; } // use switch }
private IEnumerable <BusinessObject> SaveProstatectomy() { // save prostatectomies List <BusinessObject> records = new List <BusinessObject>(); IEnumerable <Control> dirtyControls = base.GetDirtyInputControls(ProstatectomyDetailsFields); var inputs = CICHelper.GetCaisisInputControls(ProstatectomyDetailsFields); bool isDirty = dirtyControls.Contains(ProstatectomyDetailsFields); if (isDirty) { 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 procFields = CICHelper.GetInputControlsByTable <Procedure>(inputs); var pathFields = CICHelper.GetInputControlsByTable <Pathology>(inputs); var prostatectomyPathFields = CICHelper.GetInputControlsByTable <ProstatectomyPathology>(inputs); // create/update proc if (CICHelper.InputControlsHaveValue(procFields)) { // step 1: create procedure Procedure procedure = new Procedure(); if (procedureId.HasValue) { procedure.Get(procedureId.Value); } else { procedure[Procedure.PatientId] = base.patientId; } CICHelper.SetBOValues(ProstatectomyDetailsFields.Controls, procedure, base.patientId); // copy field values procedure[Procedure.ProcName] = ProcName.Value; procedure[Procedure.ProcDateText] = ProcDateText.Value; procedure[Procedure.ProcDate] = ProcDate.Value; // special case: special stamp to mark inital proc //base.SaveBizo(procedure); procedure.AppendToUserName(GetEnteredBySuffix()); procedure.Save(); procedureId = (int)procedure[Procedure.ProcedureId]; ProcedureId.Value = procedureId + ""; // update biz list records.Add(procedure); } // step 2: create/udpate path if (pathologyId.HasValue || (CICHelper.InputControlsHaveValue(pathFields) && procedureId.HasValue)) { Pathology pathology = new Pathology(); if (pathologyId.HasValue) { pathology.Get(pathologyId.Value); } else { pathology[Pathology.PatientId] = base.patientId; pathology[Pathology.ProcedureId] = procedureId; pathology[Pathology.PathSpecimenType] = ProcName.Value; pathology[Pathology.PathDateText] = ProcDateText.Value; pathology[Pathology.PathDate] = ProcDate.Value; pathology[Pathology.PathDisease] = "Prostate"; } CICHelper.SetBOValues(ProstatectomyDetailsFields.Controls, pathology, base.patientId); base.SaveBizo(pathology); pathologyId = (int)pathology[Pathology.PathologyId]; PathologyId.Value = pathologyId + ""; records.Add(pathology); } // step 3: create/udpate Prostatectomy Path if (CICHelper.InputControlsHaveValue(prostatectomyPathFields) && pathologyId.HasValue) { ProstatectomyPathology prostatePath = new ProstatectomyPathology(); // load existing prostatePath.Get(pathologyId.Value); // else create if (prostatePath.IsEmpty) { prostatePath[ProstatectomyPathology.PathologyId] = pathologyId; } CICHelper.SetBOValues(ProstatectomyDetailsFields.Controls, prostatePath, pathologyId.Value); base.SaveBizo(prostatePath); records.Add(prostatePath); } } // save grade details if (!string.IsNullOrEmpty(PathologyId.Value)) { int pathologyId = int.Parse(PathologyId.Value); records.AddRange(SaveGradeDetails(pathologyId)); } return(records); }
/// <summary> /// Inserts/Updates the relevent labs and gleason calculations /// </summary> private void SaveDetails() { // validation int patientId = int.Parse(BaseDecryptedPatientId); int patientProtocolId = int.Parse(PatientProtocolId); PatientProtocol patientProtocol = new PatientProtocol(); patientProtocol.Get(patientProtocolId); var relatedLabTestIds = GetRelatedLabTestIds(patientProtocolId); // LABS (PSA) List <KeyValuePair <float, DateTime> > labResults = new List <KeyValuePair <float, DateTime> >(); foreach (GridViewRow row in LabTestsGrid.Rows) { LabTest lab = new LabTest(); // load??? string currentRowId = LabTestsGrid.DataKeys[row.RowIndex][LabTest.LabTestId].ToString(); if (!string.IsNullOrEmpty(currentRowId)) { lab.Get(int.Parse(currentRowId)); } CICHelper.SetBOValues(row.Controls, lab, patientId); if (!lab.IsEmpty) { lab[LabTest.LabTest_Field] = "PSA"; lab.Save(); int labTestId = (int)lab[LabTest.LabTestId]; string labTest = lab[LabTest.LabTest_Field].ToString(); string labResult = lab[LabTest.LabResult].ToString(); float labResultValue = 0; if (labTest.Equals("PSA") && float.TryParse(labResult, out labResultValue) && !lab.IsNull(LabTest.LabDate)) { DateTime labDate = (DateTime)lab[LabTest.LabDate]; labResults.Add(new KeyValuePair <float, DateTime>(labResultValue, labDate)); } // RELATED RECORD if (!relatedLabTestIds.Contains(labTestId)) { BOL.RelatedRecord relatedRecord = RelatedRecordController.CreateRelatedRecord(lab, patientProtocol); } } } // calculate doubling time float?dbl = ProtocolMgmtUtil.GetPatientPSADoublingTime(patientProtocolId); if (dbl.HasValue) { PSADoublingTime.Text = dbl + " Months"; } else { PSADoublingTime.Text = "N/A"; } // GLEASON SCORE Pathology pathology = PatientProtocolController.GetPatientRelatedRecords <Pathology>(patientProtocolId).FirstOrDefault(); // create new patholgy if needed if (!string.IsNullOrEmpty(PathSpecimenType.Value)) { bool isNewPathology = pathology == null; string pathType = PathSpecimenType.Value; if (isNewPathology) { pathology = new Pathology(); pathology[Pathology.PatientId] = patientId; } pathology[Pathology.PathSpecimenType] = pathType; pathology[Pathology.PathDateText] = PathDateText.Value; pathology[Pathology.PathDate] = PathDate.Value; pathology.Save(); if (!pathology.IsEmpty) { int pathologyId = (int)pathology[Pathology.PathologyId]; // create child record if (pathType.Equals("Prostatectomy")) { var prostatectomy = BusinessObject.GetByParent <ProstatectomyPathology>(pathologyId).FirstOrDefault(); if (prostatectomy == null) { prostatectomy = new ProstatectomyPathology(); prostatectomy[ProstatectomyPathology.PathologyId] = pathologyId; } prostatectomy[ProstatectomyPathology.PathGG1] = GleasonField1.Text; prostatectomy[ProstatectomyPathology.PathGG2] = GleasonField2.Text; prostatectomy[ProstatectomyPathology.PathGGS] = GleasonFieldSum.Text; prostatectomy.Save(); } else if (pathType == "Biopsy") { var biopsy = BusinessObject.GetByParent <BiopsyProstatePathology>(pathologyId).FirstOrDefault(); if (biopsy == null) { biopsy = new BiopsyProstatePathology(); biopsy[BiopsyProstatePathology.PathologyId] = pathologyId; } biopsy[BiopsyProstatePathology.PathGG1] = GleasonField1.Text; biopsy[BiopsyProstatePathology.PathGG2] = GleasonField2.Text; biopsy[BiopsyProstatePathology.PathGGS] = GleasonFieldSum.Text; biopsy.Save(); } // create related record if needed if (isNewPathology) { BOL.RelatedRecord relatedPathology = RelatedRecordController.CreateRelatedRecord(pathology, patientProtocol); } } } // rebuild UI BuildInterfaces(); }
/// <summary> /// Delete a pathology from the database. /// </summary> /// <param name="pathology">Pathology to delete.</param> public void DeletePathology(Pathology pathology) { _context.Pathologies.Remove(pathology); }
// GET: Pathologies/Edit/5 public ActionResult Edit(int?id, string num, int detailid) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DataTable dt = GetId(num); Pathology pathology = new Pathology(); pathology.pathologynum = num; pathology.detailid = detailid; int flag = dt.Rows.Count; if (flag == 1) { if (dt.Rows[0][0] != DBNull.Value) { pathology.idd = Convert.ToInt32(dt.Rows[0][0]); DataTable dtContent = GetContent(pathology.idd); pathology.parts = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); } pathology.id1 = 0; pathology.id2 = 0; pathology.id3 = 0; pathology.id4 = 0; } if (flag == 2) { if (dt.Rows[0][0] != DBNull.Value) { pathology.idd = Convert.ToInt32(dt.Rows[0][0]); DataTable dtContent = GetContent(pathology.idd); pathology.parts = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[1][0] != DBNull.Value) { pathology.id1 = Convert.ToInt32(dt.Rows[1][0]); DataTable dtContent = GetContent(pathology.id1); pathology.parts1 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic1 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute1 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy1 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal1 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia1 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid1 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial1 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal1 = Convert.ToInt32(dtContent.Rows[0][10]); } pathology.id2 = 0; pathology.id3 = 0; pathology.id4 = 0; } if (flag == 3) { if (dt.Rows[0][0] != DBNull.Value) { pathology.idd = Convert.ToInt32(dt.Rows[0][0]); DataTable dtContent = GetContent(pathology.idd); pathology.parts = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[1][0] != DBNull.Value) { pathology.id1 = Convert.ToInt32(dt.Rows[1][0]); DataTable dtContent = GetContent(pathology.id1); pathology.parts1 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic1 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute1 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy1 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal1 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia1 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid1 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial1 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal1 = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[2][0] != DBNull.Value) { pathology.id2 = Convert.ToInt32(dt.Rows[2][0]); DataTable dtContent2 = GetContent(pathology.id2); pathology.parts2 = Convert.ToString(dtContent2.Rows[0][2]); pathology.chronic2 = Convert.ToInt32(dtContent2.Rows[0][3]); pathology.acute2 = Convert.ToInt32(dtContent2.Rows[0][4]); pathology.atrophy2 = Convert.ToInt32(dtContent2.Rows[0][5]); pathology.intestinal2 = Convert.ToInt32(dtContent2.Rows[0][6]); pathology.dysplasia2 = Convert.ToInt32(dtContent2.Rows[0][7]); pathology.lymphoid2 = Convert.ToInt32(dtContent2.Rows[0][8]); pathology.pitepithelial2 = Convert.ToInt32(dtContent2.Rows[0][9]); pathology.Mucosal2 = Convert.ToInt32(dtContent2.Rows[0][10]); } pathology.id3 = 0; pathology.id4 = 0; } if (flag == 4) { if (dt.Rows[0][0] != DBNull.Value) { pathology.idd = Convert.ToInt32(dt.Rows[0][0]); DataTable dtContent = GetContent(pathology.idd); pathology.parts = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[1][0] != DBNull.Value) { pathology.id1 = Convert.ToInt32(dt.Rows[1][0]); DataTable dtContent = GetContent(pathology.id1); pathology.parts1 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic1 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute1 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy1 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal1 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia1 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid1 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial1 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal1 = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[2][0] != DBNull.Value) { pathology.id2 = Convert.ToInt32(dt.Rows[2][0]); DataTable dtContent2 = GetContent(pathology.id2); pathology.parts2 = Convert.ToString(dtContent2.Rows[0][2]); pathology.chronic2 = Convert.ToInt32(dtContent2.Rows[0][3]); pathology.acute2 = Convert.ToInt32(dtContent2.Rows[0][4]); pathology.atrophy2 = Convert.ToInt32(dtContent2.Rows[0][5]); pathology.intestinal2 = Convert.ToInt32(dtContent2.Rows[0][6]); pathology.dysplasia2 = Convert.ToInt32(dtContent2.Rows[0][7]); pathology.lymphoid2 = Convert.ToInt32(dtContent2.Rows[0][8]); pathology.pitepithelial2 = Convert.ToInt32(dtContent2.Rows[0][9]); pathology.Mucosal2 = Convert.ToInt32(dtContent2.Rows[0][10]); } if (dt.Rows[3][0] != DBNull.Value) { pathology.id3 = Convert.ToInt32(dt.Rows[3][0]); DataTable dtContent = GetContent(pathology.id3); pathology.parts3 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic3 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute3 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy3 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal3 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia3 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid3 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial3 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal3 = Convert.ToInt32(dtContent.Rows[0][10]); } pathology.id4 = 0; } if (flag == 5) { if (dt.Rows[0][0] != DBNull.Value) { pathology.idd = Convert.ToInt32(dt.Rows[0][0]); DataTable dtContent = GetContent(pathology.idd); pathology.parts = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[1][0] != DBNull.Value) { pathology.id1 = Convert.ToInt32(dt.Rows[1][0]); DataTable dtContent = GetContent(pathology.id1); pathology.parts1 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic1 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute1 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy1 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal1 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia1 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid1 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial1 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal1 = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[2][0] != DBNull.Value) { pathology.id2 = Convert.ToInt32(dt.Rows[2][0]); DataTable dtContent2 = GetContent(pathology.id2); pathology.parts2 = Convert.ToString(dtContent2.Rows[0][2]); pathology.chronic2 = Convert.ToInt32(dtContent2.Rows[0][3]); pathology.acute2 = Convert.ToInt32(dtContent2.Rows[0][4]); pathology.atrophy2 = Convert.ToInt32(dtContent2.Rows[0][5]); pathology.intestinal2 = Convert.ToInt32(dtContent2.Rows[0][6]); pathology.dysplasia2 = Convert.ToInt32(dtContent2.Rows[0][7]); pathology.lymphoid2 = Convert.ToInt32(dtContent2.Rows[0][8]); pathology.pitepithelial2 = Convert.ToInt32(dtContent2.Rows[0][9]); pathology.Mucosal2 = Convert.ToInt32(dtContent2.Rows[0][10]); } if (dt.Rows[3][0] != DBNull.Value) { pathology.id3 = Convert.ToInt32(dt.Rows[3][0]); DataTable dtContent = GetContent(pathology.id3); pathology.parts3 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic3 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute3 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy3 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal3 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia3 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid3 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial3 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal3 = Convert.ToInt32(dtContent.Rows[0][10]); } if (dt.Rows[4][0] != DBNull.Value) { pathology.id4 = Convert.ToInt32(dt.Rows[4][0]); DataTable dtContent = GetContent(pathology.id4); pathology.parts4 = Convert.ToString(dtContent.Rows[0][2]); pathology.chronic4 = Convert.ToInt32(dtContent.Rows[0][3]); pathology.acute4 = Convert.ToInt32(dtContent.Rows[0][4]); pathology.atrophy4 = Convert.ToInt32(dtContent.Rows[0][5]); pathology.intestinal4 = Convert.ToInt32(dtContent.Rows[0][6]); pathology.dysplasia4 = Convert.ToInt32(dtContent.Rows[0][7]); pathology.lymphoid4 = Convert.ToInt32(dtContent.Rows[0][8]); pathology.pitepithelial4 = Convert.ToInt32(dtContent.Rows[0][9]); pathology.Mucosal4 = Convert.ToInt32(dtContent.Rows[0][10]); } } //if (dt.Rows[0][0]!=DBNull.Value) //{ // pathology.idd = Convert.ToInt32(dt.Rows[0][0]); // DataTable dtContent = GetContent(pathology.idd); // pathology.parts = Convert.ToString(dtContent.Rows[0][2]); // pathology.chronic = Convert.ToInt32(dtContent.Rows[0][3]); // pathology.acute = Convert.ToInt32(dtContent.Rows[0][4]); // pathology.atrophy = Convert.ToInt32(dtContent.Rows[0][5]); // pathology.intestinal = Convert.ToInt32(dtContent.Rows[0][6]); // pathology.dysplasia = Convert.ToInt32(dtContent.Rows[0][7]); // pathology.lymphoid = Convert.ToInt32(dtContent.Rows[0][8]); // pathology.pitepithelial = Convert.ToInt32(dtContent.Rows[0][9]); // pathology.Mucosal = Convert.ToInt32(dtContent.Rows[0][10]); //} //else //{ // pathology.idd = 0; //} //if (dt.Rows[1][0] != DBNull.Value) //{ // pathology.id1 = Convert.ToInt32(dt.Rows[1][0]); // DataTable dtContent = GetContent(pathology.id1); // pathology.parts1 = Convert.ToString(dtContent.Rows[0][2]); // pathology.chronic1 = Convert.ToInt32(dtContent.Rows[0][3]); // pathology.acute1 = Convert.ToInt32(dtContent.Rows[0][4]); // pathology.atrophy1 = Convert.ToInt32(dtContent.Rows[0][5]); // pathology.intestinal1 = Convert.ToInt32(dtContent.Rows[0][6]); // pathology.dysplasia1 = Convert.ToInt32(dtContent.Rows[0][7]); // pathology.lymphoid1 = Convert.ToInt32(dtContent.Rows[0][8]); // pathology.pitepithelial1 = Convert.ToInt32(dtContent.Rows[0][9]); // pathology.Mucosal1 = Convert.ToInt32(dtContent.Rows[0][10]); //} //else //{ // pathology.id1 = 0; //} //if (dt.Rows[2][0] != DBNull.Value) //{ // pathology.id2 = Convert.ToInt32(dt.Rows[2][0]); // DataTable dtContent2 = GetContent(pathology.id2); // pathology.parts2 = Convert.ToString(dtContent2.Rows[0][2]); // pathology.chronic2 = Convert.ToInt32(dtContent2.Rows[0][3]); // pathology.acute2 = Convert.ToInt32(dtContent2.Rows[0][4]); // pathology.atrophy2 = Convert.ToInt32(dtContent2.Rows[0][5]); // pathology.intestinal2 = Convert.ToInt32(dtContent2.Rows[0][6]); // pathology.dysplasia2 = Convert.ToInt32(dtContent2.Rows[0][7]); // pathology.lymphoid2 = Convert.ToInt32(dtContent2.Rows[0][8]); // pathology.pitepithelial2 = Convert.ToInt32(dtContent2.Rows[0][9]); // pathology.Mucosal2 = Convert.ToInt32(dtContent2.Rows[0][10]); //} //else //{ // pathology.id2 = 0; //} //if (dt.Rows[3][0] != DBNull.Value) //{ // pathology.id3 = Convert.ToInt32(dt.Rows[3][0]); // DataTable dtContent = GetContent(pathology.id3); // pathology.parts3 = Convert.ToString(dtContent.Rows[0][2]); // pathology.chronic3 = Convert.ToInt32(dtContent.Rows[0][3]); // pathology.acute3 = Convert.ToInt32(dtContent.Rows[0][4]); // pathology.atrophy3 = Convert.ToInt32(dtContent.Rows[0][5]); // pathology.intestinal3 = Convert.ToInt32(dtContent.Rows[0][6]); // pathology.dysplasia3 = Convert.ToInt32(dtContent.Rows[0][7]); // pathology.lymphoid3 = Convert.ToInt32(dtContent.Rows[0][8]); // pathology.pitepithelial3 = Convert.ToInt32(dtContent.Rows[0][9]); // pathology.Mucosal3 = Convert.ToInt32(dtContent.Rows[0][10]); //} //else //{ // pathology.id3 = 0; //} //if (dt.Rows[4][0] != DBNull.Value) //{ // pathology.id4 = Convert.ToInt32(dt.Rows[4][0]); // DataTable dtContent = GetContent(pathology.id4); // pathology.parts4 = Convert.ToString(dtContent.Rows[0][2]); // pathology.chronic4 = Convert.ToInt32(dtContent.Rows[0][3]); // pathology.acute4 = Convert.ToInt32(dtContent.Rows[0][4]); // pathology.atrophy4 = Convert.ToInt32(dtContent.Rows[0][5]); // pathology.intestinal4 = Convert.ToInt32(dtContent.Rows[0][6]); // pathology.dysplasia4 = Convert.ToInt32(dtContent.Rows[0][7]); // pathology.lymphoid4 = Convert.ToInt32(dtContent.Rows[0][8]); // pathology.pitepithelial4 = Convert.ToInt32(dtContent.Rows[0][9]); // pathology.Mucosal4 = Convert.ToInt32(dtContent.Rows[0][10]); //} //else //{ // pathology.id4 = 0; //} return(View(pathology)); }
/// <summary> /// Edit the information of a pathology. /// </summary> /// <param name="pathology">Pathology to edit.</param> public void UpdatePathology(Pathology pathology) { // nothing }
protected void PopulateRowValues(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { // get procedure Procedure procedure = e.Item.DataItem as Procedure; // key controls HiddenField procIdField = e.Item.FindControl("ProcedureId") as HiddenField; HiddenField pathIdField = e.Item.FindControl("PathologyId") as HiddenField; // static controls Control clearBtn = e.Item.FindControl("ClearBtn"); Control lockImg = e.Item.FindControl("LockImage"); clearBtn.Visible = false; lockImg.Visible = false; // validate real row if (procedure.PrimaryKeyHasValue) { int procedureId = (int)procedure[Procedure.ProcedureId]; CICHelper.SetFieldValues(e.Item.Controls, procedure); procIdField.Value = procedureId + ""; // 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 } }).FirstOrDefault(); if (pathology != null && pathology.PrimaryKeyHasValue) { // populate pathology int pathologyId = (int)pathology[Pathology.PathologyId]; CICHelper.SetFieldValues(e.Item.Controls, pathology); pathIdField.Value = pathologyId + ""; // populate path BiopsyProstatePathology biopsyPath = BusinessObject.GetByParent <BiopsyProstatePathology>(pathologyId).FirstOrDefault(); if (biopsyPath != null && biopsyPath.PrimaryKeyHasValue) { CICHelper.SetFieldValues(e.Item.Controls, biopsyPath); } } // no path: hide else { e.Item.Visible = false; } } // blank row else { clearBtn.Visible = true; } // set script CaisisTextBox gg1 = e.Item.FindControl("PathGG1") as CaisisTextBox; CaisisTextBox gg2 = e.Item.FindControl("PathGG2") as CaisisTextBox; CaisisTextBox ggs = e.Item.FindControl("PathGGS") as CaisisTextBox; string script = string.Format("calculateBxResult('{0}', '{1}', '{2}');", gg1.ClientID, gg2.ClientID, ggs.ClientID); gg1.Attributes["onchange"] = script; gg2.Attributes["onchange"] = script; } }