Пример #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if (this.txtnewsTitle.Text.Trim().Length == 0)
            {
                strErr += "标题不能为空!\\n";
            }
            if (this.txtContent.Text.Trim().Length == 0)
            {
                strErr += "新闻内容不能为空!\\n";
            }
            if (this.ddrCat.SelectedValue == "0")
            {
                strErr += "请选择所属分类!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int newsId=int.Parse(this.lblNewsId.Text);
            int catId = int.Parse(this.ddrCat.SelectedValue);
            string catName = this.ddrCat.Items[ddrCat.SelectedIndex].Text;
            int userId = int.Parse(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserId));
            string userName = Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_UserName);
            int deptId = int.Parse(Common.Cookie.GetValue(StatusHelpercs.Cookie_Admin_DeptId));
            string newsTitle = this.txtnewsTitle.Text;
            string summary = "";
            string newsContent = this.txtContent.Text;
            string contentSource = "";
            string author = "";
            DateTime addTime = DateTime.Now;
            DateTime modifyTime = DateTime.Now;
            int isHomePage = 0;
            int isSlide = 0;
            isHomePage = 0;

            hm.BLL.news bll = new hm.BLL.news();
            hm.Model.news model = bll.GetModel(newsId);
            model.newsId=newsId;
            model.catId=catId;
            model.catName=catName;
            model.userId=userId;
            model.userName=userName;
            model.deptId=deptId;
            model.newsTitle=newsTitle;
            model.summary=summary;
            model.newsContent=newsContent;
            model.contentSource=contentSource;
            model.author=author;
            model.addTime=addTime;
            model.modifyTime=modifyTime;
            model.isHomePage=isHomePage;
            model.isSlide=isSlide;

            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Пример #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtnewsTitle.Text.Trim().Length == 0)
            {
                strErr += "标题不能为空!\\n";
            }
            if (this.txtContent.Text.Trim().Length == 0)
            {
                strErr += "新闻内容不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      newsId        = int.Parse(this.lblNewsId.Text);
            int      catId         = int.Parse(litId.Text);
            string   catName       = litName.Text;
            int      userId        = int.Parse(Request.Cookies["userId"].Value);
            string   userName      = Request.Cookies["userName"].Value;
            int      deptId        = int.Parse(Request.Cookies["deptId"].Value);
            string   newsTitle     = this.txtnewsTitle.Text;
            string   summary       = "";
            string   newsContent   = this.txtContent.Text;
            string   contentSource = "";
            string   author        = "";
            DateTime addTime       = DateTime.Now;
            DateTime modifyTime    = DateTime.Now;
            int      isHomePage    = 0;
            int      isSlide       = 0;

            isHomePage = 0;

            hm.BLL.news   bll   = new hm.BLL.news();
            hm.Model.news model = bll.GetModel(newsId);
            model.newsId        = newsId;
            model.catId         = catId;
            model.catName       = catName;
            model.userId        = userId;
            model.userName      = userName;
            model.deptId        = deptId;
            model.newsTitle     = newsTitle;
            model.summary       = summary;
            model.newsContent   = newsContent;
            model.contentSource = contentSource;
            model.author        = author;
            model.addTime       = addTime;
            model.modifyTime    = modifyTime;
            model.isHomePage    = isHomePage;
            model.isSlide       = isSlide;
            model.picUrl        = "";
            model.videoUrl      = "";
            model.isTop         = 0;
            model.fileUrl1      = "";
            model.fileUrl2      = "";
            model.fileUrl3      = "";

            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "../media/list.aspx?id=" + model.catId);
        }