Exemplo n.º 1
0
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     DataSourceSelectArguments ee = new DataSourceSelectArguments();
     DataView tmp = (DataView)this.SqlDataSource4.Select(ee);
     Response.Cookies["PapID"].Value = tmp[0][1].ToString();   //从sqldatasource获得列值
     Response.Redirect("Paper.aspx");
 }
Exemplo n.º 2
0
            /// <summary>
            /// Gets a list of data from the underlying data storage.
            /// </summary>
            /// <param name="arguments">A <see cref="T:System.Web.UI.DataSourceSelectArguments"/> that is used to request operations on the data beyond basic data retrieval.</param>
            /// <returns>
            /// An <see cref="T:System.Collections.IEnumerable"/> list of data from the underlying data storage.
            /// </returns>
            protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
            {
                Options.RecordsToRetrieve = arguments.MaximumRows;
                Options.StartingRecord    = arguments.StartRowIndex;

                if (!String.IsNullOrEmpty(arguments.SortExpression))
                {
                    Parameters.OrderByClause = arguments.SortExpression;
                }

                if (DataMode == CatalogSearchDataMode.Objects)
                {
                    Entries entries = CatalogContext.Current.FindItems(Parameters, Options, ResponseGroup);

                    arguments.TotalRowCount = entries.TotalResults;
                    return(entries.Entry);
                }
                else
                {
                    int             totalRecordsCount = 0;
                    CatalogEntryDto entries           = CatalogContext.Current.FindItemsDto(Parameters, Options, ref totalRecordsCount, ResponseGroup);

                    if (totalRecordsCount > 0)
                    {
                        arguments.TotalRowCount = totalRecordsCount;
                        return(entries.CatalogEntry.Rows);
                    }
                    else
                    {
                        arguments.TotalRowCount = 0;
                        return(null);
                    }
                }
            }
Exemplo n.º 3
0
 protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
 {
     DataSourceSelectArguments ee = new DataSourceSelectArguments();
     DataView tmp = (DataView)this.SqlDataSource4.Select(ee);
     Response.Cookies["PapID"].Value = tmp[0][1].ToString();   //从sqldatasource获得列值
     Response.Redirect("Paper.aspx");
 }
Exemplo n.º 4
0
            /// <summary>
            /// Gets a list of data from the underlying data storage.
            /// </summary>
            /// <param name="arguments">A <see cref="T:System.Web.UI.DataSourceSelectArguments"/> that is used to request operations on the data beyond basic data retrieval.</param>
            /// <returns>
            /// An <see cref="T:System.Collections.IEnumerable"/> list of data from the underlying data storage.
            /// </returns>
            protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
            {
                Options.RecordsToRetrieve = arguments.MaximumRows;
                Options.StartingRecord    = arguments.StartRowIndex;

                int    totalRecordsCount = 0;
                LogDto dto = new LogDto();

                if (this.DataMode == ApplicationLogDataMode.ApplicationLog)
                {
                    dto = LogManager.GetAppLog(Parameters.SourceKey, Parameters.Operation, Parameters.ObjectType, Parameters.Created, Options.StartingRecord, Options.RecordsToRetrieve, ref totalRecordsCount);
                }
                else
                {
                    dto = LogManager.GetSystemLog(Parameters.Operation, Parameters.ObjectType, Parameters.Created, Options.StartingRecord, Options.RecordsToRetrieve, ref totalRecordsCount);
                }

                if (totalRecordsCount > 0)
                {
                    arguments.TotalRowCount = totalRecordsCount;
                    return(dto.ApplicationLog.Rows);
                }
                else
                {
                    arguments.TotalRowCount = 0;
                    return(null);
                }
            }
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments selectArgs)
        {
            // only continue if a membership provider has been configured
            if (!Utils.IsProviderConfigured())
            {
                return(null);
            }

            // get roles and build data table
            DataTable dataTable = new DataTable();

            String[] roles = Utils.BaseRoleProvider().GetAllRoles();
            dataTable.Columns.Add("Role");
            dataTable.Columns.Add("UsersInRole");

            // add users in role counts
            for (int i = 0; i < roles.Length; i++)
            {
                DataRow row = dataTable.NewRow();
                row["Role"]        = roles[i];
                row["UsersInRole"] = Utils.BaseRoleProvider().GetUsersInRole(roles[i].ToString()).Length;
                dataTable.Rows.Add(row);
            }
            dataTable.AcceptChanges();
            DataView dataView = new DataView(dataTable);

            // sort if a sort expression available
            if (selectArgs.SortExpression != String.Empty)
            {
                dataView.Sort = selectArgs.SortExpression;
            }

            // return as a DataList
            return((IEnumerable)dataView);
        }
Exemplo n.º 6
0
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            DataTable queryTable   = ((DataView)base.ExecuteSelect(arguments)).Table;
            DataTable sessionTable = (DataTable)session[owner.DataSourceSessionKey];

            InitPrimaryKey(queryTable);

            if (owner.RevertToOriginalDataSource)
            {
                RaiseOnSelected(queryTable.DefaultView.Count);
                return(queryTable.DefaultView);
            }

            DataTable result;

            if (sessionTable == null)
            {
                sessionTable = queryTable.Copy();
                InitPrimaryKey(sessionTable);
                session[owner.DataSourceSessionKey] = sessionTable;
                result = sessionTable;
            }
            else
            {
                result = SmartMerge(sessionTable, queryTable);
            }

            DataView view = result.DefaultView;

            view.Sort = arguments.SortExpression;
            RaiseOnSelected(view.Count);
            return(view);
        }
Exemplo n.º 7
0
        protected void OkBtn_Click(object sender, EventArgs e)
        {
            DataSourceSelectArguments pArguments = new DataSourceSelectArguments();

            SqlDominio.Select(pArguments);
            DomainList.DataBind();
        }
Exemplo n.º 8
0
        public void ListView_CreateDataSourceSelectArguments()
        {
            var lvp = new ListViewPoker();
            DataSourceSelectArguments args = lvp.DoCreateDataSourceSelectArguments();

            Assert.IsTrue(args != null, "#A1");
        }
Exemplo n.º 9
0
        protected override DataSourceSelectArguments CreateDataSourceSelectArguments()
        {
            DataSourceSelectArguments dataSourceSelectArguments = base.CreateDataSourceSelectArguments();

            //CHECK WHETHER A SORT EXPRESSION IS PRESENT
            if (string.IsNullOrEmpty(dataSourceSelectArguments.SortExpression))
            {
                if (!string.IsNullOrEmpty(this.DefaultSortExpression) && (System.Web.HttpContext.Current != null))
                {
                    dataSourceSelectArguments.SortExpression = this.DefaultSortExpression;
                    if (this.DefaultSortDirection == SortDirection.Descending)
                    {
                        dataSourceSelectArguments.SortExpression += " DESC";
                    }
                    ActiveSortColumn    = this.DefaultSortExpression;
                    ActiveSortDirection = this.DefaultSortDirection;
                }
            }
            else
            {
                ActiveSortColumn    = this.SortExpression;
                ActiveSortDirection = this.SortDirection;
            }
            return(dataSourceSelectArguments);
        }
Exemplo n.º 10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DataSourceSelectArguments ee = new DataSourceSelectArguments();
            DataView tmp = (DataView)this.SqlDataSource1.Select(ee);

            //TextBox1.Text= tmp[0][1].ToString();
            name     = TextBox1.Text;
            password = TextBox2.Text;

            int i = 0;

            for (; i < tmp.Count; i++)
            {
                if (tmp[i][1].ToString().Equals(name))
                {
                    break;
                }
            }
            if (i == tmp.Count)
            {
                Response.Write("<script>alert('该用户不存在')</script>");
            }
            else if (tmp[i][2].ToString().Equals(password))
            {
                Session["name"]      = TextBox1.Text.Trim();
                Session["headPhoto"] = tmp[i][6];
                Response.Redirect("index.aspx", true);
            }
            else
            {
                Response.Write("<script>alert('密码错误请重新输入!')</script>");
            }
        }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrEmpty(Request.QueryString["c"]))
                Response.Redirect("Default.aspx");

            DataSourceSelectArguments args  =new DataSourceSelectArguments();
            MapDataSource.SelectParameters.Add("Category", Request.QueryString["c"]);
            DataView dvMap = (DataView)MapDataSource.Select(args);

            DataView dvSubmission;
            string score;

            foreach (System.Data.DataRow row in dvMap.Table.Rows)
            {
                SubmissionSource.SelectParameters.Clear();
                SubmissionSource.SelectParameters.Add("Question", row["Question"].ToString());
                SubmissionSource.SelectParameters.Add("Username", Membership.GetUser().UserName);
                dvSubmission = (DataView)SubmissionSource.Select(args);
                string theme = "danger";
                score = "";
                int value=0;
                if (dvSubmission.Table.Rows.Count > 0)
                {
                    score = "Score: "+dvSubmission.Table.Rows[0]["Score"].ToString()+"/100";
                    value = Convert.ToInt32(dvSubmission.Table.Rows[0]["Score"]);
                    if (value == 100)
                        theme = "success";
                    else if (value >= 50)
                        theme = "info";
                    else
                        theme = "warning";
                }
                populate.InnerHtml +=
                    "<div class=\"col-lg-4\">" +
                    "<div class=\"panel panel-"+theme+"\">" +
                        "<div class=\"panel-heading\"><label>" +
                            row["QuestionName"].ToString() +
                        "</label></div>" +
                        "<div class=\"panel-body\">" +
                           "<div class=\"progress progress-striped active\">"+
                                "<div class=\"progress-bar progress-bar-" + theme + "\" role=\"progressbar\" aria-valuenow=\"" + value + "\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:" + value + "%\">" +
                                    "<span class=\"sr-only\"><span>"+score+"</span>% Complete (success)</span>"+
                                "</div>"+
                            "</div>"+

                           "<button onclick=\"location.href=\'Challange.aspx?p=" + row["Question"].ToString() + "'\" type=\"button\" class=\"btn btn-" + theme + "\" style=\"float:right;\">Go to Question</button>" +
                           "<h5 style=\"font-weight:bold\">" + score + "</h5>" +
                           "</div>" +
                        "<div class=\"panel-footer\" style=\"overflow:hidden;\">" +
                            "<button onclick=\"location.href=\'Leaderboard.aspx?p=" + row["Question"].ToString() + "'\" type=\"button\" class=\"btn btn-outline btn-"+theme+"\">Leaderboard</button>" +
                        "</div>" +
                    "</div>" +
                "</div>";
                /*
                 * */
            }
        }
    }
