Exemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     NCPEP.Model.T_News model = new NCPEP.Model.T_News();
     model.Content = Request.Form["Content"];
     try
     {
         model.CreateDate = DateTime.Parse(Request.Form["txtshijian"]);
     }
     catch { }
     model.Editor         = "";
     model.IsCheck        = 0;
     model.Keyword        = Request.Form["Keyword"];
     model.NewsContent    = Request.Form["NewsContent"];
     model.NewsFile       = "";
     model.NewsImg        = "";
     model.NewsSource     = "";
     model.NewsSubheading = "";
     model.NewsTitle      = Request.Form["NewsTitle"];
     try
     {
         model.NewsTypeId = int.Parse(Request.Form["NewsTypeId"]);
     }
     catch { }
     model.NumClicks = 0;
     model.OrgCode   = adminUser.OrgCode;
     NCPEP.Bll.T_News bll = new NCPEP.Bll.T_News();
     bll.Add(model);
     ClientScript.RegisterStartupScript(this.GetType(), "myscript", "<script>MyFun();</script>");
 }
Exemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            NCPEP.Model.T_News model = new NCPEP.Model.T_News();
            model.Content = content1.Value;
            try
            {
                model.CreateDate = DateTime.Parse(this.txtsj.Text);
            }
            catch { }
            model.Editor      = adminUser.AdminName;
            model.IsCheck     = 0;
            model.Keyword     = this.txtKeyword.Text;
            model.NewsContent = this.content1.Value;
            model.Content     = this.txtContent.Text;

            model.NewsImg        = "";
            model.NewsSource     = this.txtNewsSource.Text;
            model.NewsSubheading = this.txtNewsSubheading.Text;
            model.NewsTitle      = this.txtNewsTitle.Text;
            try
            {
                model.NewsTypeId = int.Parse(this.txtNewsTypeId.SelectedValue);
            }
            catch { }
            if (fileNewsImg.HasFile)
            {
                string newsImgName = new UpLoadNewsImgPlug().UploadImg("147", "147");
                model.NewsImg = newsImgName == string.Empty ? fileNewsImg.FileName : newsImgName;
            }

            model.NumClicks = 0;
            model.OrgCode   = adminUser.OrgCode;
            model.ztbz      = this.ddlzt.SelectedValue;
            NCPEP.Bll.T_News bll = new NCPEP.Bll.T_News();
            int fid = bll.Add(model);

            if (fid > 0)
            {
                if (!string.IsNullOrEmpty(this.hdfile.Value) && !string.IsNullOrEmpty(this.hdfilename.Value))
                {
                    string[]           strs     = hdfile.Value.Split('|');
                    string[]           strsname = hdfilename.Value.Split('|');
                    NCPEP.Bll.T_Fujian fjbll    = new NCPEP.Bll.T_Fujian();
                    for (int i = 1; i < strs.Length; i++)
                    {
                        NCPEP.Model.T_Fujian fjmodel = new NCPEP.Model.T_Fujian();
                        fjmodel.fid    = fid.ToString();
                        fjmodel.fjlx   = "";
                        fjmodel.fjname = strsname[i];
                        fjmodel.fjpath = strs[i];
                        fjbll.Add(fjmodel);
                    }
                }
            }
            MessageBox.ShowAndRedirect(this, "保存成功", "newslist.aspx");
        }