public int UpdateSpecimenCondition(int specimenId, string condition) { Specimen biz = new Specimen(); biz.Get(specimenId); string notes = biz[Specimen.SpecimenNotes].ToString(); if (!string.IsNullOrEmpty(condition) && GetSpecimenCondition(notes) != condition) { string updatedNotes = notes; bool found = false; foreach (string conditionValue in conditions) { if (updatedNotes.Contains(conditionValue)) { updatedNotes = updatedNotes.Replace(conditionValue, condition); found = true; break; } } if (found == false) { updatedNotes = updatedNotes + (updatedNotes == "" ? "" : " ") + condition; } if (notes != updatedNotes) { biz[Specimen.SpecimenNotes] = updatedNotes; biz.Save(); } } return((int)biz[Specimen.SpecimenId]); }
//used to update specimen status on deleting collection private void UpdateSpecimenStatus(int specId, string status) { Specimen bizSpec = new Specimen(); bizSpec.Get(specId); bizSpec[Specimen.SpecimenStatus] = status; bizSpec.Save(); }
/// <summary> /// Foreach specimen id, update specimen record with new status /// </summary> /// <param name="specimens"></param> /// <param name="status"></param> private void UpdateSpecimenStatus(IEnumerable <int> specimens, string status) { foreach (int specimenId in specimens) { Specimen biz = new Specimen(); biz.Get(specimenId); biz[Specimen.SpecimenStatus] = status; biz.Save(); } }
protected void UpdateSpecimens(object sender, EventArgs e) { foreach (GridViewRow dirtyRow in SpecimenInventory.DirtyGridRows) { var keys = SpecimenInventory.DataKeys[dirtyRow.RowIndex]; int specimenAccessionId = (int)keys[Specimen.SpecimenAccessionId]; int specimenId = (int)keys[Specimen.SpecimenId]; Specimen specimen = new Specimen(); specimen.Get(specimenId); CICHelper.SetBOValues(dirtyRow.Controls, specimen, specimenAccessionId); specimen.Save(); } }
/// <summary> /// Special logic for removing specimen and rolling back the status /// </summary> /// <param name="specimenCollectionId"></param> private void RemoveSpecimenFromCollection(int specimenCollectionId) { Specimen_SpecimenCollections biz = new Specimen_SpecimenCollections(); biz.Get(specimenCollectionId); if (!biz.IsEmpty) { int specimenId = (int)biz[Specimen_SpecimenCollections.SpecimenId]; Specimen specimen = new Specimen(); specimen.Get(specimenId); string currentStatus = specimen[Specimen.SpecimenStatus].ToString(); string rollbackStatus = ""; switch (currentStatus) { case "In Transit to Pathology": rollbackStatus = "Collected"; break; case "In Transit to Sequencing": rollbackStatus = "Pathology Review Completed"; break; case "In Transit to Analysis": rollbackStatus = "Sequenced"; break; case "In Transit to cBIO Portal": rollbackStatus = "Analysis Complete"; break; default: break; } // rollback status if (!string.IsNullOrEmpty(currentStatus) && !string.IsNullOrEmpty(rollbackStatus)) { specimen[Specimen.SpecimenStatus] = rollbackStatus; specimen.Save(); } biz.Delete(specimenCollectionId); } }
protected void UpdateSpecimenLocation() { Response.ContentType = "text/html"; int collectionId = int.Parse(Request.Form["collectionId"]); int srcBoxId = int.Parse(Request.Form["srcBoxId"]); int srcPos = int.Parse(Request.Form["srcPosition"]); int destBoxId = int.Parse(Request.Form["destBoxId"]); int destPos = int.Parse(Request.Form["destPosition"]); SpecimenManagerDa da = new SpecimenManagerDa(); DataTable tmp = da.GetSpecimensByBoxId(srcBoxId, collectionId); // Trace back to specimen record DataRow[] rows = tmp.Select(SpecimenPosition.Position + " = '" + srcPos + "'"); if (rows.Length > 0) { DataRow row = rows[0]; SpecimenPosition specPosBiz = new SpecimenPosition(); int positionId = int.Parse(row[Specimen.PositionId].ToString()); specPosBiz.Get(positionId); specPosBiz[SpecimenPosition.BoxId] = destBoxId; specPosBiz[SpecimenPosition.Position] = destPos; specPosBiz.Save(); Specimen specBiz = new Specimen(); int specimenId = int.Parse(row[Specimen.SpecimenId].ToString()); specBiz.Get(specimenId); specBiz[Specimen.BoxId] = destBoxId; specBiz.Save(); Response.Write("true"); Response.End(); } Response.Write("false"); Response.End(); }
private void UpdateSpecimenDetailsRow(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; // shared variables string status = ""; DateTime?statusDate = null; if (!string.IsNullOrEmpty(StatusDate.Value)) { statusDate = DateTime.Parse(StatusDate.Value); } if (InventoryMode == SpecimenInventoryMode.Sequencing) { string failedReason = Sequencing_Failed_Reason.Value; string statusResult = ""; // determine new status, top down if (Extraction_Radio.Value == ANSWER_NO) { status = "Tissue Extraction Unsuccessful"; statusResult = failedReason; } else if (Extraction_Radio.Value == ANSWER_YES) { if (Library_Radio.Value == ANSWER_NO) { status = "Library Construction Unsuccessful"; statusResult = failedReason; } else if (Library_Radio.Value == ANSWER_YES) { if (Sequenced_Radio.Value == ANSWER_NO) { status = "Sequencing Unsuccessful"; statusResult = failedReason; } else if (Sequenced_Radio.Value == ANSWER_YES) { status = "Sequenced"; } else { status = "Library Construction Successful"; } } else { status = "Tissue Extraction Successful"; } } // update event if (!string.IsNullOrEmpty(status) || statusDate.HasValue || !string.IsNullOrEmpty(statusResult)) { UpdateSequencingEvent(specimenId, status, statusDate, statusResult); } } else if (InventoryMode == SpecimenInventoryMode.Pathology) { if (Pathology_Radio.Value == ANSWER_YES) { status = "Pathology Review Completed"; } else if (Analysis_Radio.Value == ANSWER_NO) { status = "Banked by Pathology"; } // update event if (!string.IsNullOrEmpty(status) || statusDate.HasValue) { UpdateSequencingEvent(specimenId, status, statusDate, ""); } } else if (InventoryMode == SpecimenInventoryMode.Analysis) { string failedReason = Analysis_Failed_Reason.Value; if (Analysis_Radio.Value == ANSWER_YES) { status = "Analysis Complete"; // on successful analysis, update event UpdateSequencingEvent(specimenId, status, statusDate, ""); } else if (Analysis_Radio.Value == ANSWER_NO) { status = "Analysis Unsuccessul"; UpdateSequencingEvent(specimenId, status, statusDate, failedReason); } } // update specimen status if (!string.IsNullOrEmpty(status)) { Specimen specimen = new Specimen(); specimen.Get(specimenId); specimen[Specimen.SpecimenStatus] = status; // special case if (InventoryMode == SpecimenInventoryMode.Pathology) { specimen[Specimen.SpecimenNotes] = SpecimenConditionNotes.Value; } specimen.Save(); } }
protected void SaveBtn_Click(object sender, ImageClickEventArgs e) { CurrentSpecimen = new Specimen(); CurrentSpecimen.Get(specimenId); Specimen subspecimen = new Specimen(); CICHelper.SetBOValues(inputControlsRow.Controls, subspecimen, specimenId); subspecimen[Specimen.SpecimenAccessionId] = CurrentSpecimen[Specimen.SpecimenAccessionId]; subspecimen[Specimen.ParentSpecimenId] = CurrentSpecimen[Specimen.SpecimenId]; subspecimen[Specimen.EnteredTime] = DateTime.Now; subspecimen[Specimen.EnteredBy] = new Caisis.Security.SecurityController().GetUserName(); if (!string.IsNullOrEmpty(BoxId.Value)) { int boxId = int.Parse(BoxId.Value); if (!string.IsNullOrEmpty(PositionName.Value)) { if (!string.IsNullOrEmpty(this.PositionId.Value)) { int posId = int.Parse(this.PositionId.Value); pos.Get(posId); } pos[SpecimenPosition.BoxId] = this.BoxId.Value; pos[SpecimenPosition.Position] = this.PositionName.Value; pos[SpecimenPosition.PositionStatus] = "Filled"; pos.Save(); // Update specimens table with boxid and positionids subspecimen[Specimen.PositionId] = pos[SpecimenPosition.PositionId].ToString(); subspecimen[Specimen.BoxId] = pos[SpecimenPosition.BoxId].ToString(); } else { string currentPosId = subspecimen[Specimen.PositionId].ToString(); if (!string.IsNullOrEmpty(currentPosId)) { subspecimen[Specimen.BoxId] = boxId; subspecimen[Specimen.PositionId] = string.Empty; pos.Delete(int.Parse(currentPosId)); } else { subspecimen[Specimen.BoxId] = boxId; subspecimen[Specimen.PositionId] = string.Empty; } } } //calculating parent Rem qty based on child Org qty //string specimenRemQty = CurrentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //if (!string.IsNullOrEmpty(specimenRemQty)) //{ // specimenRemQty = CurrentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //} //else //{ // specimenRemQty = CurrentSpecimen[Specimen.SpecimenOriginalQty].ToString(); //} //string subspecOrgQty = this.SpecimenOriginalQty.Value; //string specimenUnits = CurrentSpecimen[Specimen.SpecimenUnits].ToString(); //string subspecUnits = this.SpecimenUnits.Value; //int specRemQty; //if (!string.IsNullOrEmpty(subspecOrgQty)) //{ // if (Int32.Parse(subspecOrgQty) <= Int32.Parse(specimenRemQty)) // { // specRemQty = Int32.Parse(specimenRemQty) - Int32.Parse(subspecOrgQty); // CurrentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; // } //} //else //{ // specRemQty = Int32.Parse(specimenRemQty) - 0; // CurrentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; //} CurrentSpecimen.Save(); //if user didn't enter rem qty, then it is same as org qty if (!string.IsNullOrEmpty(SpecimenRemainingQty.Text)) { subspecimen[Specimen.SpecimenRemainingQty] = SpecimenRemainingQty.Text; } else { subspecimen[Specimen.SpecimenRemainingQty] = SpecimenOriginalQty.Text; } subspecimen.Save(); //Refreshing parent page string specId = subspecimen[Specimen.SpecimenId].ToString(); string parentspecId = subspecimen[Specimen.ParentSpecimenId].ToString(); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "RefreshParentwindow", "refreshParent('" + specId + "','" + parentspecId + "');", true); }
protected void UpdateBtn_Click(object sender, ImageClickEventArgs e) { CurrentSpecimen = new Specimen(); CurrentSpecimen.Get(this.specimenId); if (!string.IsNullOrEmpty(BoxId.Value)) { int boxId = int.Parse(BoxId.Value); // checks for Position & set values in Specimen Position Table if (!string.IsNullOrEmpty(PositionName.Value)) { if (!string.IsNullOrEmpty(this.PositionId.Value)) { // Load Position Record int posId = int.Parse(this.PositionId.Value); pos.Get(posId); } pos[SpecimenPosition.BoxId] = this.BoxId.Value; pos[SpecimenPosition.Position] = this.PositionName.Value; pos[SpecimenPosition.PositionStatus] = "Filled"; pos.Save(); // Update specimens table with boxid and position ids CurrentSpecimen[Specimen.PositionId] = pos[SpecimenPosition.PositionId].ToString(); CurrentSpecimen[Specimen.BoxId] = pos[SpecimenPosition.BoxId].ToString(); } else { string currentPosId = CurrentSpecimen[Specimen.PositionId].ToString(); // Checks for PositionId if already exists // then remove from SpecimenPositions, since a box is choosen instead of a position if (!string.IsNullOrEmpty(currentPosId)) { CurrentSpecimen[Specimen.BoxId] = boxId; CurrentSpecimen[Specimen.PositionId] = string.Empty; pos.Delete(int.Parse(currentPosId)); } else { CurrentSpecimen[Specimen.BoxId] = boxId; CurrentSpecimen[Specimen.PositionId] = string.Empty; } } } CurrentSpecimen[Specimen.SpecimenNotes] = this.SpecimenNotes.Value; CurrentSpecimen[Specimen.SpecimenOriginalQty] = this.SpecimenOriginalQty.Value; CurrentSpecimen[Specimen.SpecimenRemainingQty] = this.SpecimenRemainingQty.Value; CurrentSpecimen[Specimen.SpecimenPreservationType] = this.SpecimenPreservationType.Value; CurrentSpecimen[Specimen.SpecimenReferenceNumber] = this.SpecimenReferenceNumber.Value; CurrentSpecimen[Specimen.SpecimenStatus] = this.SpecimenStatus.Value; CurrentSpecimen[Specimen.ContactId] = this.Contact.Value; CurrentSpecimen[Specimen.SpecimenSubType] = this.SpecimenSubType.Value; CurrentSpecimen[Specimen.SpecimenType] = this.SpecimenType.Value; CurrentSpecimen[Specimen.SpecimenUnits] = this.SpecimenUnits.Value; string specId = CurrentSpecimen[Specimen.SpecimenId].ToString(); string parentspecId = CurrentSpecimen[Specimen.ParentSpecimenId].ToString(); //calculating parent Rem qty based on child Qty if (!string.IsNullOrEmpty(parentspecId)) { Specimen ParentSpecimen = new Specimen(); ParentSpecimen.Get(Int32.Parse(parentspecId.ToString())); string PparentspecId = ParentSpecimen[Specimen.ParentSpecimenId].ToString(); //string specimenRemQty = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //if (!string.IsNullOrEmpty(specimenRemQty)) //{ // specimenRemQty = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //} //else //{ // specimenRemQty = ParentSpecimen[Specimen.SpecimenOriginalQty].ToString(); //} //string subspecOrgQty = this.SpecimenOriginalQty.Value; //int specRemQty; //if (!string.IsNullOrEmpty(subspecOrgQty)) //{ // if (Int32.Parse(subspecOrgQty) <= Int32.Parse(specimenRemQty)) // { // specRemQty = Int32.Parse(specimenRemQty) - Int32.Parse(subspecOrgQty); // ParentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; // } //} //else //{ // specRemQty = Int32.Parse(specimenRemQty) - 0; // ParentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; //} CurrentSpecimen.Save(); ParentSpecimen.Save(); } else { CurrentSpecimen.Save(); } //Refreshing specimens hierarchy frame of Parent page Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "RefreshParentwindow", "refreshParentwindow();", true); }
protected void btn_Save_Click(object sender, EventArgs e) { try { if (grdBookDetails.Rows.Count == 0) { MessageBox("Kindly fill Book details"); } else { Specimen _objSepciman = new Specimen(); // _objSepciman.DocumentNo = Convert.ToInt32(txtdoc.Text.Trim()); string DocumentDate = txtdocDate.Text.Split('/')[1] + "/" + txtdocDate.Text.Split('/')[0] + "/" + txtdocDate.Text.Split('/')[2]; string ChallanDate = txtChalDate.Text.Split('/')[1] + "/" + txtChalDate.Text.Split('/')[0] + "/" + txtChalDate.Text.Split('/')[2]; string OrderDate = txtOrdDate.Text.Split('/')[1] + "/" + txtOrdDate.Text.Split('/')[0] + "/" + txtOrdDate.Text.Split('/')[2]; if (txtdoc.Text != "") { _objSepciman.DocumentNo = Convert.ToInt32(txtdoc.Text.Trim()); } _objSepciman.DocumentDate = Convert.ToDateTime(DocumentDate); _objSepciman.ChallanNo = txtchalan.Text.Trim(); _objSepciman.ChallanDate = Convert.ToDateTime(ChallanDate); // string ordno = txtorder.Text.Trim(); //if (ordno == "") //{ // ordno = "0"; //} _objSepciman.OrderNo = txtorder.Text.Trim(); _objSepciman.OrderDate = Convert.ToDateTime(OrderDate); _objSepciman.SalesmanCode = txtsalemanCode.Text.Trim(); _objSepciman.SpInstruction = txtspInstruct.Text.Trim(); _objSepciman.IsActive = true; _objSepciman.IsDeleted = false; _objSepciman.CreatedBy = Convert.ToString(Session["UserName"]);; _objSepciman.Description = Description; _objSepciman.FinancialYearFrom = Convert.ToInt32(strFY); _objSepciman.Save(out DocNo, 1, out DocNewNo); // _objSepciman.Save(out DocNo); txtdoc.Text = Convert.ToString(DocNo); SaveSpecimanDetails(DocNo); Other_Z.OtherBAL objBal = new Other_Z.OtherBAL(); if (DDLSelectSet.SelectedValue != "0") { objBal.SaveSalesmnBookSetLimit(xmlstr, txtsalemanCode.Text, Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), "Updatebookset", ""); } MessageBox("Record saved successfully \\r\\n Documennt no. " + txtdoc.Text); lblmsg.Text = "Last saved Document no. : " + txtdoc.Text; txtdoc.Text = ""; txtchalan.Text = ""; txtorder.Text = ""; txtsalemanCode.Text = ""; lblSalesManName.Text = ""; txtorder.Focus(); Session["tempBookData"] = null; grdBookDetails.DataSource = null; grdBookDetails.DataBind(); upGridData.Update(); DDLSelectSet.SelectedValue = "0"; Description = ""; } } catch (Exception ex) { string ermsg = ex.Message.ToString(); } }
protected void Update_Click(object sender, CommandEventArgs e) { SpecimenPosition pos = new SpecimenPosition(); if (!string.IsNullOrEmpty(BoxId.Value)) { int boxId = int.Parse(BoxId.Value); // checks for Position & set values in Specimen Position Table if (!string.IsNullOrEmpty(PositionName.Value)) { if (!string.IsNullOrEmpty(this.PositionId.Value)) { // Load Position Record int posId = int.Parse(this.PositionId.Value); pos.Get(posId); } pos[SpecimenPosition.BoxId] = this.BoxId.Value; pos[SpecimenPosition.Position] = this.PositionName.Value; pos[SpecimenPosition.PositionStatus] = "Filled"; pos.Save(); // Update specimens table with boxid and position ids CurrentSpecimen[Specimen.PositionId] = pos[SpecimenPosition.PositionId].ToString(); CurrentSpecimen[Specimen.BoxId] = pos[SpecimenPosition.BoxId].ToString(); } else { string currentPosId = CurrentSpecimen[Specimen.PositionId].ToString(); // Checks for PositionId if already exists // then remove from SpecimenPositions, since a box is choosen instead of a position if (!string.IsNullOrEmpty(currentPosId)) { CurrentSpecimen[Specimen.BoxId] = boxId; CurrentSpecimen[Specimen.PositionId] = string.Empty; pos.Delete(int.Parse(currentPosId)); } else { CurrentSpecimen[Specimen.BoxId] = boxId; CurrentSpecimen[Specimen.PositionId] = string.Empty; } } } CurrentSpecimen[Specimen.SpecimenNotes] = this.SpecimenNotes.Value; CurrentSpecimen[Specimen.SpecimenOriginalQty] = this.SpecimenOriginalQty.Value; CurrentSpecimen[Specimen.SpecimenRemainingQty] = this.SpecimenRemainingQty.Value; CurrentSpecimen[Specimen.SpecimenPreservationType] = this.SpecimenPreservationType.Value; CurrentSpecimen[Specimen.SpecimenReferenceNumber] = this.SpecimenReferenceNumber.Value; CurrentSpecimen[Specimen.SpecimenStatus] = this.SpecimenStatus.Value; CurrentSpecimen[Specimen.ContactId] = this.Contact.Value; CurrentSpecimen[Specimen.SpecimenSubType] = this.SpecimenSubType.Value; CurrentSpecimen[Specimen.SpecimenType] = this.SpecimenType.Value; CurrentSpecimen[Specimen.SpecimenUnits] = this.SpecimenUnits.Value; CurrentSpecimen.Save(); string specId = CurrentSpecimen[Specimen.SpecimenId].ToString(); string parentspecId = CurrentSpecimen[Specimen.ParentSpecimenId].ToString(); //calculating parent specimen RemQty on updating sub-specimen OrgQty //if (!string.IsNullOrEmpty(parentspecId)) //{ // Specimen ParentSpecimen = new Specimen(); // ParentSpecimen.Get(Int32.Parse(parentspecId.ToString())); // string PparentspecId = ParentSpecimen[Specimen.ParentSpecimenId].ToString(); // string specimenRemQty = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); // if (!string.IsNullOrEmpty(specimenRemQty)) // { // specimenRemQty = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); // } // else // { // specimenRemQty = ParentSpecimen[Specimen.SpecimenOriginalQty].ToString(); // } // string subspecOrgQty = this.SpecimenOriginalQty.Value; // int specRemQty; // if (!string.IsNullOrEmpty(subspecOrgQty)) // { // if (Int32.Parse(subspecOrgQty) <= Int32.Parse(specimenRemQty)) // { // specRemQty = Int32.Parse(specimenRemQty) - Int32.Parse(subspecOrgQty); // ParentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; // } // } // else // { // specRemQty = Int32.Parse(specimenRemQty) - 0; // ParentSpecimen[Specimen.SpecimenRemainingQty] = specRemQty; // } // ParentSpecimen.Save(); //} SetRefreshClientBlock(); }