Exemplo n.º 12
0
        private static IOrderedDictionary MergeSelectParameters(DataSourceSelectArguments arguments)
        {
            bool shouldPage = arguments.StartRowIndex >= 0 && arguments.MaximumRows > 0;
            bool shouldSort = !String.IsNullOrEmpty(arguments.SortExpression);
            // Copy the parameters into a case insensitive dictionary
            IOrderedDictionary mergedParameters = new OrderedDictionary(StringComparer.OrdinalIgnoreCase);

            // Add the sort expression as a parameter if necessary
            if (shouldSort)
            {
                mergedParameters[SortParameterName] = arguments.SortExpression;
            }

            // Add the paging arguments as parameters if necessary
            if (shouldPage)
            {
                // Create a new dictionary with the paging information and merge it in (so we get type conversions)
                IDictionary pagingParameters = new OrderedDictionary(StringComparer.OrdinalIgnoreCase);
                pagingParameters[MaximumRowsParameterName]   = arguments.MaximumRows;
                pagingParameters[StartRowIndexParameterName] = arguments.StartRowIndex;
                pagingParameters[TotalRowCountParameterName] = 0;
                MergeDictionaries(pagingParameters, mergedParameters);
            }

            return(mergedParameters);
        }
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            _arguments = arguments;

            LinqToSqlDataSourceEventArgs <TEntity> eventArgs = new LinqToSqlDataSourceEventArgs <TEntity>
            {
                Query = _owner.DataContext.GetTable <TEntity>()
            };

            _owner.OnSelect(eventArgs);

            if (eventArgs.Query == null)
            {
                eventArgs.Query = _owner.DataContext.GetTable <TEntity>();
            }

            IEnumerable <TEntity> result = (eventArgs.QueryExpr != null) ? eventArgs.Query.Where(eventArgs.QueryExpr) : eventArgs.Query;

            arguments.TotalRowCount = result.Count();
            if (arguments.MaximumRows > 0 && arguments.StartRowIndex >= 0)
            {
                return(result.Skip(arguments.StartRowIndex).Take(arguments.MaximumRows));
            }
            else
            {
                return(result);
            }
        }
Exemplo n.º 14
0
    protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
    {
        IEnumerable dataSource = base.ExecuteSelect(arguments);

        // TODO: do your stuff here
        return(dataSource);
    }
        public static IEnumerable <TRow> Select <TKey, TTable, TDataContext, TRow>(
            this BaseDataSourceView <TKey, TTable, TDataContext, TRow> view,
            StoreReadDataEventArgs e,
            BaseFilterControl <TKey, TTable, TDataContext> filter,
            GridFilters gridFilter,
            BaseGridColumns columns,
            bool sort)
            where TKey : struct
            where TTable : class
            where TDataContext : DataContext, new()
            where TRow : BaseRow, new()
        {
            var dataSourceSelectArguments = new DataSourceSelectArguments(e.Start, e.Limit);

            dataSourceSelectArguments.RetrieveTotalRowCount = true;

            if (sort && e.Sort != null && e.Sort.Length > 0)
            {
                dataSourceSelectArguments.SortExpression = GetSortExpression(columns, e.Sort);
            }

            IEnumerable result = null;

            view.Select(dataSourceSelectArguments, data => { result = data; });
            e.Total = dataSourceSelectArguments.TotalRowCount;

            return(result.Cast <TRow>());
        }
Exemplo n.º 16
0
        protected void btnUpdateShip_Click(object sender, EventArgs e)
        {
            LinkButton  btn = sender as LinkButton;
            GridViewRow row = btn.NamingContainer as GridViewRow;
            string      pk  = GridViewSalesOrder.DataKeys[row.RowIndex].Values[0].ToString();

            Session["Quotation_number"] = pk;

            SqlData.SelectCommand = "SELECT Quotes_ID From Quotes where ISNULL(Is_InventoryUpd,0) = 'false' and Quotes.Quotation_Number='" + pk + "'";
            DataSourceSelectArguments dsArguments = new DataSourceSelectArguments();
            DataView dvView = new DataView();

            dvView = (DataView)SqlData.Select(dsArguments);
            int count = dvView.Count;

            if (count == 0)
            {
                SqlQuotationUpdate.UpdateParameters["Is_Shipped"].DefaultValue       = "TRUE";
                SqlQuotationUpdate.UpdateParameters["Shipment_Date"].DefaultValue    = System.DateTime.Today.ToShortDateString();
                SqlQuotationUpdate.UpdateParameters["Quotation_Number"].DefaultValue = pk;
                SqlQuotationUpdate.Update();
                GridViewSalesOrder.DataBind();
            }
            else
            {
                Response.Redirect("Ships.aspx");
            }
        }
Exemplo n.º 17
0
        protected void btnMoveStockMovement_Click(object sender, EventArgs e)
        {
            string strBatchID     = ProductRMDownList.SelectedValue;
            string strWarehouseID = FromWarehouseDropDownList.SelectedValue;
            string strLocationID  = FromLocationDropDownList.SelectedValue;
            string strIsProduct   = rbStockMovement.SelectedValue;

            SqlData.SelectCommand = "SELECT  StockPile.Quantity, StockPile.Created_Date FROM StockPile INNER JOIN FinishedProduct ON FinishedProduct.Batch_ID = StockPile.Batch_ID AND StockPile.Batch_ID ='" + strBatchID + "' AND StockPile.Warehouse_ID ='" + strWarehouseID + "' AND StockPile.Location_ID ='" + strLocationID + "' INNER JOIN Product ON FinishedProduct.Product_ID = Product.Product_ID INNER JOIN Location ON StockPile.Location_ID = Location.Location_ID";
            DataSourceSelectArguments dsArguments = new DataSourceSelectArguments();
            DataView dvView = new DataView();

            SqlStockPile.InsertParameters["Batch_ID"].DefaultValue     = ProductRMDownList.SelectedValue;
            SqlStockPile.InsertParameters["Warehouse_ID"].DefaultValue = TowarehouseDropDownList.SelectedValue;
            SqlStockPile.InsertParameters["Location_ID"].DefaultValue  = ToLocationDropDownList.SelectedValue;
            SqlStockPile.InsertParameters["Quantity"].DefaultValue     = ToQuantityTextBox.Text.Trim();
            SqlStockPile.InsertParameters["Created_Date"].DefaultValue = System.DateTime.Now.ToShortDateString();
            SqlStockPile.InsertParameters["Is_Product"].DefaultValue   = rbStockMovement.SelectedValue;
            SqlStockPile.Insert();

            dvView = (DataView)SqlData.Select(dsArguments);
            string strQty         = dvView[0].Row["Quantity"].ToString();
            string strCreatedDate = dvView[0].Row["Created_Date"].ToString();

            int intQty   = Convert.ToInt32(strQty);
            int intToQty = Convert.ToInt32(ToQuantityTextBox.Text);

            if (intToQty != intQty)
            {
                dsArguments           = new DataSourceSelectArguments();
                dvView                = new DataView();
                SqlData.SelectCommand = "SELECT Entry_ID from StockPile where Batch_ID ='" + strBatchID + "' AND Warehouse_ID ='" + strWarehouseID + "' AND Location_ID ='" + strLocationID + "' AND Quantity ='" + strQty + "' and Is_Product ='" + strIsProduct + "'";
                dvView                = (DataView)SqlData.Select(dsArguments);
                string EntryID = dvView[0].Row["Entry_ID"].ToString();
                SqlStockPile.UpdateParameters["Batch_ID"].DefaultValue     = ProductRMDownList.SelectedValue;
                SqlStockPile.UpdateParameters["Warehouse_ID"].DefaultValue = FromWarehouseDropDownList.SelectedValue;
                SqlStockPile.UpdateParameters["Location_ID"].DefaultValue  = FromLocationDropDownList.SelectedValue;
                SqlStockPile.UpdateParameters["Quantity"].DefaultValue     = Convert.ToString(intQty - intToQty);
                SqlStockPile.UpdateParameters["Created_Date"].DefaultValue = strCreatedDate;
                SqlStockPile.UpdateParameters["Is_Product"].DefaultValue   = rbStockMovement.SelectedValue;
                SqlStockPile.UpdateParameters["Entry_ID"].DefaultValue     = EntryID;
                SqlStockPile.Update();
            }
            else
            {
                SqlData.SelectCommand = "SELECT Entry_ID from StockPile where Batch_ID ='" + strBatchID + "' AND Warehouse_ID ='" + strWarehouseID + "' AND Location_ID ='" + strLocationID + "' AND Quantity ='" + strQty + "' and Is_Product ='" + strIsProduct + "'";
                dvView = (DataView)SqlData.Select(dsArguments);
                string EntryID = dvView[0].Row["Quantity"].ToString();
                SqlStockPile.SelectCommand = "DELETE FROM [StockPile] WHERE [Entry_ID] ='" + EntryID;
                SqlStockPile.Delete();
            }


            gvStockMovement.DataBind();
            PaneladdStockMovement.Visible = false;
            Panel1.Visible = false;
            PanelgvStockMovement.Visible          = true;
            TowarehouseDropDownList.SelectedIndex = -1;
            ToQuantityTextBox.Text = String.Empty;
            ToLocationDropDownList.SelectedIndex = -1;
        }
