protected void btnChangePaging_Click(object sender, EventArgs e)
 {
     EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);
     List<ISTAT.Entity.ConceptScheme> lConceptscheme = eMapper.GetConceptSchemeList(_sdmxObjects);
     int numberOfRows = 0;
     if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
     {
         if ( numberOfRows > 0 )
         {
             gridView.PageSize = numberOfRows;
         }
         else
         {
             gridView.PageSize = Utils.GeneralConceptschemeGridNumberRow;
             txtNumberOfRows.Text = Utils.GeneralConceptschemeGridNumberRow.ToString();
         }
     }
     else if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && !int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
     {
         Utils.ShowDialog( Resources.Messages.err_wrong_rows_number_pagination );
         return;
     }
     else if ( txtNumberOfRows.Text.Trim().Equals( string.Empty ) )
     {
         gridView.PageSize = Utils.GeneralConceptschemeGridNumberRow;
         txtNumberOfRows.Text = Utils.GeneralConceptschemeGridNumberRow.ToString();
     }
     gridView.DataSourceID = null;
     gridView.DataSource = lConceptscheme;
     gridView.DataBind();
 }
        private void BindData()
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);

            List<ISTAT.Entity.ConceptScheme> _list = eMapper.GetConceptSchemeList(_sdmxObjects, Utils.LocalizedLanguage);

            int numberOfRows = 0;

            if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
            {
                gridView.PageSize = numberOfRows;
            }
            else
            {
                gridView.PageSize = Utils.GeneralConceptschemeGridNumberRow;
            }
            lblNumberOfTotalElements.Text = string.Format( Resources.Messages.lbl_number_of_total_rows, _list.Count.ToString() );

            if ( _list.Count == 0 )
            {
                txtNumberOfRows.Visible = false;
                lblNumberOfRows.Visible = false;
                btnChangePaging.Visible = false;
            }
            else
            {
                txtNumberOfRows.Visible = true;
                lblNumberOfRows.Visible = true;
                btnChangePaging.Visible = true;
            }

            gridView.DataSourceID = null;
            gridView.DataSource = _list;
            gridView.DataBind();
        }
        protected void OnSorting(object sender, GridViewSortEventArgs e)
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);
            List<ISTAT.Entity.ConceptScheme> _list = eMapper.GetConceptSchemeList(_sdmxObjects);

            if ((SortDirection)ViewState["SortExpr"] == SortDirection.Ascending)
            {
                _list = _list.OrderBy(x => TypeHelper.GetPropertyValue(x, e.SortExpression)).Reverse().ToList();
                ViewState["SortExpr"] = SortDirection.Descending;
            }
            else
            {
                _list = _list.OrderBy(x => TypeHelper.GetPropertyValue(x, e.SortExpression)).ToList();
                ViewState["SortExpr"] = SortDirection.Ascending;
            }

            int numberOfRows = 0;

            if ( !txtNumberOfRows.Text.Trim().Equals( string.Empty ) && int.TryParse( txtNumberOfRows.Text, out numberOfRows ) )
            {
                gridView.PageSize = numberOfRows;
            }
            else
            {
                gridView.PageSize = Utils.GeneralConceptschemeGridNumberRow;
            }
            gridView.DataSourceID = null;
            gridView.DataSource = _list;
            gridView.DataBind();
        }
예제 #4
0
        private void BindData()
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);

            if (hdnViewMode.Value == "Concept")
            {
                List<ISTAT.Entity.Concept> lItem = eMapper.GetConceptList(_sdmxObjects);

                gvConcepts.PageSize = 12;
                gvConcepts.DataSourceID = null;
                gvConcepts.DataSource = lItem;
                gvConcepts.DataBind();
            }
            else
            {
                List<ISTAT.Entity.ConceptScheme> lConcept = eMapper.GetConceptSchemeList(_sdmxObjects);

                gvConceptScheme.PageSize = 12;
                gvConceptScheme.DataSourceID = null;
                gvConceptScheme.DataSource = lConcept;
                gvConceptScheme.DataBind();
            }
        }
        protected void btnChangePaging_Click(object sender, EventArgs e)
        {
            IConceptSchemeMutableObject cs = GetConceptSchemeFromSession();

            if (cs == null) return;

            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);
            List<ISTAT.Entity.ConceptScheme> lConceptscheme = eMapper.GetConceptSchemeList(_sdmxObjects);
            IList<Concept> lConceptSchemeItem = new List<Concept>();

            foreach (IConceptObject concept in cs.ImmutableInstance.Items)
            {
                lConceptSchemeItem.Add(new Concept(concept.Id, _localizedUtils.GetNameableName(concept), _localizedUtils.GetNameableDescription(concept), concept.ParentConcept));
            }

            int numberOfRows = 0;

            if (!txtNumberOfRows.Text.Trim().Equals(string.Empty) && int.TryParse(txtNumberOfRows.Text, out numberOfRows))
            {
                if (numberOfRows > 0)
                {
                    gvConceptschemesItem.PageSize = numberOfRows;
                }
                else
                {
                    gvConceptschemesItem.PageSize = Utils.DetailsConceptschemeGridNumberRow;
                    txtNumberOfRows.Text = Utils.DetailsConceptschemeGridNumberRow.ToString();
                }
            }
            else if (!txtNumberOfRows.Text.Trim().Equals(string.Empty) && !int.TryParse(txtNumberOfRows.Text, out numberOfRows))
            {
                Utils.ShowDialog(Resources.Messages.err_wrong_rows_number_pagination);
                Utils.AppendScript("location.href='#concepts';");
                return;
            }
            else if (txtNumberOfRows.Text.Trim().Equals(string.Empty))
            {
                gvConceptschemesItem.PageSize = Utils.DetailsConceptschemeGridNumberRow;
                txtNumberOfRows.Text = Utils.DetailsConceptschemeGridNumberRow.ToString();
            }
            gvConceptschemesItem.DataSource = lConceptSchemeItem;
            gvConceptschemesItem.DataBind();
            Utils.AppendScript("location.href='#concepts';");
        }
        private void BindData()
        {
            EntityMapper eMapper = new EntityMapper(Utils.LocalizedLanguage);

            if (hdnViewMode.Value == "Concept")
            {
                List<ISTAT.Entity.Concept> lItem = eMapper.GetConceptList(_sdmxObjects);
                List<ISTAT.Entity.Concept> lFilteredItem;

                if (txtSearchID.Text.Trim() != String.Empty || txtSearchName.Text.Trim() != String.Empty)
                {
                    lFilteredItem = lItem.Where(i => i.Code.ToUpper().Contains(txtSearchID.Text.Trim().ToUpper()) || txtSearchID.Text.Trim() == String.Empty).ToList();
                    lFilteredItem = lFilteredItem.Where(i => i.Name.ToUpper().Contains(txtSearchName.Text.Trim().ToUpper()) || txtSearchName.Text.Trim() == String.Empty).ToList();
                }
                else
                    lFilteredItem = lItem;

                gvConcepts.PageSize = 35;
                gvConcepts.DataSourceID = null;
                gvConcepts.DataSource = lFilteredItem;
                gvConcepts.DataBind();
            }
            else
            {
                List<ISTAT.Entity.ConceptScheme> lConcept = eMapper.GetConceptSchemeList(_sdmxObjects);

                gvConceptScheme.PageSize = 12;
                gvConceptScheme.DataSourceID = null;
                gvConceptScheme.DataSource = lConcept;
                gvConceptScheme.DataBind();
            }
        }