Esempio n. 1
0
 private string TitleSearch(int titleId, String title)
 {
     try
     {
         TitleSearchCriteria criteria = new TitleSearchCriteria();
         if (titleId != 0) criteria.TitleID = titleId;
         criteria.Title = title + '%';
         criteria.StartRow = 1;
         criteria.PageSize = 10000;
         criteria.OrderBy = TitleSearchOrderBy.Title;
         criteria.SortOrder = SortOrder.Ascending;
         CustomGenericList<Title> titles = new BHLProvider().TitleSearchPaging(criteria);
         JavaScriptSerializer js = new JavaScriptSerializer();
         return js.Serialize(titles);
     }
     catch
     {
         return null;
     }
 }
Esempio n. 2
0
        private void buildSearchCriteria()
        {
            if ( _searchCriteria == null )
            {
                _searchCriteria = new TitleSearchCriteria();
            }

            if ( _refreshSearch )
            {
                _searchCriteria = new TitleSearchCriteria();

                _searchCriteria.Title = getNullableString( titleTextBox.Text.Trim() );
                _searchCriteria.MARCBibID = getNullableString( bibidTextBox.Text.Trim() );

                int id;
                _searchCriteria.TitleID = null;
                if ( titleidTextBox.Text.Trim().Length > 0 )
                {
                    bool idExists = int.TryParse( titleidTextBox.Text.Trim(), out id );
                    if ( idExists )
                    {
                        _searchCriteria.TitleID = id;
                    }
                }
            }

            _searchCriteria.OrderBy = _orderBy;
            _searchCriteria.SortOrder = _sortOrder;
            _searchCriteria.PageSize = Math.Abs( pagingUserControl.StartIndex - pagingUserControl.EndIndex ) + 1;
            _searchCriteria.StartRow = pagingUserControl.StartIndex;
        }
Esempio n. 3
0
        protected void Page_Load( object sender, EventArgs e )
        {
            HtmlLink cssLnk = new HtmlLink();
            cssLnk.Attributes.Add("rel", "stylesheet");
            cssLnk.Attributes.Add("type", "text/css");
            cssLnk.Href = "http://jqueryui.com/latest/themes/base/ui.all.css";
            Page.Header.Controls.Add(cssLnk);
            ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js");
            ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.js");

            if (IsPostBack)
            {
                if ( ViewState[ "SearchCriteria" ] != null )
                {
                    _searchCriteria = (TitleSearchCriteria)ViewState[ "SearchCriteria" ];
                    _isExactSearch = (bool)ViewState[ "IsExactSearch" ];
                    _orderBy = (TitleSearchOrderBy)ViewState[ "OrderBy" ];
                    _sortOrder = (SortOrder)ViewState[ "SortOrder" ];
                }
                pagingUserControl.Visible = true;
            }
            else
            {
                pagingUserControl.Visible = false;

                BHLProvider bp = new BHLProvider();

                CustomGenericList<Institution> institutions = bp.InstituationSelectAll();

                listInstitutions.DataSource = institutions;
                listInstitutions.DataBind();
            }

            String redirect = Request.QueryString["redir"] as String;
            if (redirect != null)
            {
                if (redirect.ToLower() == "p")
                {
                    litHeader.Text = "Pagination";
                    liImport.Visible = false;
                    divImport.Visible = false;
                    HyperLinkField linkField = (HyperLinkField)gvwResults.Columns[2];
                    linkField.NavigateUrl = "/Admin/Paginator.aspx";
                    linkField.DataNavigateUrlFormatString = "/Admin/Paginator.aspx?TitleID={0}";
                    _redirectUrl = "/Admin/Paginator.aspx?TitleID=";
                }
            }

            errorControl.Visible = false;
            Page.SetFocus( titleTextBox );
            Page.Title = "BHL Admin - Title Search";
        }
Esempio n. 4
0
        public static int TitleSearchCount( SqlConnection sqlConnection, SqlTransaction sqlTransaction,
            TitleSearchCriteria tsc)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "TitleSearchCount", connection, transaction,
                CustomSqlHelper.CreateInputParameter( "TitleID", SqlDbType.Int, null, true, tsc.TitleID ),
                CustomSqlHelper.CreateInputParameter( "MARCBibID", SqlDbType.NVarChar, 50, true, tsc.MARCBibID ),
                CustomSqlHelper.CreateInputParameter( "Title", SqlDbType.NVarChar, 255, true, tsc.Title ) ) )
            {
                using ( CustomSqlHelper<int> helper = new CustomSqlHelper<int>() )
                {
                    CustomGenericList<int> k = helper.ExecuteReader( command );

                    return k[ 0 ];
                }
            }
        }
Esempio n. 5
0
        public static CustomGenericList<Title> TitleSearch( SqlConnection sqlConnection, SqlTransaction sqlTransaction,
            TitleSearchCriteria tsc)
        {
            SqlConnection connection = CustomSqlHelper.CreateConnection(
                CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection );
            SqlTransaction transaction = sqlTransaction;

            using ( SqlCommand command = CustomSqlHelper.CreateCommand( "TitleSearchPaging", connection, transaction,
                CustomSqlHelper.CreateInputParameter( "TitleID", SqlDbType.Int, null, true, tsc.TitleID ),
                CustomSqlHelper.CreateInputParameter( "MARCBibID", SqlDbType.NVarChar, 50, true, tsc.MARCBibID ),
                CustomSqlHelper.CreateInputParameter( "Title", SqlDbType.NVarChar, 255, true, tsc.Title ),
                CustomSqlHelper.CreateInputParameter( "StartRow", SqlDbType.BigInt, null, false, tsc.StartRow ),
                CustomSqlHelper.CreateInputParameter( "PageSize", SqlDbType.Int, null, false, tsc.PageSize ),
                CustomSqlHelper.CreateInputParameter( "OrderBy", SqlDbType.Int, null, false,
                (int)tsc.OrderBy * ( tsc.SortOrder == SortOrder.Ascending ? 1 : -1 ) ) ) )
            {
                using ( CustomSqlHelper<Title> helper = new CustomSqlHelper<Title>() )
                {
                    return helper.ExecuteReader( command );
                }
            }
        }