Exemplo n.º 18
0
        public void GetSelectArguments()
        {
            PokerS p = new PokerS();
            DataSourceSelectArguments arg = p.GetSelectArguments();

            Assert.AreEqual("SortExp", arg.SortExpression, "GetSelectArguments");
        }
Exemplo n.º 19
0
        public IQueryable <ClubCloud_Baansoort> SelectBaansoorten(string sortByExpression, int startRowIndex, int maximumRows, out int totalRowCount)//, bool retrieveTotalRowCount = true)
        {
            using (new SPMonitoredScope("Baansoorten SelectBaansoorten"))
            {
                if (SPContext.Current.Web.CurrentUser != null)
                {
                    int bondsnummer;
                    ClubCloud_Setting Settings = null;
                    if (int.TryParse(SPContext.Current.Web.CurrentUser.UserId.NameId, out bondsnummer))
                    {
                        Settings = Client.GetSettingById(bondsnummer);
                    }

                    if (Settings != null && Settings.VerenigingId != null)
                    {
                        List <Parameter> collection = new List <Parameter>();


                        foreach (Parameter where in WhereParameters)
                        {
                            if (collection.Any(w => w.Name == where.Name))
                            {
                                int index = collection.FindIndex(p => p.Name == where.Name);
                                if (index >= 0)
                                {
                                    collection[index] = where;
                                }
                            }
                            else
                            {
                                collection.Add(where);
                            }
                        }

                        DataSourceSelectArguments selectArgs = new DataSourceSelectArguments {
                            MaximumRows = maximumRows, StartRowIndex = startRowIndex, RetrieveTotalRowCount = true, SortExpression = sortByExpression
                        };
                        ClubCloud_Baansoort_View queryresult = Client.GetBaansoortenByQuery(bondsnummer.ToString(), Settings.VerenigingId.Value, new DataSourceSelectArguments {
                            MaximumRows = maximumRows, StartRowIndex = startRowIndex, RetrieveTotalRowCount = true, SortExpression = sortByExpression
                        }, collection);

                        totalRowCount = queryresult.TotalRowCount;


                        if (totalRowCount > 0)
                        {
                            foreach (ClubCloud_Baansoort Baansoort in queryresult.ClubCloud_Baansoort)
                            {
                                Baansoort.ClubCloud_Baantype = Client.GetBaantypeForBaansoortById(Baansoort.Id, false, Settings);
                                Baansoort.ClubCloud_Baanblok = new System.Collections.ObjectModel.ObservableCollection <ClubCloud_Baanblok>(Client.GetBaanblokkenForBaansoortById(Baansoort.Id, false, Settings));
                            }
                        }
                        return(queryresult.ClubCloud_Baansoort.AsQueryable <ClubCloud_Baansoort>());
                    }
                }
            }

            totalRowCount = 0;
            return(null);
        }
Exemplo n.º 20
0
        public void Equals()
        {
            DataSourceSelectArguments arg1 = new DataSourceSelectArguments();
            DataSourceSelectArguments arg2 = DataSourceSelectArguments.Empty;

            Assert.IsTrue(arg1.Equals(arg2), "Equals#1");
            Assert.IsTrue(arg1.GetHashCode() == arg2.GetHashCode(), "GetHashCode#1");

            arg1.SortExpression        = "sort";
            arg1.MaximumRows           = 10;
            arg1.StartRowIndex         = 5;
            arg1.RetrieveTotalRowCount = true;
            arg1.TotalRowCount         = 30;

            Assert.IsFalse(arg1.Equals(arg2), "Equals#2");
            Assert.IsFalse(arg1.GetHashCode() == arg2.GetHashCode(), "GetHashCode#2");

            arg2.SortExpression = "sort";
            arg2.MaximumRows    = 10;
            arg2.StartRowIndex  = 5;

            Assert.IsFalse(arg1.Equals(arg2), "Equals#3");
            Assert.IsFalse(arg1.GetHashCode() == arg2.GetHashCode(), "GetHashCode#3");

            arg2.RetrieveTotalRowCount = true;
            arg2.TotalRowCount         = 30;

            Assert.IsTrue(arg1.Equals(arg2), "Equals#4");
            Assert.IsTrue(arg1.GetHashCode() == arg2.GetHashCode(), "GetHashCode#4");
        }
        protected IEnumerable <string> GetLogicalNames(DataSourceSelectArguments args, IDictionary parameters)
        {
            if (!string.IsNullOrEmpty(Owner.LogicalNames))
            {
                var values = Owner.LogicalNames.Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray();

                if (values.Any())
                {
                    return(values);
                }
            }

            var parameter = parameters["LogicalNames"];

            if (parameter != null)
            {
                if (parameter is IEnumerable <string> )
                {
                    return((parameter as IEnumerable <string>).ToArray());
                }

                var values = parameter.ToString().Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray();

                if (values.Any())
                {
                    return(values);
                }
            }

            return(Enumerable.Empty <string>());
        }
Exemplo n.º 22
0
    protected void btnAddCatManJob_Click(object sender, EventArgs e)
    {
        string vettedCreateJobText = Regex.Replace(txtCreateJob.Text.ToLower(), @"[\s]+", "");

        try
        {
            if (vettedCreateJobText != null && vettedCreateJobText != "" && vettedCreateJobText.Length <= 50)
            {
                sds.ConnectionString = Resources.ConnectionStrings.ATHENA;

                sds.SelectCommand = Resources.CatalogManagerSQLQueries.VerifyRegexSelect;
                DataSourceSelectArguments dssa = new DataSourceSelectArguments();
                dssa.AddSupportedCapabilities(DataSourceCapabilities.RetrieveTotalRowCount);
                dssa.RetrieveTotalRowCount = true;
                DataView dv = (DataView)sds.Select(dssa);

                if (dv.Count == 0)
                {
                    sds.InsertCommand = Resources.CatalogManagerSQLQueries.InsertCleanValues;
                    sds.Insert();

                    sds.UpdateCommand = Resources.CatalogManagerSQLQueries.UpdateJobs;
                    sds.Update();
                }
            }
            txtCreateJob.Text = String.Empty;
        }
        catch (InvalidCastException ex) { }
    }
Exemplo n.º 23
0
        protected internal override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            if (nodes == null)
            {
                DoXPathSelect();
            }

            ArrayList list = new ArrayList();
            int       max  = arguments.StartRowIndex + (arguments.MaximumRows > 0 ? arguments.MaximumRows : nodes.Count);

            if (max > nodes.Count)
            {
                max = nodes.Count;
            }

            for (int n = arguments.StartRowIndex; n < max; n++)
            {
                list.Add(new XmlDataSourceNodeDescriptor((XmlElement)nodes [n]));
            }

            if (arguments.RetrieveTotalRowCount)
            {
                arguments.TotalRowCount = nodes.Count;
            }

            return(list);
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["AId"] == null)
            {
                Response.Redirect("~/default.aspx");
            }

            cat_id = Request.QueryString.Get("cat_id").ToString();
            if (string.IsNullOrEmpty(cat_id))
            {
                Response.Redirect("category_add.aspx");
            }

            SqlDataSource SqlDataSource1 = new SqlDataSource();

            SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlDataSource1.SelectCommand    = "SELECT [category_id], [category_name] FROM [Category] WHERE [category_id] = @cat_id";
            SqlDataSource1.SelectParameters.Add("cat_id", cat_id);

            DataSourceSelectArguments args = new DataSourceSelectArguments();

            DataView dv   = SqlDataSource1.Select(args) as DataView;
            string   name = dv.Table.Rows[0][1].ToString();

            txtCateoryName.Text = name;
            dv.Dispose();
            SqlDataSource1.Dispose();
        }
