//private void ListUnboxedSpecimens(int colId) //{ // SpecimenManagerDa da = new SpecimenManagerDa(); // DataTable dt = da.GetUnboxedSpecimensByCollectionId(colId); // this.unboxedSpecList.DataSource = dt.DefaultView; // this.unboxedSpecList.DataBind(); //} private void BindOriginSelectBoxes() { if (QueryBoxId > 0) { SpecimenManagerDa da = new SpecimenManagerDa(); DataSet resultsDataSet = da.GetBoxAndAncestors(QueryBoxId); SpecimenBox box = new SpecimenBox(); box.Get(QueryBoxId); DataTable boxesDT = resultsDataSet.Tables[0]; Boxes.DataSource = boxesDT; Boxes.DataBind(); Boxes.Value = box[SpecimenBox.BoxId].ToString(); DataTable containersDT = resultsDataSet.Tables[1]; Containers.DataSource = containersDT; Containers.DataBind(); Containers.Value = boxesDT.Rows[0][SpecimenBox.ContainerId].ToString(); DataTable storagesDT = resultsDataSet.Tables[2]; Storages.DataSource = storagesDT; Storages.DataBind(); Storages.Value = containersDT.Rows[0][SpecimenContainer.StorageId].ToString(); string siteId = resultsDataSet.Tables[3].Rows[0][SpecimenSite.SiteId].ToString(); Sites.Value = siteId; } }
protected void MoveBoxToNewContainer() { int boxId = int.Parse(Request.Form["boxId"]); int newContainerId = int.Parse(Request.Form["newContainerId"]); SpecimenBox box = new SpecimenBox(); box.Get(boxId); box[SpecimenBox.ContainerId] = newContainerId; box.Save(); }
protected void Delete_Click(object sender, CommandEventArgs e) { ReloadSpecimenStorageManager(this._boxId, true); // set BoxId and PositionId in Specimens to NULL for the deleting Box SpecimenManagerDa da = new SpecimenManagerDa(); da.DeleteBoxReferenceFromSpecimens(this._boxId); SpecimenBox box = new SpecimenBox(); box.Delete(this._boxId); CloseThisPage(); }
override protected void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); _containerId = Convert.ToInt32(Request.QueryString["containerId"]); //Checks for BoxId is NULL or not if (string.IsNullOrEmpty(BoxId.Value)) { if (!string.IsNullOrEmpty(Request.QueryString["boxId"])) { BoxId.Value = Request.QueryString["boxId"]; _boxId = int.Parse(BoxId.Value); LoadBoxInfo(); SpecimenBox box = new SpecimenBox(); box.Get(_boxId); string boxType = box["BoxType"].ToString(); if (boxType == "Unstructured") { RegisterFilledSpecimensArray(_boxId); SpecimensList.Style.Add("display", "block"); BoxMatrix.Style.Add("display", "none"); cellclk.Text = "Click on Reference #s in adjacent Box to show Specimen details"; } else { RegisterFilledPositionsArray(_boxId); SpecimensList.Style.Add("display", "none"); cellclk.Text = "Click on adjacent Box cells to show Specimen details"; } ReloadSpecimenStorageManager(_boxId, false); } } else { _boxId = int.Parse(BoxId.Value); } }
protected void Save_Click(object sender, CommandEventArgs e) { bool isNewRecord = this._containerId == 0 ? false : true; SpecimenBox box = new SpecimenBox(); box.Get(this._boxId); CICHelper.SetBOValues(Page.FindControl("inputControlsRow").Controls, box, 0); // set parent id for new record if (isNewRecord) { box[SpecimenBox.ContainerId] = _containerId; } box.Save(); //Gets BoxId & reloads _boxId = int.Parse(box[SpecimenBox.BoxId].ToString()); ReloadSpecimenStorageManager(_boxId, false); CloseThisPage(); }
private void LoadBoxInfo() { SpecimenBox box = new SpecimenBox(); box.Get(this._boxId); CICHelper.SetFieldValues(this.inputControlsRow.Controls, box); SpecimenContainer container = new SpecimenContainer(); container.Get(this._containerId); Caisis.BOL.SpecimenStorage storage = new Caisis.BOL.SpecimenStorage(); storage.Get(Int32.Parse(container[SpecimenContainer.StorageId].ToString())); SpecimenSite site = new SpecimenSite(); site.Get(Int32.Parse(storage[Caisis.BOL.SpecimenStorage.SiteId].ToString())); this.PageTitle.Text = site[SpecimenSite.SiteName].ToString() + " > " + storage[Caisis.BOL.SpecimenStorage.StorageName].ToString() + " > " + container[SpecimenContainer.ContainerName].ToString() + " > " + box[SpecimenBox.BoxName].ToString(); BoxName.Value = box[SpecimenBox.BoxName].ToString(); DataTable dt = da.GetSpecimensByBoxId(_boxId); //Disables editing of columns & rows if box contains specimens if (dt.Rows.Count == 0) { NoOfColumns.ReadOnly = false; NoOfRows.ReadOnly = false; } else { NoOfColumns.ReadOnly = true; NoOfRows.ReadOnly = true; NoOfColumns.ToolTip = "# of columns can not be changed with specimens in Box"; NoOfRows.ToolTip = "# of rows can not be changed with specimens in Box"; } }
protected void GetBoxMatrix() { string myBoxId = Request.Form["BoxId"]; int boxId; if (int.TryParse(myBoxId, out boxId)) { SpecimenBox box = new SpecimenBox(); box.Get(boxId); //SpecimenPosition pos = new SpecimenPosition(); //pos.GetByParent(boxId); //// Build a string array of position indexes //DataTable positionDataTable = pos.DataSourceView.Table; DataTable positionDataTable = BusinessObject.GetByParentAsDataView <SpecimenPosition>(boxId).Table; int positionIndexCount = positionDataTable.Rows.Count; string[] posIndexes = new string[positionIndexCount]; string posIndexStringArray = "["; for (int i = 0; i < positionIndexCount; i++) { object val = positionDataTable.Rows[i][SpecimenPosition.Position]; if (val != null) { int index; if (int.TryParse(val.ToString(), out index)) { posIndexStringArray += index + ","; } } } posIndexStringArray = posIndexStringArray.TrimEnd(",".ToCharArray()); posIndexStringArray += "]"; int rows = 20; if (box[SpecimenBox.NoOfRows] != null && !string.IsNullOrEmpty(box[SpecimenBox.NoOfRows].ToString())) { rows = int.Parse(box[SpecimenBox.NoOfRows].ToString()); } int cols = 20; if (box[SpecimenBox.NoOfColumns] != null && !string.IsNullOrEmpty(box[SpecimenBox.NoOfColumns].ToString())) { cols = int.Parse(box[SpecimenBox.NoOfColumns].ToString()); } string boxType = String.Empty; if (box[SpecimenBox.BoxType] != null && !string.IsNullOrEmpty(box[SpecimenBox.BoxType].ToString())) { boxType = box[SpecimenBox.BoxType].ToString(); } int maxPos = rows * cols; if (box[SpecimenBox.MaxPositionNo] != null && !string.IsNullOrEmpty(box[SpecimenBox.MaxPositionNo].ToString())) { maxPos = int.Parse(box[SpecimenBox.MaxPositionNo].ToString()); } // Check if calling for transfer SpecimenManagerDa da = new SpecimenManagerDa(); string transferPositionsArray = ""; if (!string.IsNullOrEmpty(Request.Form["getTransfers"]) && !string.IsNullOrEmpty(Request.Form["collectionId"])) { int collectionId = int.Parse(Request.Form["collectionId"]); DataTable specsInBoxDT = da.GetSpecimensByBoxId(boxId, collectionId); ArrayList oBoxTransferPosArr = new ArrayList(); foreach (DataRow dr in specsInBoxDT.Rows) { if (dr["Transferable"].ToString() == "yes") { oBoxTransferPosArr.Add(dr[SpecimenPosition.Position].ToString()); } } string oBoxTransferPos = String.Join(", ", (string[])oBoxTransferPosArr.ToArray(typeof(string))); transferPositionsArray = "[" + oBoxTransferPos + "]"; } string clientTransferArray = !string.IsNullOrEmpty(transferPositionsArray) ? ("," + transferPositionsArray) : string.Empty; //if (!string.IsNullOrEmpty(Request.Form["NeedPath"]) || true) //{ int specimensInBox = da.GetSpecimensInBox(boxId).Rows.Count; DataSet resultsDataSet = da.GetBoxAndAncestors(boxId); DataTable boxesDT = resultsDataSet.Tables[0]; string boxIdStr = boxId.ToString(); DataRow boxRow = boxesDT.Select(SpecimenBox.BoxId + "=" + boxIdStr)[0]; string boxName = PageUtil.EscapeSingleQuotes(boxRow[SpecimenBox.BoxName].ToString()); DataTable containersDT = resultsDataSet.Tables[1]; string containerIdStr = boxesDT.Rows[0][SpecimenBox.ContainerId].ToString(); DataRow containerRow = containersDT.Select(SpecimenContainer.ContainerId + " = " + containerIdStr)[0]; string containerName = PageUtil.EscapeSingleQuotes(containerRow[SpecimenContainer.ContainerName].ToString()); DataTable storagesDT = resultsDataSet.Tables[2]; string storagesIdStr = containersDT.Rows[0][SpecimenContainer.StorageId].ToString(); DataRow specimenRow = storagesDT.Select(SpecimenStorage.StorageId + " = " + storagesIdStr)[0]; string storageName = PageUtil.EscapeSingleQuotes(specimenRow[SpecimenStorage.StorageName].ToString()); DataTable siteDT = resultsDataSet.Tables[3]; string siteId = siteDT.Rows[0][SpecimenSite.SiteId].ToString(); DataRow siteRow = siteDT.Select(SpecimenSite.SiteId + " = " + siteId)[0]; string siteName = PageUtil.EscapeSingleQuotes(siteRow[SpecimenSite.SiteName].ToString()); BindDropDownList(StoragesDropDown, storagesDT, SpecimenStorage.StorageName, SpecimenStorage.StorageId, storagesIdStr); BindDropDownList(ContainersDropDown, containersDT, SpecimenContainer.ContainerName, SpecimenContainer.ContainerId, containerIdStr); BindDropDownList(BoxesDropDown, boxesDT, SpecimenBox.BoxName, SpecimenBox.BoxId, boxIdStr); SiteId.Text = siteId; //} string js = "new Array(" + rows + "," + cols + "," + maxPos + "," + posIndexStringArray + clientTransferArray + ",'" + siteName + "','" + storageName + "','" + containerName + "'," + specimensInBox + ",'" + boxName + "','" + boxType + "')"; BoxMatrix.Text = js; } }
private void LoadSpecimenInfo() { CurrentSpecimen = new Specimen(); CurrentSpecimen.Get(this.specimenId); string parentspecId = CurrentSpecimen[Specimen.ParentSpecimenId].ToString(); pspecId.Value = parentspecId.ToString(); //if (!string.IsNullOrEmpty(parentspecId)) //{ // Specimen ParentSpecimen = new Specimen(); // ParentSpecimen.Get(Int32.Parse(parentspecId.ToString())); // pRemQty.Value = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //} //RemQty.Value = CurrentSpecimen[Specimen.SpecimenRemainingQty].ToString(); CICHelper.SetFieldValues(this.inputControlsRow.Controls, CurrentSpecimen); //load box and position from SpecimenBoxes and SpecimenPositions tables string sBoxId = CurrentSpecimen[Specimen.BoxId].ToString(); if (!String.IsNullOrEmpty(sBoxId)) { int boxId = int.Parse(sBoxId); SpecimenBox box = new SpecimenBox(); box.Get(boxId); this.BoxId.Value = box[SpecimenBox.BoxId].ToString(); this.BoxName.Value = box[SpecimenBox.BoxName].ToString(); DataSet hierarchySet = da.GetBoxAndAncestors(boxId); DataTable boxesDT = hierarchySet.Tables[0]; DataTable containersDT = hierarchySet.Tables[1]; DataTable storagesDT = hierarchySet.Tables[2]; DataTable siteDT = hierarchySet.Tables[3]; if (boxesDT.Rows.Count >= 1) { string containerIdStr = boxesDT.Rows[0][SpecimenBox.ContainerId].ToString(); DataRow containerRow = containersDT.Select(SpecimenContainer.ContainerId + " = " + containerIdStr)[0]; this.ContainerName.Value = PageUtil.EscapeSingleQuotes(containerRow[SpecimenContainer.ContainerName].ToString()); } if (containersDT.Rows.Count >= 1) { string storagesIdStr = containersDT.Rows[0][Caisis.BOL.SpecimenContainer.StorageId].ToString(); DataRow specimenRow = storagesDT.Select(Caisis.BOL.SpecimenStorage.StorageId + " = " + storagesIdStr)[0]; this.StorageName.Value = PageUtil.EscapeSingleQuotes(specimenRow[Caisis.BOL.SpecimenStorage.StorageName].ToString()); } if (siteDT.Rows.Count >= 1) { string siteId = siteDT.Rows[0][SpecimenSite.SiteId].ToString(); DataRow siteRow = siteDT.Select(SpecimenSite.SiteId + " = " + siteId)[0]; this.SiteName.Value = PageUtil.EscapeSingleQuotes(siteRow[SpecimenSite.SiteName].ToString()); } } string sPositionId = CurrentSpecimen[Specimen.PositionId].ToString(); if (!String.IsNullOrEmpty(sPositionId)) { int positionId = int.Parse(sPositionId); pos.Get(positionId); this.PositionName.Value = pos[SpecimenPosition.Position].ToString(); this.PositionId.Value = pos[SpecimenPosition.PositionId].ToString(); } }
/// <summary> /// Creates controls for placing the Position and Box name in a grid. /// In addition, the rows positionid and boxid are tracked in the viewstate to trigger SpecimenPosition records updates/deletes. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LocateAndWireReferencedControls(object sender, EventArgs e) { if (specimensGrid != null) { List <ICaisisInputControl> tmpKeys = new List <ICaisisInputControl>(); string jsArray = ""; foreach (GridViewRow row in specimensGrid.Rows) { int rowIndex = row.RowIndex; string specimenId = specimensGrid.DataKeyNames[0] == Specimen.SpecimenId ? specimensGrid.DataKeys[0].Value.ToString() : string.Empty; ICaisisInputControl boxId = PageUtil.DeepFindICaisisInputControl(row, Specimen.BoxId); ICaisisInputControl positionId = PageUtil.DeepFindICaisisInputControl(row, SpecimenPosition.PositionId); string uniqueClientKey = (boxId as Control).UniqueID; TextBox boxName = new TextBox(); boxName.ID = uniqueClientKey + "RefBoxName"; boxName.Style.Add(HtmlTextWriterStyle.Display, "none"); controlsToRender.Add(boxName); TextBox positionName = new TextBox(); positionName.ID = uniqueClientKey + "RefPositionName"; positionName.Style.Add(HtmlTextWriterStyle.Display, "none"); controlsToRender.Add(positionName); // Set Box Name and Position Name based off of records if (!string.IsNullOrEmpty(boxId.Value)) { SpecimenBox box = new SpecimenBox(); box.Get(int.Parse(boxId.Value)); boxName.Text = box[SpecimenBox.BoxName].ToString(); if (Page.IsPostBack) { if (!string.IsNullOrEmpty(positionId.Value)) { SpecimenPosition pos = new SpecimenPosition(); pos.Get(int.Parse(positionId.Value)); positionName.Text = pos[SpecimenPosition.Position].ToString(); } else if (this.ViewState["SpecimenId$" + rowIndex] != null) { string posName = Request.Form[(this.ViewState["SpecimenId$" + rowIndex] as string[])[3]]; positionName.Text = posName; } } else if (!string.IsNullOrEmpty(positionId.Value)) { SpecimenPosition pos = new SpecimenPosition(); pos.Get(int.Parse(positionId.Value)); positionName.Text = pos[SpecimenPosition.Position].ToString(); } } SpecimenFormHelper helper = new SpecimenFormHelper(rowIndex.ToString(), specimenId, boxId as Control, positionId as Control, boxName as Control, positionName as Control); jsArray += helper.ClientIdsJavaScriptArray + ","; string key = helper.AccessKey; string[] val = helper.FormArray; this.ViewState.Add(key, val); } // Register ClientIds Array to page, where populating is handled via JavaScript jsArray = jsArray.TrimEnd(",".ToCharArray()); Page.ClientScript.RegisterArrayDeclaration("SpecimenLocationRefList", jsArray); string disableControls = (!specimensGrid.Enabled).ToString().ToLower(); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "DisabledPickerControls", "var disablePickerControls = " + disableControls + ";", true); } }
private void LoadSpecimenInfo() { Specimen specimen = new Specimen(); specimen.Get(this.specimenId); string parentspecId = specimen[Specimen.ParentSpecimenId].ToString(); pspecId.Value = parentspecId.ToString(); //if (!string.IsNullOrEmpty(parentspecId)) //{ // Specimen ParentSpecimen = new Specimen(); // ParentSpecimen.Get(Int32.Parse(parentspecId.ToString())); // pRemQty.Value = ParentSpecimen[Specimen.SpecimenRemainingQty].ToString(); //} CICHelper.SetFieldValues(this.inputControlsRow.Controls, specimen); //getting patient identifier PtId.Text = _identifierType + " :"; SpecimenManagerDa da = new SpecimenManagerDa(); string datasetSql = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); DataTable dt = da.GetIdentifier(this.specimenId, _identifierType, datasetSql); string identifier = dt.Rows[0].ItemArray[2].ToString(); TumorBankNumber.Text = identifier.ToString(); //load box and position from SpecimenBoxes and SpecimenPositions tables string sBoxId = specimen[Specimen.BoxId].ToString(); if (!String.IsNullOrEmpty(sBoxId)) { int boxId = int.Parse(sBoxId); SpecimenBox box = new SpecimenBox(); box.Get(boxId); this.BoxId.Value = box[SpecimenBox.BoxId].ToString(); this.BoxName.Value = box[SpecimenBox.BoxName].ToString(); DataSet hierarchySet = da.GetBoxAndAncestors(boxId); DataTable boxesDT = hierarchySet.Tables[0]; DataTable containersDT = hierarchySet.Tables[1]; DataTable storagesDT = hierarchySet.Tables[2]; DataTable siteDT = hierarchySet.Tables[3]; if (boxesDT.Rows.Count >= 1) { string containerIdStr = boxesDT.Rows[0][SpecimenBox.ContainerId].ToString(); DataRow containerRow = containersDT.Select(SpecimenContainer.ContainerId + " = " + containerIdStr)[0]; this.ContainerName.Value = PageUtil.EscapeSingleQuotes(containerRow[SpecimenContainer.ContainerName].ToString()); } if (containersDT.Rows.Count >= 1) { string storagesIdStr = containersDT.Rows[0][Caisis.BOL.SpecimenContainer.StorageId].ToString(); DataRow specimenRow = storagesDT.Select(Caisis.BOL.SpecimenStorage.StorageId + " = " + storagesIdStr)[0]; this.StorageName.Value = PageUtil.EscapeSingleQuotes(specimenRow[Caisis.BOL.SpecimenStorage.StorageName].ToString()); } if (siteDT.Rows.Count >= 1) { string siteId = siteDT.Rows[0][SpecimenSite.SiteId].ToString(); DataRow siteRow = siteDT.Select(SpecimenSite.SiteId + " = " + siteId)[0]; this.SiteName.Value = PageUtil.EscapeSingleQuotes(siteRow[SpecimenSite.SiteName].ToString()); } } string sPositionId = specimen[Specimen.PositionId].ToString(); if (!String.IsNullOrEmpty(sPositionId)) { int positionId = int.Parse(sPositionId); SpecimenPosition pos = new SpecimenPosition(); pos.Get(positionId); this.PositionName.Value = pos[SpecimenPosition.Position].ToString(); this.PositionId.Value = pos[SpecimenPosition.PositionId].ToString(); } }