Esempio n. 1
0
 /// <summary>
 /// Raises the SelectObject event.
 /// </summary>
 internal void OnSelectObject(SelectObjectArgs e)
 {
     if (SelectObject != null)
     {
         SelectObject(this, e);
     }
 }
 protected void ReadOnlyLineagesDataSource_SelectObject(object sender, SelectObjectArgs e)
 {
     ReadOnlyLineages linsWithoutRoot = ChildLineages.Clone();
     var root = linsWithoutRoot.Single(l => l.Id == CurrentRootId);
     linsWithoutRoot.Remove(root);
     e.BusinessObject = linsWithoutRoot;
     ChildReligionsLabel.Visible = linsWithoutRoot.Any();
 }
Esempio n. 3
0
        ExecuteSelect(DataSourceSelectArguments arguments)
        {
            // get the object from the page
            SelectObjectArgs args = new SelectObjectArgs(arguments);

            _owner.OnSelectObject(args);
            object result = args.BusinessObject;

            if (arguments.RetrieveTotalRowCount)
            {
                int rowCount;
                if (result == null)
                {
                    rowCount = 0;
                }
                else if (result is Csla.Core.IReportTotalRowCount)
                {
                    rowCount = ((Csla.Core.IReportTotalRowCount)result).TotalRowCount;
                }
                else if (result is IList)
                {
                    rowCount = ((IList)result).Count;
                }
                else if (result is IEnumerable)
                {
                    IEnumerable temp  = (IEnumerable)result;
                    int         count = 0;
                    foreach (object item in temp)
                    {
                        count++;
                    }
                    rowCount = count;
                }
                else
                {
                    rowCount = 1;
                }
                arguments.TotalRowCount = rowCount;
            }

            // if the result isn't IEnumerable then
            // wrap it in a collection
            if (!(result is IEnumerable))
            {
                ArrayList list = new ArrayList();
                if (result != null)
                {
                    list.Add(result);
                }
                result = list;
            }

            // now return the object as a result
            return((IEnumerable)result);
        }
Esempio n. 4
0
        /// <summary>
        /// Implements the select behavior for
        /// the control by raising the 
        /// <see cref="CslaDataSource.SelectObject"/> event.
        /// </summary>
        /// <param name="arguments">Arguments object.</param>
        /// <returns>The data returned from the select.</returns>
        protected override System.Collections.IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            // get the object from the page
              SelectObjectArgs args = new SelectObjectArgs(arguments);
              _owner.OnSelectObject(args);
              object result = args.BusinessObject;

              if (arguments.RetrieveTotalRowCount)
              {
            int rowCount;
            if (result == null)
              rowCount = 0;
            else if (result is Csla.Core.IReportTotalRowCount)
              rowCount = ((Csla.Core.IReportTotalRowCount)result).TotalRowCount;
            else if (result is IList)
              rowCount = ((IList)result).Count;
            else if (result is IEnumerable)
            {
              IEnumerable temp = (IEnumerable)result;
              int count = 0;
              foreach (object item in temp)
            count++;
              rowCount = count;
            }
            else
              rowCount = 1;
            arguments.TotalRowCount = rowCount;
              }

              // if the result isn't IEnumerable then
              // wrap it in a collection
              if (!(result is IEnumerable))
              {
            ArrayList list = new ArrayList();
            if (result != null)
              list.Add(result);
            result = list;
              }

              // now return the object as a result
              return (IEnumerable)result;
        }
 protected void RootLineageDataSource_SelectObject(object sender, SelectObjectArgs e)
 {
     Lineage lineage = Lineage.GetLineageLocally(CurrentRootId);
     e.BusinessObject = lineage;
     InitHeader(lineage);
 }
 protected void HtmlContentDataSource_SelectObject(object sender, SelectObjectArgs e)
 {
     e.BusinessObject = HtmlContent;
     InitHeader(HtmlContent);
 }
Esempio n. 7
0
 /// <summary>
 /// Raises the SelectObject event.
 /// </summary>
 internal void OnSelectObject(SelectObjectArgs e)
 {
     if (SelectObject != null)
     SelectObject(this, e);
 }