Exemplo n.º 25
0
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            // return a DataTable containing the queried fields from each business object
            DataTable table = new DataTable();

            string tablename = metadata.Name.LocalName;

            string primaryKeyName = Caisis.BOL.BusinessObject.GetPrimaryKeyName(tablename);
            IEnumerable <string> foreignKeyNames = Caisis.BOL.BusinessObject.GetForeignKeyNames(tablename);

            // columns <- fieldnames from query
            // TraverseQueryFieldnames(metadata).Union(new string[] { primaryKeyName }.Concat(foreignKeyNames)).ForEach(s => table.Columns.Add(s));

            /*
             *          Caisis.BOL.BusinessObject.GetFieldNames(tablename).ForEach(s => table.Columns.Add(s));
             *
             *          // row <- queried path from each business object tree
             *          businessObjects.ForEach(b => table.Rows.Add(CopyRowData(SubPath(b, metadata), table.NewRow())));
             */
            // get ordered field names
            string[] fields = BOL.BusinessObject.GetFieldNames(tablename).ToArray();
            // add columns
            fields.ForEach(f => table.Columns.Add(f));
            // each bizo -> add bizo data to new row
            businessObjects.ForEach(b => table.Rows.Add(fields.Select(f => b[f]).ToArray()));

            return(table.DefaultView);
        }
Exemplo n.º 26
0
		protected internal override IEnumerable ExecuteSelect (
						DataSourceSelectArguments arguments)
		{
			oleCommand = new OleDbCommand (this.SelectCommand, oleConnection);
			SqlDataSourceSelectingEventArgs cmdEventArgs = new SqlDataSourceSelectingEventArgs (oleCommand, arguments);
			OnSelecting (cmdEventArgs);
			IEnumerable enums = null; 
			Exception exception = null;
			OleDbDataReader reader = null;
			try {
				System.IO.File.OpenRead (dataSource.DataFile).Close ();
				oleConnection.Open ();
				reader = (OleDbDataReader)oleCommand.ExecuteReader ();
			
				//enums = reader.GetEnumerator ();
				throw new NotImplementedException("OleDbDataReader doesnt implements GetEnumerator method yet");
			} catch (Exception e) {
				exception = e;
			}
			SqlDataSourceStatusEventArgs statusEventArgs = 
				new SqlDataSourceStatusEventArgs (oleCommand, reader.RecordsAffected, exception);
			OnSelected (statusEventArgs);
			if (exception !=null)
				throw exception;
			return enums;			
		}						
Exemplo n.º 27
0
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            IEnumerable result;

            if (null == this.source)
            {
                result = null;
            }
            else
            {
                DataTable table = new DataTable();
                table.Columns.Add("Key");
                table.Columns.Add("Name");
                foreach (string user in this.source.ListUsers(this.role))
                {
                    table.Rows.Add(new object[]
                    {
                        user,
                        user
                    });
                }
                result = table.Rows;
            }
            return(result);
        }
Exemplo n.º 28
0
            /// <summary>
            /// Gets a list of data from the underlying data storage.
            /// </summary>
            /// <param name="arguments">A <see cref="T:System.Web.UI.DataSourceSelectArguments"/> that is used to request operations on the data beyond basic data retrieval.</param>
            /// <returns>
            /// An <see cref="T:System.Collections.IEnumerable"/> list of data from the underlying data storage.
            /// </returns>
            protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
            {
                Options.RecordsToRetrieve = arguments.MaximumRows;
                Options.StartingRecord    = arguments.StartRowIndex;

                if (!String.IsNullOrEmpty(arguments.SortExpression))
                {
                    Parameters.OrderByClause = arguments.SortExpression;
                }

                int totalRecords = 0;

                OrderGroup[] orders = null;
                if (base.Name == CartsViewName)
                {
                    orders = OrderContext.Current.FindCarts(this.Parameters, this.Options, out totalRecords);
                }
                else if (base.Name == PaymentPlansViewName)
                {
                    orders = OrderContext.Current.FindPaymentPlans(this.Parameters, this.Options, out totalRecords);
                }
                else
                {
                    orders = OrderContext.Current.FindPurchaseOrders(this.Parameters, this.Options, out totalRecords);
                }

                arguments.TotalRowCount = totalRecords;
                return(orders);
            }
Exemplo n.º 29
0
 private static void GuardStartRowIndexNotNegative(DataSourceSelectArguments arguments)
 {
     if (arguments.StartRowIndex < 0)
     {
         throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.InvalidStartRowIndex, arguments.StartRowIndex));
     }
 }
Exemplo n.º 30
0
 private void SortDataForSelectIfNeeded(DataSourceSelectArguments arguments)
 {
     if (!(UsingServerSorting || String.IsNullOrEmpty(arguments.SortExpression)))
     {
         Data.Sort(new ObjectComparer(arguments.SortExpression, GetDataObjectType()));
     }
 }
Exemplo n.º 31
0
 public virtual void Select(DataSourceSelectArguments args)
 {
     if (null != this._dataSource)
     {
         this.DataSourceView.Select(args, new DataSourceViewSelectCallback(this.DataSourceSelectCallback));
     }
 }
Exemplo n.º 32
0
        protected internal override IEnumerable ExecuteSelect(
            DataSourceSelectArguments arguments)
        {
            oleCommand = new OleDbCommand(this.SelectCommand, oleConnection);
            SqlDataSourceSelectingEventArgs cmdEventArgs = new SqlDataSourceSelectingEventArgs(oleCommand, arguments);

            OnSelecting(cmdEventArgs);
            IEnumerable     enums     = null;
            Exception       exception = null;
            OleDbDataReader reader    = null;

            try {
                System.IO.File.OpenRead(dataSource.DataFile).Close();
                oleConnection.Open();
                reader = (OleDbDataReader)oleCommand.ExecuteReader();

                //enums = reader.GetEnumerator ();
                throw new NotImplementedException("OleDbDataReader doesnt implements GetEnumerator method yet");
            } catch (Exception e) {
                exception = e;
            }
            SqlDataSourceStatusEventArgs statusEventArgs =
                new SqlDataSourceStatusEventArgs(oleCommand, reader.RecordsAffected, exception);

            OnSelected(statusEventArgs);
            if (exception != null)
            {
                throw exception;
            }
            return(enums);
        }
Exemplo n.º 33
0
        /*private void GetUserInfo1()
         * {
         *  SqlDataSource SqlDataSource1 = new SqlDataSource();
         *  SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
         *
         *  SqlDataSource1.SelectCommand = @"SELECT [user_fname], [user_lname], [user_email], [user_ph_num], [user_addr1], [user_addr2], [user_city], [user_state], [user_country], [user_zip] FROM [UserInfo] WHERE [user_id] = @user_id";
         *
         *  SqlDataSource1.SelectParameters.Add("user_id", Session["Id"].ToString());
         *
         *
         *  DataSourceSelectArguments args = new DataSourceSelectArguments();
         *  DataView dv = SqlDataSource1.Select(args) as DataView;
         *  string fname = dv.Table.Rows[0]["user_fname"].ToString();
         *  string lname = dv.Table.Rows[0]["user_lname"].ToString();
         *  customerName = fname + " " + lname;
         *  Session["fullname"] = customerName;
         *  dv.Dispose();
         *
         *
         *  FormView1.DataSource = SqlDataSource1;
         *  FormView1.DataBind();
         *
         *  SqlDataSource1.Dispose();
         *
         * }*/

        private void GetUserInfo2()
        {
            SqlDataSource SqlDataSource1 = new SqlDataSource();

            SqlDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            SqlDataSource1.SelectCommand = @"SELECT [user_fname], [user_lname], [user_email], [user_ph_num], [user_addr1], [user_addr2], [user_city], [user_state], [user_country], [user_zip] FROM [UserInfo] WHERE [user_id] = @user_id";

            SqlDataSource1.SelectParameters.Add("user_id", Session["Id"].ToString());


            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView dv    = SqlDataSource1.Select(args) as DataView;
            string   fname = dv.Table.Rows[0]["user_fname"].ToString();
            string   lname = dv.Table.Rows[0]["user_lname"].ToString();

            customerName        = fname + " " + lname;
            Session["fullname"] = customerName;
            dv.Dispose();


            FormView2.DataSource = SqlDataSource1;
            FormView2.DataBind();

            SqlDataSource1.Dispose();
        }
Exemplo n.º 34
0
        public void Empty()
        {
            DataSourceSelectArguments arg1 = DataSourceSelectArguments.Empty;
            DataSourceSelectArguments arg2 = DataSourceSelectArguments.Empty;

            Assert.IsFalse(Object.ReferenceEquals(arg1, arg2), "Not Cached instance");
        }
