private void RunSearch()
        {
            // need validation here too
            // because date is validated in the front-end but only when they leave the control
            if (ValidateDates())
            {
                this.errorMessage.Visible = false;

                DataTable         dt = null;
                SpecimenManagerDa da = new SpecimenManagerDa();
                dt = da.GetCollectionByName(this.collectionName.Value);

                dt = da.GetCollections(this.collectionName.Value, this.ddlType.Value, this.ddlStatus.Value, this.dateFrom.Value, this.dateTo.Value, this.chkViewAll.Checked);
                //}

                this.lblTotalCollections.Text = dt.Rows.Count.ToString() + " collection record(s) matched your search criteria";

                if (dt.Rows.Count == 1)
                {
                    Response.Redirect("Collection.aspx?colId=" + dt.Rows[0][SpecimenCollection.CollectionId].ToString() + "&isSingleResult=true" + BuildQuerySearch());
                }
                if (dt.Rows.Count > 0)
                {
                    this.noCollectionsRow.Visible = false;
                    this.searchBody.Visible       = true;
                    this.resultsMsg.Visible       = true;

                    this.rptCollection.DataSource = dt.DefaultView;
                    this.rptCollection.DataBind();
                }
                else
                {
                    this.noCollectionsRow.Visible = true;
                    this.searchBody.Visible       = true;
                    this.resultsMsg.Visible       = false;

                    this.rptCollection.DataSource = null;
                    this.rptCollection.DataBind();
                }
            }
            else
            {
                ShowMessage(this.errorMessage, "Please enter a valid date.", "red");

                this.errorMessage.Visible = true;
                this.resultsMsg.Visible   = false;
                this.searchBody.Visible   = false;
            }
        }
Beispiel #2
0
        private bool ValidateCollectionName(string colName)
        {
            SpecimenManagerDa da = new SpecimenManagerDa();
            DataTable         dt = da.GetCollectionByName(colName);

            if (dt.Rows.Count == 0)
            {
                return(true);
            }
            else
            {
                if (!string.IsNullOrEmpty(this.CollectionId.Value))
                {
                    if (dt.Rows[0][SpecimenCollection.CollectionId].ToString().Equals(this.CollectionId.Value))
                    {
                        return(true);
                    }
                }
                return(false);
            }
        }