Exemple #1
0
 internal void OnSelected(object sender, DalcDataSourceSelectEventArgs e)
 {
     if (Selected != null)
     {
         Selected(sender, e);
     }
 }
Exemple #2
0
        public Query GetSelectQuery(string viewName)
        {
            Query q = new Query(viewName == TableName ? SelectTableName : viewName);

            q.Condition = Condition;
            DataSourceSelectArguments selectArgs = new DataSourceSelectArguments();
            DataSet ds = DataSetFactory.GetDataSet(viewName);
            DalcDataSourceSelectEventArgs eArgs = new DalcDataSourceSelectEventArgs(q, selectArgs, ds);

            // raise event
            OnSelecting(this, eArgs);
            return(q);
        }
Exemple #3
0
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            Query q = new Query(Name == DataSource.TableName ? DataSource.SelectTableName : Name);

            q.Condition = DataSource.Condition;
            if (!String.IsNullOrEmpty(arguments.SortExpression))
            {
                q.Sort = arguments.SortExpression.Split(',').Select(v => (QSort)v).ToArray();
            }
            DataSet ds = GetDataSet();

            DalcDataSourceSelectEventArgs eArgs = new DalcDataSourceSelectEventArgs(q, arguments, ds);

            // raise event
            DataSource.OnSelecting(DataSource, eArgs);
            if (eArgs.Cancel)
            {
                return(null);
            }

            if (arguments.RetrieveTotalRowCount)
            {
                arguments.TotalRowCount = DataSource.Dalc.RecordsCount(q);
            }

            q.StartRecord = arguments.StartRowIndex;
            if (arguments.MaximumRows > 0)
            {
                q.RecordCount = arguments.MaximumRows;
            }
            if (q.RecordCount > 0)
            {
                DataSource.Dalc.Load(q, ds);
            }
            // raise event
            DataSource.OnSelected(DataSource, eArgs);

            return(ds.Tables[q.Table].DefaultView);
        }