Exemplo n.º 35
0
    private void GetProductList()
    {
        DataSourceSelectArguments arg = new DataSourceSelectArguments();
        pds.DataSource = (DataView)isNew.Select(arg);
        pds.AllowPaging = true;
        pds.PageSize = 12;

        for (int i = 0; i < pds.PageCount; i++)
        {
            listPage1.Items.Add((i + 1).ToString());
        }
        if (Request.QueryString["page"] == null)
        {
            currentIndex = 1;
        }
        else
        {
            currentIndex = Convert.ToInt16(Request.QueryString["page"].ToString());
        }
        foreach (ListItem l in listPage1.Items)
        {
            if (l.ToString() == currentIndex.ToString().Trim())
            {
                listPage1.SelectedValue = currentIndex.ToString().Trim();
            }
        }

        pds.CurrentPageIndex = currentIndex - 1;
        if (!pds.IsFirstPage)
        {
            if (Request.Url.ToString().IndexOf("?") > 0)
            {
                btnFirst1.NavigateUrl = string.Format(Request.Url.ToString().Replace("page", "nothing") + "&page={0}", 1);
                btnUp1.NavigateUrl = string.Format(Request.Url.ToString().Replace("page", "nothing") + "&page={0}", currentIndex - 1);
            }
            else
            {
                btnFirst1.NavigateUrl = string.Format(Request.Url.ToString() + "?page={0}", 1);
                btnUp1.NavigateUrl = string.Format(Request.Url.ToString() + "?page={0}", currentIndex - 1);
            }
        }
        if (!pds.IsLastPage)
        {
            if (Request.Url.ToString().IndexOf("?") > 0)
            {
                btnDown1.NavigateUrl = string.Format(Request.Url.ToString().Replace("page", "nothing") + "&page={0}", currentIndex + 1);
                btnLast1.NavigateUrl = string.Format(Request.Url.ToString().Replace("page", "nothing") + "&page={0}", pds.PageCount);
            }
            else
            {
                btnDown1.NavigateUrl = string.Format(Request.Url.ToString() + "?page={0}", currentIndex + 1);
                btnLast1.NavigateUrl = string.Format(Request.Url.ToString() + "?page={0}", pds.PageCount);
            }
        }
        this.yeci1.InnerHtml = currentIndex.ToString() + "/" + pds.PageCount.ToString();

        DataList1.DataSource = pds;
        DataList1.DataBind();
    }
 internal EntityDataSourceSelectedEventArgs(ObjectContext context, 
                                            IEnumerable results, 
                                            int totalRowCount, 
                                            DataSourceSelectArguments selectArgs)
 {
     _context = context;
     _results = results;
     _totalRowCount = totalRowCount;
     _selectArguments = selectArgs;
 }
 public LinqDataSourceSelectEventArgs(DataSourceSelectArguments arguments,
         IDictionary<string, object> whereParameters, IOrderedDictionary orderByParameters,
         IDictionary<string, object> groupByParameters, IDictionary<string, object> orderGroupsByParameters,
         IDictionary<string, object> selectParameters) {
     _arguments = arguments;
     _groupByParameters = groupByParameters;
     _orderByParameters = orderByParameters;
     _orderGroupsByParameters = orderGroupsByParameters;
     _selectParameters = selectParameters;
     _whereParameters = whereParameters;
 }
    protected void btnHae_Click(object sender, EventArgs e)
    {
        DataSourceSelectArguments args = new DataSourceSelectArguments("asioid, lastname, firstname, date");

        DataView dv = (DataView)srcIlmot.Select(args);

        dv.RowFilter = "lastname LIKE '" + txtName.Text + "%'";

        Gridview1.DataSourceID = "";
        Gridview1.DataSource = dv;
        Gridview1.DataBind();
    }
		protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
		{
			ArrayList list = new ArrayList ();
			int max = arguments.StartRowIndex + (arguments.MaximumRows > 0 ? arguments.MaximumRows : nodes.Count);
			if (max > nodes.Count) max = nodes.Count;

			for (int n = arguments.StartRowIndex; n < max; n++)
				list.Add (new XmlDataSourceNodeDescriptor ((XmlElement) nodes [n]));
				
			if (arguments.RetrieveTotalRowCount)
				arguments.TotalRowCount = nodes.Count;

			return list;
		}		
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DataTable dt = new DataTable();

            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView view = (DataView)SqlDataSource2.Select(args);
            dt = view.ToTable();

            dt.DefaultView.RowFilter = "maa = '" + DropDownList1.SelectedItem.ToString() + "'";
            GridView1.DataSource = dt;
            GridView1.DataSourceID = null;
            GridView1.DataBind();
        }
        catch (Exception es)
        {

            txtError.Text = es.Message;
        }
    }
