protected void Page_Load(object sender, EventArgs e)
        {
            Common.DataContext ctx = new Common.DataContext();
            int pageIndex = PubFunc.getPageIndex();
            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            int pageSize = Pager.PageSize;

            ctx.CommandType = CommandType.Text;
            //    (SELECT ROW_NUMBER() OVER (ORDER BY usr_User.ID DESC) AS ROWNO,
            string sql = @"Select [ID],Case ParentId when 0 then [Name] else '|----'+[Name] end [Name],[Type],[ContentType],[ImageUrl],[Code],[ParentId],[Sort],Case ParentId when 0 then ID else ParentId end sortId,[State],[CreateDate],[ModifyDate],[CreatedBy],[ModifiedBy],[Remark],[Ext] from [Channel] where State <> 255 order by sortId";

            var dataset = ctx.ExecuteDataSet(sql);

            if (dataset.Tables.Count <= 0)
            {
                return;
            }

            var list = dataset.Tables[0].ToList<Model.Channel>();

            Common.PubFunc.BindControl(rptList, list);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Common.DataContext ctx = new Common.DataContext();
            int pageIndex          = PubFunc.getPageIndex();

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            int pageSize = Pager.PageSize;

            ctx.CommandType = CommandType.Text;
            //    (SELECT ROW_NUMBER() OVER (ORDER BY usr_User.ID DESC) AS ROWNO,
            string sql = @"Select [ID],Case ParentId when 0 then [Name] else '|----'+[Name] end [Name],[Type],[ContentType],[ImageUrl],[Code],[ParentId],[Sort],Case ParentId when 0 then ID else ParentId end sortId,[State],[CreateDate],[ModifyDate],[CreatedBy],[ModifiedBy],[Remark],[Ext] from [Channel] where State <> 255 order by sortId";

            var dataset = ctx.ExecuteDataSet(sql);

            if (dataset.Tables.Count <= 0)
            {
                return;
            }

            var list = dataset.Tables[0].ToList <Model.Channel>();

            Common.PubFunc.BindControl(rptList, list);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var ctx = new DataContext();
            var ds =
                ctx.ExecuteDataSet(
                    @"Select top 10 ID,Title,ChannelID,CreateDate from Content Where ChannelCode='Company' And State=0 Order by CreateDate Desc;
                    Select top 10 ID,Title,ChannelID,CreateDate from Content Where ChannelCode='dongtai' And State=0 Order by CreateDate Desc;
                    Select * from Config where state=0;");

            if (ds != null)
            {
                if (ds.Tables.Count>0)
                {
                    CompanyContents = ds.Tables[0].ToList<Model.Content>();
                }

                if (ds.Tables.Count > 1)
                {
                    dtContents = ds.Tables[1].ToList<Model.Content>();
                }

                if (ds.Tables.Count > 2)
                {
                    Configs = ds.Tables[2].ToList<Model.Config>();
                }
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex = PubFunc.getPageIndex();

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            int pageSize = Pager.PageSize;

            ctx.CommandType = CommandType.Text;
            //    (SELECT ROW_NUMBER() OVER (ORDER BY usr_User.ID DESC) AS ROWNO,
            string sql = @"Select top " + pageSize +
                         " [ID],[LoginName],[Password] ,[Name],[Mob],[Email],[QQ],[Remark],[State],[Ext],[CreateDate],[ModifyDate] from [Admin] where Id not in (SELECT top " +
                         (pageIndex - 1) * pageSize + " [ID] FROM [Admin]" +
                         "Where State <> 255 And " + GetWhereStr() + ") and State <> 255  And " + GetWhereStr() +
                         " order by ID desc;Select count(ID) totalCount from [Admin] Where State <> 255 And " +
                         GetWhereStr();

            var dataset = ctx.ExecuteDataSet(sql);

            if (dataset.Tables.Count <= 0)
            {
                return;
            }

            var datatable = dataset.Tables[0];

            Common.PubFunc.BindControl(rptUserList, datatable);

            Pager.RecordCount = Convert.ToInt32(dataset.Tables[1].Rows[0]["totalCount"].ToString());
            //Pager.SetRewriteUrl();
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageIndex = PubFunc.getPageIndex();

            if (pageIndex == 0)
            {
                pageIndex = 1;
            }
            int pageSize = Pager.PageSize;

            ctx.CommandType = CommandType.Text;
            //    (SELECT ROW_NUMBER() OVER (ORDER BY usr_User.ID DESC) AS ROWNO,
            string sql = @"Select top " + pageSize +
                         " [ID],[ChannelID],[ChannelName],[ChannelCode],[Type],[ImageUrls],[Title],substring([ContentText],1,200)+'...' as ContentText,[Url],[Attributes],[CreateDate],[CreatedBy],[ModifyDate],[ModifiedBy],[Remark],[Ext],[State] from [Content] where Id not in (SELECT top " +
                         (pageIndex - 1) * pageSize + " [ID] FROM [Content] Where State <> 255 And " + GetWhereStr() + " Order by ID desc) and State <> 255  And " + GetWhereStr() +
                         " order by ID desc;Select count(ID) totalCount from [Content] Where State <> 255 And " + GetWhereStr() + ";Select Name,ID From Channel Where State<>255";

            var dataset = ctx.ExecuteDataSet(sql);

            if (dataset.Tables.Count <= 0)
            {
                return;
            }

            var datatable = dataset.Tables[0];

            Common.PubFunc.BindControl(rptUserList, datatable);

            Pager.RecordCount = Convert.ToInt32(dataset.Tables[1].Rows[0]["totalCount"].ToString());

            if (!IsPostBack)
            {
                ddlChannel.Items.Clear();
                ddlChannel.Items.Add(new ListItem("全部", "0"));
                if (dataset.Tables[2] != null && dataset.Tables[2].Rows.Count > 0)
                {
                    var channels = dataset.Tables[2].ToList <Model.Channel>();
                    foreach (var channel in channels)
                    {
                        ddlChannel.Items.Add(new ListItem(channel.Name, channel.ID.ToString()));
                    }
                }
            }

            //Pager.SetRewriteUrl();
        }