Exemplo n.º 1
0
        /// <summary>
        /// 预存
        /// </summary>
        public void Save()
        {
            //System.Threading.Thread.Sleep(5000);
            string id = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(id))
            {
                Sys_NoticeBLL bll   = new Sys_NoticeBLL();
                Sys_Notice    model = bll.Get(p => p.NoticeID == id);
                model.Notice_Type    = ddlNotice_Type.SelectedValue;
                model.Notice_Title   = Notice_Title.Text;
                model.Notice_Content = Notice_Context.Text;
                model.IsDelete       = false;
                model.Sort           = 1;
                string cole = hid_DepId.Value.ToString();
                model.Notice_Scope = cole;
                //model.Notice_IsShow = Convert.ToBoolean(ddlIsShow.SelectedValue);
                bool bol = bll.Update(model);
                if (bol)
                {
                    new Sys_ModelFileBLL().Add(Session["ww"] as List <Sys_ModelFile>);
                    MessageBox.ShowAndRedirect(this, "保存成功!", "NoticeList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "保存出错");
                    Session.Remove("ww");
                }
            }
            else
            {
                Sys_NoticeBLL bll   = new Sys_NoticeBLL();
                Sys_Notice    model = new Sys_Notice();
                model.NoticeID    = this.File.FileOperationID;
                model.Notice_Type = ddlNotice_Type.SelectedValue;
                //model.Notice_IsShow = Convert.ToBoolean(ddlIsShow.SelectedValue);
                model.Notice_Title   = Notice_Title.Text;
                model.Notice_Content = Notice_Context.Text;
                model.AddUserId      = CurrUserInfo().UserID;
                model.AddTime        = DateTime.Now;
                model.IsDelete       = false;
                model.Sort           = 1;
                string cole = hid_DepId.Value.ToString();
                model.Notice_Scope = cole;
                // btn_downFile.Visible = false;//新增时不能下载附件
                // List<Sys_NoticeFile> files = GetFileInfo(model.NoticeID);
                //if (files != null)
                //{
                //    model.Sys_NoticeFile = files;
                //}
                if (bll.Add(model))
                {
                    new Sys_ModelFileBLL().Add(Session["ww"] as List <Sys_ModelFile>);
                    MessageBox.ShowAndRedirect(this, "保存成功!", "NoticeList.aspx");
                }
                else
                {
                    MessageBox.Show(this, "保存出错");
                    Session.Remove("ww");
                }
            }
        }