Exemplo n.º 41
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView view = (DataView)SqlDataSource1.Select(args);
            DataTable dt = view.ToTable();
            int columnNumber = 0;  //Currency Column
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i][columnNumber].ToString() == ListBox1.SelectedValue)
                {
                    decimal dollars = Convert.ToDecimal(TextBox1.Text);
                    decimal rate = Convert.ToDecimal(dt.Rows[i][1]);
                    decimal amount = dollars * rate;
                    Label1.Text = amount.ToString("f2");
                    Label1.Visible = true;
                    Label2.Text = "";
                    Label3.Text = "";
                    TextBox1.Text = "";
                    TextBox2.Text = "";
                    TextBox3.Text = "";
                    TextBox4.Text = "";
                    break;
                }
            }

        }
        catch (FormatException)
        {
            Label1.Text = "Error";
            Label1.Visible = true;
            Label2.Text = "";
            Label3.Text = "";
            TextBox1.Text = "";
            TextBox2.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
        }
    }
    protected void ddl_College_FiscalYear_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddl_fiscalyear.SelectedIndex > 0 && ddl_College.SelectedIndex > 0)
        {
            pan_Acc.Visible = true;
            DataSourceSelectArguments dssa = new DataSourceSelectArguments();
            dssa.AddSupportedCapabilities(DataSourceCapabilities.RetrieveTotalRowCount);
            dssa.RetrieveTotalRowCount = true;
            DataView dv = (DataView)SQLDS_Accountablity.Select(dssa);

            Label1.Text = dv.Table.Rows[0][0].ToString();
            hf_Accountability_Id.Value = dv.Table.Rows[0][0].ToString();
            lbl_Acc_Id.Text = dv.Table.Rows[0][0].ToString();
            txt_Note.Text = dv.Table.Rows[0][4].ToString();

            //ds_Level.DataBind();
            dv = (DataView)ds_Level.Select(dssa);
            lbl_Level.Text = dv.Table.Rows[0][1].ToString();
            hf_Level_Id.Value = dv.Table.Rows[0][0].ToString();

            ddl_Acct_Next_Level.DataBind();

            //ds_Acc_Narr.DataBind();
            //SqlDS_Gender.DataBind();
            //SqlDS_Race.DataBind();
            //ds_2p1_Spec_Pop.DataBind();
            //ds_3p1_Spec_Pop.DataBind();
            //ds_4p1_Spec_Pop.DataBind();
            //ds_5p1_Spec_Pop.DataBind();
            //ds_5p2_Spec_Pop.DataBind();
            //ds_Enrollment.DataBind();

            rg_Narratives.DataBind();
            rg_Enrollment.DataBind();
        }
        else
            pan_Acc.Visible = false;
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            String haku = txtSearch.Text;

            DataTable dt = new DataTable();

            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView view = (DataView)SqlDataSource1.Select(args);
            dt = view.ToTable();

            dt.DefaultView.RowFilter = "asnimi like '%" + haku + "%' OR yhteyshlo like '%" + haku + "%'";
            GridView1.DataSource = dt;
            GridView1.DataSourceID = null;
            GridView1.DataBind();
        }
        catch (Exception es)
        {

            txtError.Text = es.Message;
        }
    }
	public virtual void Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) {}
		protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
		{
			arguments.RaiseUnsupportedCapabilitiesError (this);

			IOrderedDictionary paramValues = MergeParameterValues (SelectParameters, null, null);
			ObjectDataSourceSelectingEventArgs args = new ObjectDataSourceSelectingEventArgs (paramValues, arguments, false);

			object result = null;

			if (owner.EnableCaching)
				result = owner.Cache.GetCachedObject (SelectMethod, SelectParameters);

			if (result == null) {
				OnSelecting (args);
				if (args.Cancel)
					return new ArrayList ();
				
				if (CanPage) {
					if (StartRowIndexParameterName.Length == 0)
						throw new InvalidOperationException ("Paging is enabled, but the StartRowIndexParameterName property is not set.");
					if (MaximumRowsParameterName.Length == 0)
						throw new InvalidOperationException ("Paging is enabled, but the MaximumRowsParameterName property is not set.");
					paramValues [StartRowIndexParameterName] = arguments.StartRowIndex;
					paramValues [MaximumRowsParameterName] = arguments.MaximumRows;
				}

				if (SortParameterName.Length > 0)
					paramValues [SortParameterName] = arguments.SortExpression;

				result = InvokeSelect (SelectMethod, paramValues);

				if (CanRetrieveTotalRowCount && arguments.RetrieveTotalRowCount)
					arguments.TotalRowCount = QueryTotalRowCount (MergeParameterValues (SelectParameters, null, null), arguments);
				
				if (owner.EnableCaching)
					owner.Cache.SetCachedObject (SelectMethod, SelectParameters, result);
			}

			if (FilterExpression.Length > 0 && !(result is DataGrid || result is DataView || result is DataTable))
				throw new NotSupportedException ("The FilterExpression property was set and the Select method does not return a DataSet, DataTable, or DataView.");

			if (owner.EnableCaching && result is IDataReader)
				throw new NotSupportedException ("Data source does not support caching objects that implement IDataReader");
			
			if (result is DataSet) {
				DataSet dset = (DataSet) result;
				if (dset.Tables.Count == 0)
					throw new InvalidOperationException ("The select method returnet a DataSet which doesn't contain any table.");
				result = dset.Tables [0];
			}
			
			if (result is DataTable) {
				DataView dview = new DataView ((DataTable)result);
				if (arguments.SortExpression != null && arguments.SortExpression.Length > 0) {
					dview.Sort = arguments.SortExpression;
				}
				if (FilterExpression.Length > 0) {
					IOrderedDictionary fparams = FilterParameters.GetValues (context, owner);
					ObjectDataSourceFilteringEventArgs fargs = new ObjectDataSourceFilteringEventArgs (fparams);
					OnFiltering (fargs);
					if (!fargs.Cancel) {
						object[] formatValues = new object [fparams.Count];
						for (int n=0; n<formatValues.Length; n++) {
							formatValues [n] = fparams [n];
							if (formatValues [n] == null) return dview;
						}
						dview.RowFilter = string.Format	(FilterExpression, formatValues);
					}
				}
				return dview;
			}
			
			if (result is IEnumerable)
				return (IEnumerable) result;
			else
				return new object[] {result};
		}
    protected void ReloadData()
    {
        DataView dv1 = (DataView)sqlds_accountablityCheck.Select(DataSourceSelectArguments.Empty);
            DataSet rowcountds = dv1.Table.DataSet.Copy();
            if (rowcountds.Tables[0].Rows[0][0].ToString() == "0")
            {
                btnCreate.Visible = true;

                lbl_Acc_Id.Text = "";
                lbl_Acc_Id.Visible = false;
                txt_Note.Visible = false;
                lbl_Level.Visible = false;
                hf_Level_Id.Visible = false;
                ddl_Acct_Next_Level.Visible = false;
                btn_Save.Visible = false;
                Label3.Visible = false;
                Label4.Visible = false;
                Label5.Visible = false;
                Label6.Visible = false;
                HL_Errors.Visible = false;
                HL_RPLIST.Visible = false;
                lnkSubmit.Visible = false;
                if (Session[Session.SessionID + "roleid"].ToString() != "101")
                {
                    btnCreate.Visible = false;
                }
                else
                {
                    btnCreate.Visible = true;
                }

                lbl_error.Visible = true;
            }
            else
            {
                btnCreate.Visible = false;
                lbl_error.Visible = false;
                if (ddl_fiscalyear.SelectedIndex > 0)
                {
                    SQLDS_Accountablity.SelectParameters.Clear();
                    SQLDS_Accountablity.SelectParameters.Add("p_key_college_id", ddl_College.SelectedValue);
                    SQLDS_Accountablity.SelectParameters.Add("p_nbr_fiscal_year", ddl_fiscalyear.SelectedValue);
                    SQLDS_Accountablity.SelectParameters.Add("p_txt_created_by", HttpContext.Current.User.Identity.Name.ToString());
                    SQLDS_Accountablity.Select(DataSourceSelectArguments.Empty);

                    DataSourceSelectArguments dssa = new DataSourceSelectArguments();
                    dssa.AddSupportedCapabilities(DataSourceCapabilities.RetrieveTotalRowCount);
                    dssa.RetrieveTotalRowCount = true;
                    DataView dv = (DataView)SQLDS_Accountablity.Select(dssa);

                    hf_Accountability_Id.Value = dv.Table.Rows[0][0].ToString();
                    lbl_Acc_Id.Text = dv.Table.Rows[0][0].ToString();
                    txt_Note.Text = dv.Table.Rows[0][4].ToString();

                    dv = (DataView)ds_Level.Select(dssa);
                    lbl_Level.Text = dv.Table.Rows[0][1].ToString();
                    Session.Add(HttpContext.Current.User.Identity.Name + Session.SessionID + "LevelTitle", lbl_Level.Text);
                    hf_Level_Id.Value = dv.Table.Rows[0][0].ToString();

                    ddl_Acct_Next_Level.DataBind();
                    lbl_Acc_Id.Visible = true;
                    txt_Note.Visible = true;
                    lbl_Level.Visible = true;
                    hf_Level_Id.Visible = true;
                    ddl_Acct_Next_Level.Visible = true;
                    btn_Save.Visible = true;
                    Label3.Visible = true;
                    Label4.Visible = true;
                    Label5.Visible = true;
                    Label6.Visible = true;

                    HL_RPLIST.Visible = true;
                    lnkSubmit.Visible = true;
                }
                else
                {
                    lbl_Acc_Id.Text = "";
                    txt_Note.Text = "";
                    lbl_Level.Text = "";
                    hf_Level_Id.Value = "";
                    //ds_Acct_Next_Level.DataBind();
                    ddl_Acct_Next_Level.Items.Clear();
                    HL_Errors.Visible = false;
                    HL_RPLIST.Visible = false;
                    lnkSubmit.Visible = false;
                }
            }
    }
    protected void btnCreate_Click(object sender, EventArgs e)
    {
        // Create an Accountability Report
        if (ddl_fiscalyear.SelectedIndex > 0)
        {

            SQLDS_Accountablity.InsertParameters.Clear();
            SQLDS_Accountablity.InsertParameters.Add("p_key_college_id", ddl_College.SelectedValue);
            SQLDS_Accountablity.InsertParameters.Add("p_nbr_fiscal_year", ddl_fiscalyear.SelectedValue);
            SQLDS_Accountablity.InsertParameters.Add("p_txt_created_by", HttpContext.Current.User.Identity.Name.ToString());
            SQLDS_Accountablity.Insert();

            SQLDS_Accountablity.SelectParameters.Clear();
            SQLDS_Accountablity.SelectParameters.Add("p_key_college_id", ddl_College.SelectedValue);
            SQLDS_Accountablity.SelectParameters.Add("p_nbr_fiscal_year", ddl_fiscalyear.SelectedValue);
            SQLDS_Accountablity.SelectParameters.Add("p_txt_created_by",HttpContext.Current.User.Identity.Name.ToString());
            SQLDS_Accountablity.Select(DataSourceSelectArguments.Empty);

            DataSourceSelectArguments dssa = new DataSourceSelectArguments();
            dssa.AddSupportedCapabilities(DataSourceCapabilities.RetrieveTotalRowCount);
            dssa.RetrieveTotalRowCount = true;
            DataView dv = (DataView)SQLDS_Accountablity.Select(dssa);

            hf_Accountability_Id.Value = dv.Table.Rows[0][0].ToString();
            lbl_Acc_Id.Text = dv.Table.Rows[0][0].ToString();
            txt_Note.Text = dv.Table.Rows[0][4].ToString();

            dv = (DataView)ds_Level.Select(dssa);
            lbl_Level.Text = dv.Table.Rows[0][1].ToString();
            hf_Level_Id.Value = dv.Table.Rows[0][0].ToString();

            ddl_Acct_Next_Level.DataBind();
            lbl_Acc_Id.Visible = true;
            txt_Note.Visible = true;
            lbl_Level.Visible = true;
            hf_Level_Id.Visible = true;
            ddl_Acct_Next_Level.Visible = true;
            btn_Save.Visible = true;
            Label3.Visible = true;
            Label4.Visible = true;
            Label5.Visible = true;
            Label6.Visible = true;

            HL_RPLIST.Visible = true;
            lnkSubmit.Visible = true;
        }
        else
        {
            lbl_Acc_Id.Text = "";
            txt_Note.Text = "";
            lbl_Level.Text = "";
            hf_Level_Id.Value = "";
            //ds_Acct_Next_Level.DataBind();
            ddl_Acct_Next_Level.Items.Clear();
            HL_Errors.Visible = false;
            HL_RPLIST.Visible = false;
            lnkSubmit.Visible = false;
            btn_Save.Visible = false;
        }

        LoadSession();
        ReloadData();
    }
		int QueryTotalRowCount (IOrderedDictionary mergedParameters, DataSourceSelectArguments arguments)
		{
			ObjectDataSourceSelectingEventArgs countArgs = new ObjectDataSourceSelectingEventArgs (mergedParameters, arguments, true);
			OnSelecting (countArgs);
			if (countArgs.Cancel)
				return 0;
			
			object count = InvokeSelect (SelectCountMethod, mergedParameters);
			return (int) Convert.ChangeType (count, typeof(int));
		}
