예제 #1
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            Cms.DAL.NewsInfo   dal   = new Cms.DAL.NewsInfo();
            Cms.Model.NewsInfo model = dal.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnlock":
                if (model.IsLock == 1)
                {
                    dal.UpdateField(id, "IsLock=0");
                }
                else
                {
                    dal.UpdateField(id, "IsLock=1");
                }
                break;

            case "ibtntop":
                if (model.IsTop == 1)
                {
                    dal.UpdateField(id, "IsTop=0");
                }
                else
                {
                    dal.UpdateField(id, "IsTop=1");
                }
                break;
            }
            RptBind();
        }
예제 #2
0
        protected void lbtnDel_Click(object sender, EventArgs e)
        {
            Cms.DAL.NewsInfo   dal = new Cms.DAL.NewsInfo();
            Cms.Model.NewsInfo model;
            bool hasDeleted = false;

            //批量删除
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
                if (cb.Checked)
                {
                    model = dal.GetModel(id);
                    //删除记录
                    hasDeleted = true;
                    dal.Delete(id);
                }
            }
            if (hasDeleted)
            {
                MessageBox.Show(this, "批量删除成功!");
            }
            else
            {
                MessageBox.Show(this, "没有选中记录!");
            }
            //Coolite.Ext.Web.Ext.MessageBox.Alert("提示", "删除成功").Show();
            RptBind();
        }
예제 #3
0
        private void ShowInfo(int _id)
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            Cms.Model.NewsInfo model = dal.GetModel(_id);

            txtTitle.Text = model.Title;
            txtAuthor.Text = model.Author;
            ddlClassId.SelectedValue = model.ClassId.ToString();
            NewsContent.Text = Cms.Common.Utils.ToTxt(model.Content);
            txtPubTime.Text = model.PubTime.ToString("yyyy-MM-dd HH:mm:ss");
            txtClick.Text = model.Click.ToString();
            cblItem.Items[0].Selected = model.IsTop > 0;
            cblItem.Items[1].Selected = model.IsLock > 0;
        }
예제 #4
0
 //赋值
 private void ShowInfo(int Id)
 {
     Cms.DAL.NewsInfo   dal   = new Cms.DAL.NewsInfo();
     Cms.Model.NewsInfo model = dal.GetModel(Id);
     this.lblId.Text      = model.NewsID.ToString();
     this.lblTitle.Text   = model.Title;
     this.lblAuthor.Text  = model.Author;
     this.lblClassId.Text = model.ClassId.ToString();
     this.lblContent.Text = Cms.Common.Utils.ToTxt(model.Content);
     this.lblClick.Text   = model.Click.ToString();
     this.lblIsLock.Text  = model.IsLock.ToString();
     this.lblIsTop.Text   = model.IsTop.ToString();
     this.lblPubTime.Text = model.PubTime.ToString();
 }
예제 #5
0
 //赋值
 private void ShowInfo(int Id)
 {
     Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
     Cms.Model.NewsInfo model = dal.GetModel(Id);
     this.lblId.Text = model.NewsID.ToString();
     this.lblTitle.Text = model.Title;
     this.lblAuthor.Text = model.Author;
     this.lblClassId.Text = model.ClassId.ToString();
     this.lblContent.Text =Cms.Common.Utils.ToTxt(model.Content);
     this.lblClick.Text = model.Click.ToString();
     this.lblIsLock.Text = model.IsLock.ToString();
     this.lblIsTop.Text = model.IsTop.ToString();
     this.lblPubTime.Text = model.PubTime.ToString();
 }
예제 #6
0
        private void ShowInfo(int _id)
        {
            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            Cms.Model.NewsInfo model = dal.GetModel(_id);

            txtTitle.Text = model.Title;
            txtAuthor.Text = model.Author;
            ddlClassId.SelectedValue = model.ClassId.ToString();
            NewsContent.Text = Cms.Common.Utils.ToTxt(model.Content);
            txtPubTime.Text = model.PubTime.ToString("yyyy-MM-dd HH:mm:ss");
            txtClick.Text = model.Click.ToString();
            cblItem.Items[0].Selected = model.IsTop > 0;
            cblItem.Items[1].Selected = model.IsLock > 0;
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["newsID"] as string, out this.newsId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }

            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            model = dal.GetModel(this.newsId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }
            ////浏览数+1
            dal.UpdateField(this.newsId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(4);</script>");
        }
        protected int newsId; //全局变量Id

        #endregion Fields

        #region Methods

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["newsID"] as string, out this.newsId))
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }

            Cms.DAL.NewsInfo dal = new Cms.DAL.NewsInfo();
            model = dal.GetModel(this.newsId);//获得Id
            if (model == null)
            {
                Response.Write("<script>alert('您要查看的信息参数不正确或不存在!'),location.href='News.aspx';</script>");
                return;
            }
            ////浏览数+1
            dal.UpdateField(this.newsId, "Click=Click+1");
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>menuEnable(4);</script>");
        }