Esempio n. 1
0
        /// <summary>
        /// Populate the transfer details
        /// </summary>
        /// <param name="requestId"></param>
        /// <param name="distributionId"></param>
        private void PopulateRequest(int requestId, int distributionId)
        {
            // populate request fields
            SpecimenRequest request = new SpecimenRequest();

            request.Get(requestId);
            base.PopulateForm(this, request);
            // populate distribution fields
            SpecimenDistribution distribution = new SpecimenDistribution();

            distribution.Get(distributionId);
            base.PopulateForm(this, distribution);
            // date mask
            DispatchedDate.Value = string.Format("{0:d}", distribution[SpecimenDistribution.DispatchedDate]);
            ReceivedDate.Value   = string.Format("{0:d}", distribution[SpecimenDistribution.ReceivedDate]);
        }
Esempio n. 2
0
        /// <summary>
        /// Given a request id, finds the associated distribution. If found, populates the controls with the values.
        /// </summary>
        /// <param name="rId"></param>
        private void LoadDistributionByRequestId(int rId)
        {
            SpecimenManagerDa da = new SpecimenManagerDa();
            DataTable         dt = new DataTable();

            dt = da.GetDistributionByRequestId(rId);

            //if there is a distrbution, we populate the fields
            if (dt.Rows.Count > 0)
            {
                SpecimenDistribution sDistribution = new SpecimenDistribution();
                int dId = Int32.Parse(dt.Rows[0][SpecimenDistribution.DistributionId].ToString());
                sDistribution.Get(dId);

                CICHelper.SetFieldValues(this.DispatchDiv.Controls, sDistribution);
                CICHelper.SetFieldValues(this.ReceiveDiv.Controls, sDistribution);

                this.DispatchedDate.Value = GetValidDisplayDate(this.DispatchedDate.Value);
                this.ReceivedDate.Value   = GetValidDisplayDate(this.ReceivedDate.Value);
            }
        }
Esempio n. 3
0
        protected void SaveReceiveDetails(object sender, ImageClickEventArgs e)
        {
            try
            {
                ControlCollection receiveControls = Page.FindControl("ReceiveDiv").Controls;
                CICHelper.ValidFieldValues(receiveControls);

                SpecimenDistribution sDistribution = new SpecimenDistribution();
                sDistribution.Get(Int32.Parse(this.DistributionId.Value));

                CICHelper.SetBOValues(receiveControls, sDistribution, 1);

                sDistribution.Save();

                SpecimenManagerDa da = new SpecimenManagerDa();
                da.UpdateRequestStatus(this.RequestId, "Received");
                this.RequestStatus.Value = "Received";

                // update the status for the collections in this transfer
                // (saved to database ... is the same as the ones in showing up in the select box because user can't change them (w/o. saving) at this stage)
                // to status of "Received"
                foreach (ListItem li in this.AvailableCollectionSelectBox.Items)
                {
                    int colId = int.Parse(li.Value);
                    UpdateCollectionStatus(colId, "Received");
                }

                DetermineRequestStatus();
                EnableDisableDivsByStatus();

                UpdatePageTitle();
            }
            catch (RequiredValueException rve)
            {
                ReceiveDateError.Text = "Please enter a receive date.";
            }
        }
Esempio n. 4
0
        private void SaveRequestFields()
        {
            int?requestId = null;
            // save request
            SpecimenRequest request = new SpecimenRequest();

            if (!string.IsNullOrEmpty(SpecimenRequestId.Value))
            {
                requestId = int.Parse(SpecimenRequestId.Value);
                request.Get(requestId.Value);
            }
            CICHelper.SetBOValues(this.Controls, request, -1);
            request.Save();
            requestId = (int)request[SpecimenRequest.SpecimenRequestId];
            // save distribution
            int?distributionId = null;
            SpecimenDistribution distribution = new SpecimenDistribution();

            if (!string.IsNullOrEmpty(DistributionId.Value))
            {
                distributionId = int.Parse(DistributionId.Value);
                distribution.Get(distributionId.Value);
            }
            CICHelper.SetBOValues(this.Controls, distribution, -1);
            distribution[SpecimenDistribution.SpecimenRequestId] = requestId.Value;
            distribution.Save();
            // save collecion
            int?collectionId = null;
            SpecimenCollection collection = new SpecimenCollection();

            if (!string.IsNullOrEmpty(CollectionId.Value))
            {
                collectionId = int.Parse(CollectionId.Value);
                collection.Get(collectionId.Value);
            }
            CICHelper.SetBOValues(this.Controls, collection, -1);
            collection[SpecimenCollection.SpecimenRequestId] = requestId.Value;
            // !important
            // handle transfer status: stamp with original request
            if (QueryMode == "request" && !string.IsNullOrEmpty(QueryTransferStatus))
            {
                collection[SpecimenCollection.CollectionStatus] = QueryTransferStatus;
            }
            collection.Save();
            collectionId = (int)collection[SpecimenCollection.CollectionId];
            // save specimens
            IEnumerable <int> specimensInCollection = SaveSpecimens(collectionId.Value);

            // update specimen statuses
            if (!string.IsNullOrEmpty(QueryTransferStatus))
            {
                UpdateSpecimenStatus(specimensInCollection, QueryTransferStatus);
            }

            // update fields
            SpecimenRequestId.Value = requestId + "";
            DistributionId.Value    = distributionId + "";
            CollectionId.Value      = collectionId + "";

            // register update script
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "registerUpdateScript", "if(parent.doTransferUpdated) parent.doTransferUpdated();", true);
        }