Exemplo n.º 49
0
    protected void preencherGaleria()
    {
        DataSourceSelectArguments arg = new DataSourceSelectArguments();
        IEnumerable ft = allFotos.Select(arg);
        IEnumerator ft2 = ft.GetEnumerator();

        string fotos = "";
        int numFotos = 0;
        while (ft2.MoveNext())
        {
            numFotos++;
            DataRowView row = (DataRowView)ft2.Current;
            string legenda = row.Row[4].ToString() + " na cidade de(o) " + row.Row[3].ToString() + " (" + Convert.ToDateTime(row.Row[5].ToString()).ToShortDateString() + ")";
            fotos = fotos + "<figure  class=\"cap-left\">" +
                   "<a href=\"" + row.Row[2].ToString() + "\" class=\"top_up\" toptions=\"group = imagens\"><p style=\"float: left; width: 200px; font-size: 9pt; margin-right: 5px; padding-bottom: 0px;\"><img width=\"200px\" height=\"200px\" src=\"" + row.Row[2].ToString() + "\" alt=\"\"></a>"+legenda+"</p><br/>" +
                   "<figcaption>" + row.Row[1].ToString() + "&nbsp;&nbsp;<a href=\"Fotos.aspx?remFoto=" + row.Row[0].ToString() + "\" onClick=\"if(confirm('Deseja eliminar a foto seleccionada?')); else return false;\"><img src=\"Icons/remFoto.png\" heigth=\"20px\" width=\"20px\" title=\"Remover Foto\"/></a></figcaption>" +
                   "</figure>";
        }

        Label1.Visible = true;
        if (numFotos == 0)
        {
            Label1.Text = "<center>Não existem fotos da cidade seleccionada</center>";
        }
        else
        {
            Label1.Text = fotos + "<br/>";
        }
    }
 protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemplo n.º 51
0
    string SavePostedFiles(UploadedFile uploadedFile)
    {
        if (!uploadedFile.IsValid)
            return string.Empty;
        DataSourceSelectArguments dsSA = new DataSourceSelectArguments();
        DataView returnedDataView = (DataView)dsInfo.Select(dsSA);
        string strMaSo = "";
        if (Session["UserID"].ToString() != null)
            strMaSo = Session["UserID"].ToString() + "_" + DateTime.Now.ToString("ddMMyyyyhhmmss");
        else
            strMaSo = DateTime.Now.ToString("ddMMyyyyhhmmss");
        FileInfo fileInfo = new FileInfo(uploadedFile.FileName);
        string strExp = fileInfo.Name;
        int Index = strExp.LastIndexOf('.');
        strExp = strExp.Substring(Index, strExp.Length - Index);
        if (strExp.Length <= 0)
            strExp = "";
        string uploadFolder = Server.MapPath("~/img/UserAvata");

        uploadedFile.SaveAs(uploadFolder + "/" + strMaSo + strExp);

        //CutImage150("~/img/UserAvata", 150, fileInfo.Name);
        return strMaSo + strExp;
    }
Exemplo n.º 52
0
    protected void ButtonCompile_Click(object sender, EventArgs e)
    {
        var jss = new JavaScriptSerializer();
            string url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/compilers?access_token=" + token;
            if (languageId.Count == 0)
            {
                response = client.DownloadString(url);
                var langObj = jss.Deserialize<Dictionary<string, dynamic>>(response);
                for (int i = 0; i < langObj["items"].Count; i++)
                    languageId.Add(langObj["items"][i]["id"].ToString());
            }

            url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/submissions?access_token=" + token;
            string code = TextBoxCode.Text;
            var json = jss.Serialize(code);
            string jsonData = "{\"compilerId\":" + languageId[DropDownLanguage.SelectedIndex] + ",\"source\":" + json + ",\"problemCode\":\"" + Request.QueryString["p"] + "\"}";
            client.Headers.Add("Content-Type", "application/json");
            response = client.UploadString(url, "POST", jsonData);
            var idObj = jss.Deserialize<Dictionary<string, string>>(response);
            string id = idObj["id"];

            bool finished = false;
            while (!finished)
            {
                url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/submissions/"+id+"?access_token="+token;
                response = client.DownloadString(url);
                var resultObj = jss.Deserialize<Dictionary<string, dynamic>>(response);
                if (resultObj["status"] > 10)
                {
                    finished = true;
                    testCases="";
                    for (int i = 0; i < resultObj["result_array"].Count; i++)
                    {
                        string passed = "check";
                        if (resultObj["result_array"][i]["statusDescription"] != "accepted")
                            passed = "close";
                        string color = passed == "check" ? "green;" : "red;";
                        testCases += "<h5><a href=\"#\"><label><i style=\"color:"+color +"\" class=\"fa fa-"+passed+" fa-fw\"></i> Testcase " + (i + 1).ToString() + "</label></a></h5><div class=\"no-padding\" style=\"border:0;\">";
                        testCases += "<table aria-describedby=\"dataTables-example_info\" role=\"grid\"" +
                                        "class=\"table table-responsive table-striped table-bordered table-hover dataTable no-footer dtr-inline\""+
                                        "width=\"100%\"><tbody>";
                        if (i==0 && resultObj["result_stdout"].Contains("DATASET NUMBER: 0"))
                            testCases += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Output</label></td><td>" + resultObj["result_stdout"].Split('\n')[2] + "</td></tr>";
                        testCases += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Time</label></td><td>" + resultObj["result_array"][i]["time"] + "</td></tr>";
                        testCases += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Memory</label></td><td>" + resultObj["result_array"][i]["memory"] + "</td></tr>";
                        testCases += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Status</label></td><td>" + resultObj["result_array"][i]["statusDescription"] + "</td></tr>";
                        testCases += "</tbody></table></div>";
                    }

                    compInfo.InnerHtml = "<table aria-describedby=\"dataTables-example_info\" role=\"grid\""+
                                        "class=\"table table-responsive table-striped table-bordered table-hover dataTable no-footer dtr-inline\""+
                                        "width=\"100%\"><tbody>";
                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Score</label></td><td>" + resultObj["result_score"] + "</td></tr>";
                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>LangName</label></td><td>" + resultObj["compiler"]["name"] + "</td></tr>";
                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Time</label></td><td>" + resultObj["result_time"] + "</td></tr>";
                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Memory</label></td><td>" + resultObj["result_memory"] + "</td></tr>";
                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Signal</label></td><td>" + resultObj["result_signal"] + "</td></tr>";

                    if (resultObj["result_cmperr"] != "")
                        compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Compile Error</label></td><td>" + resultObj["result_cmperr"] + "</td></td>";

                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Status</label></td><td>" + resultObj["statusDescription"] + "</td></tr>";

                    compInfo.InnerHtml += "<tr role=\"row\" class=\"gradeA odd\"><td><label>Result</label></td><td>";
                    if (resultObj["status"] == 11)
                        compInfo.InnerHtml += "Compilation Error";
                    if (resultObj["status"] == 12)
                        compInfo.InnerHtml += "Runtime Error";
                    if (resultObj["status"] == 13)
                        compInfo.InnerHtml += "Time Limit Exceeded";
                    if (resultObj["status"] == 14)
                        compInfo.InnerHtml += "Wrong Answer";
                    if (resultObj["status"] == 15)
                        compInfo.InnerHtml += "Success";
                    if (resultObj["status"] == 17)
                        compInfo.InnerHtml += "Memory Limit Exceeded";
                    if (resultObj["status"] == 19)
                        compInfo.InnerHtml += "Illegal System Call";
                    if (resultObj["status"] == 20 || resultObj["status"] == 21)
                        compInfo.InnerHtml += "Internal Error";

                    compInfo.InnerHtml += "</td></tr></tbody></table>";

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "init", "g1.refresh(" + resultObj["result_score"] + ")", true);

                    SubmissionDataSource.SelectParameters.Clear(); //Select
                    SubmissionDataSource.SelectParameters.Add("Question", Request.QueryString["p"]);
                    SubmissionDataSource.SelectParameters.Add("Username", Membership.GetUser().UserName);
                    DataSourceSelectArguments args = new DataSourceSelectArguments();
                    DataView dv = (DataView)SubmissionDataSource.Select(args);
                    if (dv.Table.Rows.Count == 1) //Update if exist
                    {
                        SubmissionDataSource.UpdateParameters.Clear();
                        SubmissionDataSource.UpdateParameters.Add("Score", Convert.ToInt32(resultObj["result_score"]).ToString());
                        SubmissionDataSource.UpdateParameters.Add("SubmissionId", id);
                        SubmissionDataSource.UpdateParameters.Add("Question", Request.QueryString["p"]);
                        SubmissionDataSource.UpdateParameters.Add("Username", Membership.GetUser().UserName);
                        SubmissionDataSource.UpdateParameters.Add("Date", DateTime.Now.ToString("MM/dd/yyyy HH:mm"));
                        SubmissionDataSource.UpdateParameters.Add("Language", DropDownLanguage.SelectedItem.Text);
                        SubmissionDataSource.Update();
                    }
                    else //Insert
                    {
                        SubmissionDataSource.InsertParameters.Clear();
                        SubmissionDataSource.InsertParameters.Add("Score", Convert.ToInt32(resultObj["result_score"]).ToString());
                        SubmissionDataSource.InsertParameters.Add("SubmissionId", id);
                        SubmissionDataSource.InsertParameters.Add("Question", Request.QueryString["p"]);
                        SubmissionDataSource.InsertParameters.Add("Username", Membership.GetUser().UserName);
                        SubmissionDataSource.InsertParameters.Add("Date", DateTime.Now.ToString("MM/dd/yyyy HH:mm"));
                        SubmissionDataSource.InsertParameters.Add("Language", DropDownLanguage.SelectedItem.Text);
                        SubmissionDataSource.Insert();
                    }
                }
            }
    }
