示例#1
0
            public string SaveRecord()
            {
                SpecimenPosition biz = new SpecimenPosition();

                if (!string.IsNullOrEmpty(pId))
                {
                    biz.Get(int.Parse(pId));
                }

                biz[SpecimenPosition.BoxId]          = bId;
                biz[SpecimenPosition.Position]       = pName;
                biz[SpecimenPosition.PositionStatus] = "Filled";

                biz.Save();

                string posIdOnSaveInsert = biz[SpecimenPosition.PositionId].ToString();

                return(posIdOnSaveInsert);
            }
示例#2
0
        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();
        }
示例#3
0
        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);
        }
示例#4
0
        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();
        }