Ejemplo n.º 1
0
    private void BindNews()
    {
        RptNews.DataSource = null;
        RptNews.DataBind();

        PnlFilter.ControlsBind(FilterDictionary, TableName);

        int NewsID;

        int.TryParse(TxtNewsID.Text, out NewsID);
        if (NewsID == 0)
        {
            NewsID = -1;
        }

        FilterDictionary = new Dictionary <string, object>()
        {
            { "Id", NewsID },
            { "LangsId", Langs.Id },
            { "OrganizationsId", DALCL._Login.organizationsId },
            { "OrganizationsLangsId", Langs.Id },
            { "NewsLangsStatusId", int.Parse(DListNewsStatus.SelectedValue) }
        };

        int PageNum;
        int RowNumber = 50;

        if (!int.TryParse(ConfigL._Route("pagenum", "1"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult NewsResult = DALC.GetFilterList(Tools.Tables.V_News, FilterDictionary, PageNum, RowNumber);

        if (NewsResult.Count == -1)
        {
            return;
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", NewsResult.Count.ToString());

        int Total_Count = NewsResult.Count % RowNumber > 0 ? (NewsResult.Count / RowNumber) + 1 : NewsResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = NewsResult.Count > RowNumber;

        RptNews.DataSource = NewsResult.Dt;
        RptNews.DataBind();
    }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //const string Day = "日一二三四五六";
            //this.lblMun.Text = DateTime.Today.Month.ToString();
            //this.lblDay.Text = DateTime.Today.Day.ToString();
            //this.lblZhou.Text = "星期" + Day[Convert.ToInt16(DateTime.Now.DayOfWeek)];
            string    strSql = "select NewsContent from Sys_News where ShowOnSys='0'";
            DBManager db     = DBManager.Instance();
            DataTable dt     = db.GetDataTable(strSql);

            RptNews.DataSource = dt.DefaultView;
            RptNews.DataBind();

            //Timer time = new Timer(30000);//600000
            //time.Elapsed += new ElapsedEventHandler(time_Elapsed);
            //time.Enabled = true;
            //time.Start();
        }