private SpecimenEvents UpdateSequencingEvent(int specimenId, string status, DateTime?statusDate, string statusResult) { SpecimenEvents sequenceEvent = GetSequencingEvent(specimenId); if (sequenceEvent == null) { sequenceEvent = new SpecimenEvents(); sequenceEvent[SpecimenEvents.SpecimenId] = specimenId; sequenceEvent[SpecimenEvents.EventType] = status; } if (statusDate.HasValue) { sequenceEvent[SpecimenEvents.EventDate] = statusDate.Value; sequenceEvent[SpecimenEvents.EventDateText] = statusDate.Value.ToShortDateString(); } else { sequenceEvent[SpecimenEvents.EventDate] = null; sequenceEvent[SpecimenEvents.EventDateText] = null; } sequenceEvent[SpecimenEvents.EventResult] = statusResult; sequenceEvent.Save(); return(sequenceEvent); }
private void DeleteSequencingEvent(int specimenId) { SpecimenEvents sequenceEvent = GetSequencingEvent(specimenId); if (sequenceEvent != null) { sequenceEvent.Delete((int)sequenceEvent[sequenceEvent.PrimaryKeyName]); } }
protected void HandleRowDeleting(object sender, GridViewDeleteEventArgs e) { object key = (sender as GridView).DataKeys[e.RowIndex][SpecimenEvents.SpecimenEventId]; if (key != null && key.ToString() != "") { int priKey = int.Parse(key.ToString()); SpecimenEvents biz = new SpecimenEvents(); biz.Delete(priKey); BindSpecimenEventsGrid(); Page.Response.Redirect(Page.Request.Url.ToString(), true); } }
/// <summary> /// Updates/Saves a row in the Grid /// </summary> /// <param name="sender"></param> /// <param name="args"></param> protected void HandleRowUpdating(object sender, GridViewUpdateEventArgs args) { // Occurs when no real data/rows present in Grid // NOTE: Footer control is null in this case, as grid has no real data if (args.RowIndex < 0 && SpecimenEventsGridView.FooterRow == null) { CaisisGridView.ExtractCaisisInputValuesFromContainer(SpecimenEventsGridView, args.NewValues); } // Occurs when adding a record to a grid with data, values are in footer row else if (args.RowIndex < 0 && SpecimenEventsGridView.FooterRow != null) { CaisisGridView.ExtractCaisisInputValuesFromContainer(SpecimenEventsGridView.FooterRow, args.NewValues); } // Occurs when a row of real data is updating else { CaisisGridView.ExtractCaisisInputValuesFromContainer(SpecimenEventsGridView.Rows[args.RowIndex], args.NewValues); } // Create Biz Object SpecimenEvents biz = new SpecimenEvents(); // If record exits (row of data/not footer) if (args.NewValues.Contains(SpecimenEvents.SpecimenEventId)) { int priKey = int.Parse(args.NewValues[SpecimenEvents.SpecimenEventId].ToString()); biz.Get(priKey); } // Footer Row, insert specimenid else { biz[SpecimenEvents.SpecimenId] = CurrentSpecimen[Specimen.SpecimenId]; } // Set biz values foreach (string field in args.NewValues.Keys) { biz[field] = args.NewValues[field]; } // Save/Update biz.Save(); // Rebind grid to show saved data BindSpecimenEventsGrid(); Page.Response.Redirect(Page.Request.Url.ToString(), true); }
private void PopulateSpecimenDetailsRow(Control row, int specimenId) { // Core HiddenField SpecimenNumField = row.FindControl("SpecimenNumField") as HiddenField; HiddenField SpecimenSubTypeField = row.FindControl("SpecimenSubTypeField") as HiddenField; CaisisTextBox StatusDate = row.FindControl("StatusDate") as CaisisTextBox; // Sequencing CaisisSelect Sequencing_Failed_Reason = row.FindControl("Sequencing_Failed_Reason") as CaisisSelect; CaisisRadioButtonList Extraction_Radio = row.FindControl("Extraction_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Library_Radio = row.FindControl("Library_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Sequenced_Radio = row.FindControl("Sequenced_Radio") as CaisisRadioButtonList; // Analysis CaisisRadioButtonList Analysis_Radio = row.FindControl("Analysis_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Pathology_Radio = row.FindControl("Pathology_Radio") as CaisisRadioButtonList; // Pathology CaisisSelect Analysis_Failed_Reason = row.FindControl("Analysis_Failed_Reason") as CaisisSelect; CaisisComboBox SpecimenConditionNotes = row.FindControl("SpecimenConditionNotes") as CaisisComboBox; Specimen specimen = new Specimen(); specimen.Get(specimenId); string num = specimen[BOL.Specimen.SpecimenReferenceNumber].ToString(); string status = specimen[BOL.Specimen.SpecimenStatus].ToString(); string notes = specimen[BOL.Specimen.SpecimenNotes].ToString(); SpecimenNumField.Value = num; SpecimenSubTypeField.Value = specimen[BOL.Specimen.SpecimenSubType].ToString(); SpecimenEvents specimenEvent = GetSequencingEvent(specimenId); // applies to all if (specimenEvent != null) { StatusDate.Value = string.Format("{0:d}", specimenEvent[SpecimenEvents.EventDate]); } // set relevant radios if (InventoryMode == SpecimenInventoryMode.Sequencing) { switch (status) { case "Tissue Extraction Successful": Extraction_Radio.Value = ANSWER_YES; break; case "Tissue Extraction Unsuccessful": Extraction_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; case "Library Construction Successful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; break; case "Library Construction Unsuccessful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; case "Sequenced": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; Sequenced_Radio.Value = ANSWER_YES; break; case "Sequencing Unsuccessful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; Sequenced_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; default: Extraction_Radio.ClearSelection(); Library_Radio.ClearSelection(); Sequenced_Radio.ClearSelection(); break; } } else if (InventoryMode == SpecimenInventoryMode.Analysis) { switch (status) { case "Analysis Complete": Analysis_Radio.Value = ANSWER_YES; break; case "Analysis Unsuccessul": Analysis_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Analysis_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; default: Analysis_Radio.ClearSelection(); break; } } else if (InventoryMode == SpecimenInventoryMode.Pathology) { switch (status) { case "Pathology Review Completed": Pathology_Radio.Value = ANSWER_YES; break; case "Banked by Pathology": Pathology_Radio.Value = ANSWER_NO; break; default: Pathology_Radio.ClearSelection(); break; } // build condition list, fill into notes field DataTable conditions = new DataTable(); conditions.Columns.Add("Condition"); string foundCondition = ""; foreach (string condition in specimenController.GetConditions()) { // find selected if (specimenController.GetSpecimenCondition(notes) == condition) { foundCondition = condition; } // add data conditions.Rows.Add(new object[] { condition }); } SpecimenConditionNotes.BuildComboData(conditions, "Condition", "Condition"); SpecimenConditionNotes.Value = notes; } }