//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;
            }
        }
        //Reloads Parent window by getting all the parameters through BoxId
        //checks for the Box delete
        private void ReloadSpecimenStorageManager(int boxId, bool isDelete)
        {
            DataSet   resultsDataSet = da.GetBoxAndAncestors(boxId);
            DataTable boxesDT        = resultsDataSet.Tables[0];
            string    boxIdStr       = boxId.ToString();
            DataTable containersDT   = resultsDataSet.Tables[1];
            string    containerIdStr = boxesDT.Rows[0][SpecimenBox.ContainerId].ToString();
            DataTable storagesDT     = resultsDataSet.Tables[2];
            string    storagesIdStr  = containersDT.Rows[0][SpecimenContainer.StorageId].ToString();
            string    siteId         = resultsDataSet.Tables[3].Rows[0][SpecimenSite.SiteId].ToString();

            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "RefreshStorageManger", "refreshStorageManger(" + siteId + "," + storagesIdStr + "," + containerIdStr + "," + boxIdStr + "," + isDelete.ToString().ToLower() + ");", true);
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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();
            }
        }
Exemple #5
0
        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();
            }
        }