private void DetermineRequestStatus() { if (this.RequestId > 0) { SpecimenManagerDa da = new SpecimenManagerDa(); DataTable dt = new DataTable(); dt = da.GetDistributionByRequestId(this.RequestId); if (dt.Rows.Count > 0) { if (!string.IsNullOrEmpty(dt.Rows[0]["DispatchedDate"].ToString())) { if (!string.IsNullOrEmpty(dt.Rows[0]["ReceivedDate"].ToString())) { this._stage = 3; //received } else { this._stage = 2; //in transit ... dispatched } } } else { this._stage = 1; //ready for dispatch } } }
/// <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); } }