Exemplo n.º 1
0
 /// <summary>
 /// Raises the SelectObject event.
 /// </summary>
 internal void OnSelectObject(SelectObjectArgs e)
 {
     if (SelectObject != null)
     {
         SelectObject(this, e);
     }
 }
Exemplo n.º 2
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 YYT.Core.IReportTotalRowCount)
                {
                    rowCount = ((YYT.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);
        }