private int DoAdd()
        {
            var model = new Model.CCOM.News();

            model.News_title      = this.txtTitle.Text.Trim();
            model.News_URL        = "/AdminMetro/index.aspx";
            model.News_creator_id = (int)GetAdminInfo_CCOM().User_id;
            if (this.txtReleaseTime.Text.Trim() != null && this.txtReleaseTime.Text.Trim().Length > 0)
            {
                model.News_date = Convert.ToDateTime(this.txtReleaseTime.Text.Trim());
            }
            else
            {
                model.News_date = DateTime.Now;
            }
            model.News_readnumber = 1;
            model.News_type_id    = int.Parse(DESEncrypt.Decrypt(this.hidNewsType.Value));
            model.News_content    = this.hidEditorCnt.Value.Replace("'", "");
            model.News_top        = false;
            if (this.optTop.Checked)
            {
                model.News_top = true;
                string time = this.txtTopTime.Text.Trim();
                if (time != null && time.Length > 0)
                {
                    int last_time = int.Parse(time);
                    model.News_top_time = last_time;
                }
                else
                {
                    model.News_top_time = 3;//默认置顶3天
                }
            }

            Int32 newsId = 0;

            newsId = new BLL.CCOM.News().Add(model);
            if (newsId > 0)
            {
                #region ====================附件
                //保存附件
                string hidFileList = Request.Params["hidFileName"];
                if (!string.IsNullOrEmpty(hidFileList))
                {
                    string[] fileListArr = hidFileList.Split(',');
                    //var list = new List<Model.CCOM.News_attach>();
                    for (int i = 0; i < fileListArr.Length; i++)
                    {
                        string[] fileArr = fileListArr[i].Split('|');
                        if (fileArr.Length == 3)
                        {
                            int    attach_id  = Int32.Parse(fileArr[0]);
                            String toFilePath = DataDic.News_Attach_Path + DateTime.Now.Ticks.ToString() + i.ToString() +
                                                FileOperate.GetPostfixStr(fileArr[2]);
                            try
                            {
                                FileOperate.FileMove(Server.MapPath(fileArr[2]),
                                                     Server.MapPath(toFilePath));
                                //上传附件至文件服务器
                                UI.UpLoad.UploadFileThread(toFilePath);
                            }
                            catch (Exception ex)
                            {
                                toFilePath = fileArr[2];
                            }
                            Model.CCOM.News_attach model_attach = new Model.CCOM.News_attach();
                            model_attach.News_id             = newsId;
                            model_attach.News_attach_name    = fileArr[1];
                            model_attach.News_attach_address = toFilePath;
                            new BLL.CCOM.News_attach().Add(model_attach);
                        }
                    }
                }
                #endregion
                //修改URL
                Model.CCOM.News model1 = new BLL.CCOM.News().GetModel(newsId);
                model1.News_URL = "/AdminMetro/CCOM/notification/ViewNews.aspx?id=" + DESEncrypt.Encrypt(newsId.ToString());
                new BLL.CCOM.News().Update(model1);
                //生成静态页
                NewsHtml.CreateHtml(newsId, false);
            }
            return(newsId);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="_id">资讯ID</param>
        /// <returns></returns>
        private bool DoEdit(int _id)
        {
            #region =====================================附件
            string hidFileList = Request.Params["hidFileName"];
            string strWhere    = " News_id=" + _id;
            var    news_attach = new BLL.CCOM.News_attach().GetModelList(strWhere);
            if (!string.IsNullOrEmpty(hidFileList))
            {
                string[] fileListArr = hidFileList.Split(',');
                //附件发生变化,重新上传(从无到有,数目发生变化,内容发生变化)
                if (news_attach != null && news_attach.Count > 0 && news_attach.Count != fileListArr.Length || this.attachChange.Value == "1" || news_attach.Count == 0)
                {
                    var bll = new BLL.CCOM.News_attach();
                    for (int i = 0; i < news_attach.Count; i++)
                    {
                        string str = " News_attach_id=" + news_attach[i].News_attach_id;
                        bll.Delete(str);
                    }

                    for (int i = 0; i < fileListArr.Length; i++)
                    {
                        string[] fileArr = fileListArr[i].Split('|');
                        if (fileArr.Length == 3)
                        {
                            long   attach_id  = Int64.Parse(fileArr[0]);
                            String toFilePath = DataDic.News_Attach_Path + DateTime.Now.Ticks.ToString() + i.ToString() +
                                                FileOperate.GetPostfixStr(fileArr[2]);
                            //新增文件
                            if (attach_id == 0)
                            {
                                try
                                {
                                    FileOperate.FileMove(Server.MapPath(fileArr[2]),
                                                         Server.MapPath(toFilePath));
                                    //上传附件至文件服务器
                                    UI.UpLoad.UploadFileThread(toFilePath);
                                }
                                catch
                                {
                                    toFilePath = fileArr[2];
                                }
                            }
                            else
                            {
                                toFilePath = fileArr[2];    //原有附件地址不变
                            }

                            Model.CCOM.News_attach model_attach = new Model.CCOM.News_attach();
                            model_attach.News_id             = newsId;
                            model_attach.News_attach_name    = fileArr[1];
                            model_attach.News_attach_address = toFilePath;
                            new BLL.CCOM.News_attach().Add(model_attach);
                        }
                    }
                }
            }
            else
            {
                //从有到无,删除数据库数据
                if (news_attach != null && news_attach.Count > 0)
                {
                    var bll = new BLL.CCOM.News_attach();
                    for (int i = 0; i < news_attach.Count; i++)
                    {
                        string str = " News_attach_id=" + news_attach[i].News_attach_id;
                        bll.Delete(str);
                    }
                }
            }
            #endregion
            //var model = new Model.CCOM.News();
            var model = new BLL.CCOM.News().GetModel(_id);
            model.News_title = this.txtTitle.Text.Trim();
            if (this.txtReleaseTime.Text.Trim() != null && this.txtReleaseTime.Text.Trim().Length > 0)
            {
                model.News_date = Convert.ToDateTime(this.txtReleaseTime.Text.Trim());
            }
            model.News_last_editor = (int)GetAdminInfo_CCOM().User_id;
            model.News_type_id     = int.Parse(DESEncrypt.Decrypt(this.hidNewsType.Value));
            model.News_content     = this.hidEditorCnt.Value.Replace("'", "");
            model.News_top         = false;//默认不置顶
            if (this.optTop.Checked)
            {
                model.News_top = true;
                string time = this.txtTopTime.Text.Trim();
                if (time != null && time.Length > 0)
                {
                    int last_time = int.Parse(time);
                    model.News_top_time = last_time;
                }
                else
                {
                    model.News_top_time = 3;//默认置顶3天
                }
            }

            if (new BLL.CCOM.News().Update(model))
            {
                NewsHtml.CreateHtml(_id, false);
                return(true);
            }
            else
            {
                return(false);
            }
        }