//绑定类别 //protected void BindPushType() //{ // //默认选中未分类 // string strNoType = "<a href=\"javascript:;\" class='btn btn-success' onclick='selectPushType(this,\"" + DESEncrypt.Encrypt("0") + "\")'>未分类</a> "; // this.divPushType.InnerHtml = strNoType; // var ml = new BLL.CCOM.Notice_type().GetModelList(""); // var sb = new StringBuilder(); // foreach (var m in ml) // { // sb.Append("<a href=\"javascript:;\" class='btn' onclick='selectPushType(this,\"" + DESEncrypt.Encrypt(m.Notice_type_id.ToString()) + "\")'>" + m.Notice_type_name + "</a>"); // } // sb.Append("<a href=\"javascript:;\" class='btn' style='font-size: 18px;' onclick='addPushType()'><i class=\"icon-plus\"></i></a>"); // this.divPushType.InnerHtml += sb.ToString(); //} private void ShowInfo(long _id) { var bll = new BLL.CCOM.Notice(); var model = bll.GetModel(_id); this.btnSubmit.Visible = false; this.divSave.Visible = true; //********** 0(false)表示文字通知,1(true)表示图文通知****************// if (model.Notice_type != null) { if ((bool)model.Notice_type)//图文通知 { this.txtTitle.Text = model.Notice_title; this.hidEditorCnt.Value = model.Notice_content; //绑定附件 var attachList = new BLL.CCOM.Notice_attach().GetModelList("Notice_id=" + _id); if (attachList != null && attachList.Count > 0) { this.rptAttach.DataSource = attachList; this.rptAttach.DataBind(); } //选择通知类型 ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "setParam", "selectImagePush();", true); } else//文字通知 { this.txtContent.Text = model.Notice_content; } //绑定推送人员 if (model.Notice_receiver_id != null && model.Notice_receiver_id.Length > 0) { string receiver = model.Notice_receiver_id; if (receiver != null && receiver.Length > 0) { BindNoticeUser(receiver); } } } }
private void AddAttach(long id) { string hidFileList = Request.Params["hidFileName"]; if (!string.IsNullOrEmpty(hidFileList)) { var bll = new BLL.CCOM.Notice_attach(); string[] fileListArr = hidFileList.Split(','); 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]); toFilePath = fileArr[2]; //原有附件地址不变 try { FileOperate.FileMove(Server.MapPath(fileArr[2]), Server.MapPath(toFilePath)); //上传附件至文件服务器 UI.UpLoad.UploadFileThread(toFilePath); } catch { toFilePath = fileArr[2]; } var attach_model = new Model.CCOM.Notice_attach(); attach_model.Notice_attach_name = fileArr[1]; attach_model.Notice_id = id; attach_model.Notice_attach_address = toFilePath; bll.Add(attach_model); } } } }
public static void CreateWebPushHtml(String pushId, String fileName, bool checkExists) { if ((!checkExists) || (!System.IO.File.Exists(fileName))) { var push = new BLL.CCOM.Notice().GetModel(Int64.Parse(pushId)); if (push != null) { //根据通知类型,读取对应的模板文件 string temp = HttpContext.Current.Server.MapPath("/AdminMetro/CCOM/notice/Notice_temp.html"); //图文通知 if (push.Notice_type != null && (bool)push.Notice_type) { temp = HttpContext.Current.Server.MapPath("/AdminMetro/CCOM/notice/Notice_image_temp.html"); } String pushStr = FileOperate.ReadFile(temp); //替换推送者 string realname = new BLL.CCOM.User_information().GetModel(push.Notice_sender_id).User_realname; pushStr = pushStr.Replace("authorxxx", realname); //替换发布日期 pushStr = pushStr.Replace("pubdatexxx", push.Notice_date.ToString()); //替换通知内容 String content = HttpContext.Current.Server.HtmlDecode(push.Notice_content); pushStr = pushStr.Replace("contentxxx", content); //替换标题 pushStr = pushStr.Replace("titlexxx", push.Notice_title); //图文通知还需要替换附件 if (push.Notice_type != null && (bool)push.Notice_type) { //替换附件 StringBuilder sb = new StringBuilder(); var attachList = new BLL.CCOM.Notice_attach().GetModelList("Notice_id = " + pushId); if (attachList.Count > 0) { sb.Append("<p class='attachTitle'>附件:</p>"); var itemCnt = 1; foreach (var item in attachList) { sb.Append("<p class='attachItem'>(").Append(itemCnt).Append(") <a href='") .Append("/home/push/Attach.aspx?id=").Append(DESEncrypt.Encrypt(item.Notice_attach_id.ToString())) .Append("&address=").Append(HttpUtility.UrlEncode(item.Notice_attach_address)) .Append("&name=").Append(HttpUtility.UrlEncode(item.Notice_attach_name)) .Append("' target='_blank' >") .Append(item.Notice_attach_name) .Append("</a>") .Append(OnlineViewHelper.GetOnlineViewWrapLink(item.Notice_attach_address, item.Notice_attach_name)) .Append("</p>"); itemCnt++; } } pushStr = pushStr.Replace("attachxxx", sb.ToString()); } //写文件 FileOperate.WriteNewFile(fileName, pushStr); } } }