예제 #1
0
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     lb_err.Text = "";
     try
     {
         Web_News news = new Web_News();
         news.Module_Code = ddl_Module.SelectedValue;
         news.News_Content = Server.HtmlEncode(tb_Content.Value.Trim());
         news.News_Title = tb_Title.Text;
         news.News_PubDate = DateTime.Now;
         news.Manager_Code = Session["ManagerCode"].ToString();
         news.Save();
         CY.HotelBooking.Core.Business.Log log = new CY.HotelBooking.Core.Business.Log();
         log.Manager = Manager.Code;
         log.Message = Manager.RealName + "添加了新闻:" + tb_Title.Text;
         log.Save();
         tb_Content.Value = "";
         tb_Title.Text = "";
         WriteBackScript("alert('添加成功!')");
     }
     catch (Exception ex)
     {
         lb_err.Text = ex.Message;
     }
 }
예제 #2
0
 protected void btn_Save_Click(object sender, EventArgs e)
 {
     lb_err.Text = "";
     try
     {
         Web_News news = new Web_News();
         news.Module_Code = ddl_Module.SelectedValue;
         news.News_Content = Server.HtmlEncode(tb_Content.Value.Trim());
         news.News_Title = tb_Title.Text;
         news.News_PubDate = DateTime.Now;
         if (Session["ManagerCode"] == null)
         {
             lb_err.Text = "未能从Session中获取管理员Code,请重新登录";
             return;
         }
         news.Manager_Code = Session["ManagerCode"].ToString();
         news.Save();
         Web_Log log = new Web_Log();
         log.ManagerCode = Manager.Manager_Code;
         log.Log_Message = Manager.Manage_RealName + "添加了新闻:" + tb_Title.Text;
         log.Log_DateCreated = DateTime.Now;
         log.Save();
         tb_Content.Value = "";
         tb_Title.Text = "";
         WriteBackScript("alert('添加成功!')");
     }
     catch (Exception ex)
     {
         lb_err.Text = ex.Message;
     }
 }
예제 #3
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            lab_Error.Text = "";
            try
            {
                Web_News model = new Web_News();
                model.News_Title = txt_Title.Text.Trim();
                if (ddl_module.SelectedValue == "")
                {
                    ClientScript.RegisterStartupScript(typeof(string), "", "alert('请先添加新闻类别');self.document.location.href='ModuleList.aspx'", true);
                    return;
                }
                model.Module_Code = ddl_module.SelectedItem.Value;
                model.News_Content = Server.HtmlEncode(Editor_content.Value.Trim());
                model.News_PubDate = DateTime.Now;
                model.IsCheck = false;
                StaffInfo user=Session["User"] as StaffInfo;
                if (user == null)
                {
                    return;
                }
                model.Manager_Code = user.Code;
                model.Save();

                Actinlog log = new Actinlog();
                log.LogDate = DateTime.Now;
                log.Logger = "test";
                log.ModuleId = 1;
                log.ModuleAction = "添加了一条新闻记录";
                log.Save();

                ClientScript.RegisterStartupScript(typeof(string), "", "alert('添加新闻成功');self.document.location.href='NewsList.aspx'", true);
            }
            catch (Exception ex)
            {
                lab_Error.Text = "错误提示:" + ex.Message;
            }
        }