Exemplo n.º 1
0
 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();

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

            object result;

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

            if (!(result is IEnumerable))
            {
                ArrayList list = new ArrayList();
                list.Add(result);
                result = list;
            }

            // now return the object as a result
            return((IEnumerable)result);
        }