Ejemplo n.º 1
0
        protected void BindData_(string PubIDs)
        {
            List <Pub> l_listPub = null;

            string l_key = String.Empty;

            if (PubIDs == null)
            {
                l_key = this.CleanSearchTerms(this.PreviousPage.Keyword.Trim());

                l_listPub =
                    PE_DAL.AdminDoSearch(
                        this.PreviousPage.NCIPL ? 1 : 0,
                        this.PreviousPage.ROO ? 1 : 0,
                        this.PreviousPage.Exh ? 1 : 0,
                        this.PreviousPage.Catalog ? 1 : 0,
                        l_key.Length > 0 ? l_key : null,
                        this.PreviousPage.NIHNum1.Trim().Length > 0 ? this.PreviousPage.NIHNum1.Trim() : null,
                        this.PreviousPage.NIHNum2.Trim().Length > 0 ? this.PreviousPage.NIHNum2.Trim() : null,
                        Convert.ToBoolean(this.PreviousPage.Newpub) ? 1 : 0,
                        Convert.ToBoolean(this.PreviousPage.Updatedpub) ? 1 : 0,
                        this.PreviousPage.CreatedFrom.Length > 0 ? Convert.ToDateTime(this.PreviousPage.CreatedFrom) : DateTime.MinValue,
                        this.PreviousPage.CreatedTo.Length > 0 ? Convert.ToDateTime(this.PreviousPage.CreatedTo) : DateTime.MinValue,
                        (this.PreviousPage.SelectedCancerType.Length > 0 && this.PreviousPage.SelectedCancerType != "0") ? this.PreviousPage.SelectedCancerType : null,
                        (this.PreviousPage.SelectedSubject.Length > 0 && this.PreviousPage.SelectedSubject != "0") ? this.PreviousPage.SelectedSubject : null,
                        (this.PreviousPage.SelectedAudience.Length > 0 && this.PreviousPage.SelectedAudience != "0") ? this.PreviousPage.SelectedAudience : null,
                        (this.PreviousPage.SelectedLang.Length > 0 && this.PreviousPage.SelectedLang != "0") ? this.PreviousPage.SelectedLang : null,
                        (this.PreviousPage.SelectedProdFormat.Length > 0 && this.PreviousPage.SelectedProdFormat != "0") ? this.PreviousPage.SelectedProdFormat : null,
                        (this.PreviousPage.SelectedSeries.Length > 0 && this.PreviousPage.SelectedSeries != "0") ? this.PreviousPage.SelectedSeries : null,
                        (this.PreviousPage.SelectedRace.Length > 0 && this.PreviousPage.SelectedRace != "0") ? this.PreviousPage.SelectedRace : null,
                        (this.PreviousPage.SelectedBookStatus.Length > 0 && this.PreviousPage.SelectedBookStatus != "0") ? this.PreviousPage.SelectedBookStatus : null,
                        (this.PreviousPage.SelectedReadingLevel.Length > 0 && this.PreviousPage.SelectedReadingLevel != "0") ? this.PreviousPage.SelectedReadingLevel : null,
                        this.PreviousPage.ROOMostCom ? 1 : 0,
                        (this.PreviousPage.SelectedROOSubject.Length > 0 && this.PreviousPage.SelectedROOSubject != "0") ? this.PreviousPage.SelectedROOSubject : null,
                        (this.PreviousPage.SelectedAward.Length > 0 && this.PreviousPage.SelectedAward != "0") ? this.PreviousPage.SelectedAward : null,
                        (this.PreviousPage.SelectedOwner.Length > 0 && this.PreviousPage.SelectedOwner != "0") ? this.PreviousPage.SelectedOwner : null,
                        (this.PreviousPage.SelectedSponsor.Length > 0 && this.PreviousPage.SelectedSponsor != "0") ? this.PreviousPage.SelectedSponsor : null, null

                        );
            }
            else
            {
                this.mySearch = ((Search)Session[PubEntAdminManager.strSearchCriteria]);

                l_key = this.CleanSearchTerms(this.mySearch.Key.Trim());

                l_listPub = PE_DAL.AdminDoSearch(
                    this.mySearch.NCIPL ? 1 : 0,
                    this.mySearch.ROO ? 1 : 0,
                    this.mySearch.EXH ? 1 : 0,
                    this.mySearch.CATALOG ? 1 : 0,
                    l_key.Length > 0 ? l_key : null,
                    this.mySearch.NIH1.Trim().Length > 0 ? this.mySearch.NIH1.Trim() : null,
                    this.mySearch.NIH2.Trim().Length > 0 ? this.mySearch.NIH2.Trim() : null,
                    Convert.ToBoolean(this.mySearch.ISNEW) ? 1 : 0,
                    Convert.ToBoolean(this.mySearch.ISUPDATED) ? 1 : 0,
                    this.mySearch.CreateFrom.Length > 0 ? Convert.ToDateTime(this.mySearch.CreateFrom) : DateTime.MinValue,
                    this.mySearch.CreateTo.Length > 0 ? Convert.ToDateTime(this.mySearch.CreateTo) : DateTime.MinValue,
                    (this.mySearch.Cancer.Length > 0 && this.mySearch.Cancer != "0") ? this.mySearch.Cancer : null,
                    (this.mySearch.Subj.Length > 0 && this.mySearch.Subj != "0") ? this.mySearch.Subj : null,
                    (this.mySearch.Aud.Length > 0 && this.mySearch.Aud != "0") ? this.mySearch.Aud : null,
                    (this.mySearch.Lang.Length > 0 && this.mySearch.Lang != "0") ? this.mySearch.Lang : null,
                    (this.mySearch.Format.Length > 0 && this.mySearch.Format != "0") ? this.mySearch.Format : null,
                    (this.mySearch.Serie.Length > 0 && this.mySearch.Serie != "0") ? this.mySearch.Serie : null,
                    (this.mySearch.Race.Length > 0 && this.mySearch.Race != "0") ? this.mySearch.Race : null,
                    (this.mySearch.Status.Length > 0 && this.mySearch.Status != "0") ? this.mySearch.Status : null,
                    (this.mySearch.Level.Length > 0 && this.mySearch.Level != "0") ? this.mySearch.Level : null,
                    this.mySearch.ROOCOM ? 1 : 0,
                    (this.mySearch.ROOCOMSubj.Length > 0 && this.mySearch.ROOCOMSubj != "0") ? this.mySearch.ROOCOMSubj : null,
                    (this.mySearch.Award.Length > 0 && this.mySearch.Award != "0")? this.mySearch.Award : null,
                    (this.mySearch.Owner.Length > 0 && this.mySearch.Owner != "0") ? this.mySearch.Owner : null,
                    (this.mySearch.Sponsor.Length > 0 && this.mySearch.Sponsor != "0") ? this.mySearch.Sponsor : null,
                    PubIDs);
            }

            if (l_listPub.Count == 1)
            {
                if (this.Export)
                {
                    this.RemColumnHeadersSortedImg();
                    this.gvResult.DataSource = l_listPub;
                    this.gvResult.DataBind();
                }
                else
                {
                    this.mySearch.ClearPubId();
                    this.mySearch.AddPubId(l_listPub[0].PubID);
                    Session[PubEntAdminManager.strSearchCriteria] = this.mySearch;

                    //go directly to pubrecord page
                    if (PubEntAdminManager.TamperProof)
                    {
                        PubEntAdminManager.RedirectEncodedURLWithQS("PubRecord.aspx", "mode=view&pubid=" + l_listPub[0].PubID.ToString());
                    }
                    else
                    {
                        Response.Redirect("PubRecord.aspx?mode=view&pubid=" + l_listPub[0].PubID.ToString(), true);
                    }
                }
            }
            else
            {
                this.lblTotalResCnt.Text = l_listPub.Count.ToString();

                if (!this.Export)
                {
                    this.mySearch.ClearPubId();
                    //Update the column headers
                    UpdateColumnHeaders();
                }
                else
                {
                    this.RemColumnHeadersSortedImg();
                }

                this.gvResult.DataSource = l_listPub;
                this.gvResult.DataBind();

                if (l_listPub.Count == 0)
                {
                    this.trTopCtrlPnl.Visible   = this.trBtmCtrlPnl.Visible = false;
                    this.gvResult.Visible       = false;
                    this.hyplnkRefSrch2.Visible = this.hyplnkSrch2.Visible = false;
                }
            }
            Session[PubEntAdminManager.strSearchCriteria] = this.mySearch;
        }