Exemplo n.º 53
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int postback = 1;
            if (!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(Request.QueryString["p"]))
                    Response.Redirect("Default.aspx");

                DropDownLanguage.Attributes.Add("onchange", "fillSampleCode();");
                languageId.Clear();
                var jss = new JavaScriptSerializer();
                string url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/compilers?access_token=" + token;
                response = client.DownloadString(url);
                var langObj = jss.Deserialize<Dictionary<string, dynamic>>(response);
                for (int i = 0; i < langObj["items"].Count; i++)
                {
                    DropDownLanguage.Items.Add(langObj["items"][i]["name"] +" ("+ langObj["items"][i]["ver"]+")");
                    languageId.Add(langObj["items"][i]["id"].ToString());
                }

                url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] +"?access_token=" + token;
                response = client.DownloadString(url);
                var problemObj = jss.Deserialize<Dictionary<string, dynamic>>(response);
                problem.InnerHtml = "<h3><strong>"+problemObj["name"]+"</strong></h3>" + problemObj["body"];

                SubmissionDataSource.SelectParameters.Clear(); //Select
                SubmissionDataSource.SelectParameters.Add("Question", Request.QueryString["p"]);
                SubmissionDataSource.SelectParameters.Add("Username", Membership.GetUser().UserName);
                DataSourceSelectArguments args = new DataSourceSelectArguments();
                DataView dv = (DataView)SubmissionDataSource.Select(args);
                if (dv.Table.Rows.Count == 1)
                {
                    string submissionId = dv.Table.Rows[0]["SubmissionId"].ToString();
                    url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/submissions/" + submissionId + "?access_token=" + token;
                    response = client.DownloadString(url);
                    var oldSubmission = jss.Deserialize<Dictionary<string, dynamic>>(response);
                    TextBoxCode.Text = oldSubmission["source"];
                    DropDownLanguage.SelectedIndex = languageId.IndexOf(oldSubmission["language"].ToString());
                }
                else
                {
                    postback = 0;
                    DropDownLanguage.SelectedIndex = 10;
                }
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "init", "init(" + postback.ToString() + ")", true);
    }
		protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
		{
			if (SortParameterName.Length > 0 && SelectCommandType == SqlDataSourceCommandType.Text)
				throw new NotSupportedException ("The SortParameterName property is only supported with stored procedure commands in SqlDataSource");

			if (arguments.SortExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
				throw new NotSupportedException ("SqlDataSource cannot sort. Set DataSourceMode to DataSet to enable sorting.");

			if (arguments.StartRowIndex > 0 || arguments.MaximumRows > 0)
				throw new NotSupportedException ("SqlDataSource does not have paging enabled. Set the DataSourceMode to DataSet to enable paging.");

			if (FilterExpression.Length > 0 && owner.DataSourceMode == SqlDataSourceMode.DataReader)
				throw new NotSupportedException ("SqlDataSource only supports filtering when the data source's DataSourceMode is set to DataSet.");

			InitConnection ();

			DbCommand command = factory.CreateCommand ();
			command.CommandText = SelectCommand;
			command.Connection = connection;
			if (SelectCommandType == SqlDataSourceCommandType.Text)
				command.CommandType = CommandType.Text;
			else {
				command.CommandType = CommandType.StoredProcedure;
				if (SortParameterName.Length > 0 && arguments.SortExpression.Length > 0)
					command.Parameters.Add (CreateDbParameter (SortParameterName, arguments.SortExpression));
			}

			if (SelectParameters.Count > 0)
				InitializeParameters (command, SelectParameters, null, null, false);

			Exception exception = null;
			if (owner.DataSourceMode == SqlDataSourceMode.DataSet) {
				DataView dataView = null;

				if (owner.EnableCaching)
					dataView = (DataView) owner.Cache.GetCachedObject (SelectCommand, SelectParameters);

				if (dataView == null) {
					SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs (command, arguments);
					OnSelecting (selectingArgs);
					if (selectingArgs.Cancel || !PrepareNullParameters (command, CancelSelectOnNullParameter)) {
						return null;
					}
					try {
						DbDataAdapter adapter = factory.CreateDataAdapter ();
						DataSet dataset = new DataSet ();

						adapter.SelectCommand = command;
						adapter.Fill (dataset, name);

						dataView = dataset.Tables [0].DefaultView;
						if (dataView == null)
							throw new InvalidOperationException ();
					}
					catch (Exception e) {
						exception = e;
					}
					int rowsAffected = (dataView == null) ? 0 : dataView.Count;
					SqlDataSourceStatusEventArgs selectedArgs = new SqlDataSourceStatusEventArgs (command, rowsAffected, exception);
					OnSelected (selectedArgs);

					if (exception != null && !selectedArgs.ExceptionHandled)
						throw exception;

					if (owner.EnableCaching)
						owner.Cache.SetCachedObject (SelectCommand, selectParameters, dataView);
				}

				if (SortParameterName.Length == 0 || SelectCommandType == SqlDataSourceCommandType.Text)
					dataView.Sort = arguments.SortExpression;

				if (FilterExpression.Length > 0) {
					IOrderedDictionary fparams = FilterParameters.GetValues (context, owner);
					SqlDataSourceFilteringEventArgs fargs = new SqlDataSourceFilteringEventArgs (fparams);
					OnFiltering (fargs);
					if (!fargs.Cancel) {
						object [] formatValues = new object [fparams.Count];
						for (int n = 0; n < formatValues.Length; n++) {
							formatValues [n] = fparams [n];
							if (formatValues [n] == null) return dataView;
						}
						dataView.RowFilter = string.Format (FilterExpression, formatValues);
					}
				}

				return dataView;
			}
			else {
				SqlDataSourceSelectingEventArgs selectingArgs = new SqlDataSourceSelectingEventArgs (command, arguments);
				OnSelecting (selectingArgs);
				if (selectingArgs.Cancel || !PrepareNullParameters (command, CancelSelectOnNullParameter)) {
					return null;
				}

				DbDataReader reader = null;
				bool closed = connection.State == ConnectionState.Closed;

				if (closed)
					connection.Open ();
				try {
					reader = command.ExecuteReader (closed ? CommandBehavior.CloseConnection : CommandBehavior.Default);
				}
				catch (Exception e) {
					exception = e;
				}
				SqlDataSourceStatusEventArgs selectedArgs =
					new SqlDataSourceStatusEventArgs (command, reader.RecordsAffected, exception);
				OnSelected (selectedArgs);
				if (exception != null && !selectedArgs.ExceptionHandled)
					throw exception;

				return reader;
			}
		}
Exemplo n.º 55
0
		public IEnumerable Select (DataSourceSelectArguments args)
		{
			return View.Select (args);			
		}
Exemplo n.º 56
0
        protected override DataSourceSelectArguments CreateDataSourceSelectArguments() {
            DataSourceSelectArguments arguments = new DataSourceSelectArguments();
            DataSourceView view = GetData();
            _useServerPaging = AllowPaging && view.CanPage;

            // decide if we should use server-side paging
            if (_useServerPaging) {
                arguments.StartRowIndex = PageIndex;
                if (view.CanRetrieveTotalRowCount) {
                    arguments.RetrieveTotalRowCount = true;
                    arguments.MaximumRows = 1;
                }
                else {
                    arguments.MaximumRows = -1;
                }
            }

            return arguments;
        }
Exemplo n.º 57
0
        protected override DataSourceSelectArguments CreateDataSourceSelectArguments() {
            DataSourceSelectArguments arguments = new DataSourceSelectArguments();
            DataSourceView view = GetData();
            bool useServerPaging = view.CanPage;

            string sortExpression = SortExpressionInternal;
            if (SortDirectionInternal == SortDirection.Descending && !String.IsNullOrEmpty(sortExpression)) {
                sortExpression += " DESC";
            }
            arguments.SortExpression = sortExpression;

            // decide if we should use server-side paging
            if (useServerPaging) {
                if (view.CanRetrieveTotalRowCount) {
                    arguments.RetrieveTotalRowCount = true;
                    arguments.MaximumRows = _maximumRows;
                }
                else {
                    arguments.MaximumRows = -1;
                }
                arguments.StartRowIndex = _startRowIndex;
            }
            return arguments;
        }
Exemplo n.º 58
0
		public IEnumerable Select (DataSourceSelectArguments arguments)
		{
			return ExecuteSelect (arguments);
		}
		public ObjectDataSourceSelectingEventArgs (IOrderedDictionary inputParameters, DataSourceSelectArguments arguments, bool executeSelectCount) : base (inputParameters)
		{
			this.executeSelectCount = executeSelectCount;
			this.arguments = arguments;
		}
Exemplo n.º 60
0
		protected internal override IEnumerable ExecuteSelect (DataSourceSelectArguments arguments)
		{
			return collection;
		}