Custom List with Business Object Scripted

Good Morning, i need an help, because i would have the necessity to implement a Custom List using a
scipted Business Object but I doesn't succeed in managing in corrected
way the interface IPAGEDACCESS and IINDEXACCESS, does someone have an
example to pass me?
thanks a lot

Tagged:

Comments

  • Hi Alex,

     

    Try adding this code snipped to your BO script.  Also set your BO to implement IPagedAccess of course. _ds is the variable name for your DataSet-

     

     

    #region IPagedAccess methods

                 

                      public virtual int PageSize

                  {

                            get

                      {

                            return _pageSize;

                            }

                      }

                     

                      public int CurrentPage

                      {

                            get

                            {

                                  return _currentPage;

                            }

                      }

                     

                      public int RequestPage

                      {

                            get

                            {

                                  return CurrentPage;

                            }

                            set

                            {

                                  _currentPage = value;

                            }

                      }

                     

                      public IList<KeyValuePair<string, Metastorm.Runtime.Contracts.SortDirection>> SortColumns

                      {

                            get

                            {

                                  return _sortOrder;

                            }

                            set

                            {

                                  _sortOrder = value;

                            }

                      }

                     

                      public Metastorm.Runtime.Contracts.Mbo.IBusinessObjectFilter Filter

                      {

                            get;

                            set;

                      }

                     

                      public int TotalPageCount

                      {

                            get

                            {

                                  int iPages = 0;

                                  if (_ds != null)

                                  {

                                        if (_ds.Tables.Count > 0)

                                        {

                                              iPages = _ds.Tables[0].Rows.Count / PageSize;

                                              if (_ds.Tables[0].Rows.Count % PageSize != 0)

                                              {

                                                    iPages++;

                                              }

                                        }

                                  }

                                  return iPages;

                            }

                      }

                     

                      public int TotalRowCount

                      {

                            get

                            {

                                  if (_ds != null)

                                  {

                                        if (_ds.Tables.Count > 0)

                                        {

                                              return _ds.Tables[0].Rows.Count;

                                        }

                                  }

                                  return 0;

                            }

                      }

                     

                      #endregion IPagedAccess methods

  • Hi Ari,

      thank you for the solution, but i have a last problem with the sort..

    i declare a _sort as IList<KeyValuePair<string, Metastorm.Runtime.Contracts.SortDirection>> but with the solution that you propose, the sortColumn not work well..

     

    Can you help me?

    Best Regards