/// <summary> /// ajax_页面保存 /// </summary> protected void PageSave(string id) { StringBuilder strMsg = new StringBuilder(); IPeerNews BLL = BPeerNews.CreateInstance(); MPeerNews Model; if (string.IsNullOrEmpty(id)) { //新增 Model = new MPeerNews(); strMsg.Append(this.CommonModel(Model)); Model.IssueTime = DateTime.Now; if (strMsg.Length == 0 && BLL.AddPeerNews(Model) == 1) { strMsg.Append("添加成功!"); } else { strMsg.Remove(0, strMsg.Length); strMsg.Append("添加失败!"); }; } else { //修改 Model = BLL.GetPeerNews(id); strMsg.Append(this.CommonModel(Model)); Model.LastUpdateTime = DateTime.Now; if (strMsg.Length == 0 && BLL.CustomerUpdatePeerNews(Model) == 1) { strMsg.Append("更新成功!"); } else { strMsg.Remove(0, strMsg.Length); strMsg.Append("更新失败!"); } } Response.Clear(); Response.Write(strMsg.ToString()); Response.End(); }
protected void initData(string id) { if (string.IsNullOrEmpty(id)) { return; } IPeerNews BLL = BPeerNews.CreateInstance(); MPeerNews Model = BLL.GetPeerNews(id); if (null == Model) { return; } this.lbTitle.Text = Model.Title;//标 题 //资讯相关 EyouSoft.BLL.CompanyStructure.CompanyInfo companyBLL = new EyouSoft.BLL.CompanyStructure.CompanyInfo(); CompanyDetailInfo companyModel = companyBLL.GetModel(Model.CompanyId); if (null != companyModel) { string strAboutInfo = string.Empty; if (companyModel.CompanyRole.HasRole(CompanyType.地接) || companyModel.CompanyRole.HasRole(CompanyType.专线)) { if (!string.IsNullOrEmpty(Model.AreaName)) { //2012-02-10 14:10信息来源:楼 链接到组团菜单中的"旅游线路库" strAboutInfo = string.Format(@"<a href='javascript:void(0)' onclick=""topTab.open('{0}','资讯相关',{{}})"" class='font12_grean' title='{1}'>{1}</a>", EyouSoft.Common.Domain.UserBackCenter + "/teamservice/linelibrarylist.aspx?lineId=" + Model.AreaId, Model.AreaName); } } else if (companyModel.CompanyRole.HasRole(CompanyType.景区)) { EyouSoft.Model.ScenicStructure.MScenicArea Area = new EyouSoft.BLL.ScenicStructure.BScenicArea().GetModel(Model.ScenicId); if (null != Area) { strAboutInfo = string.Format("<a href='{0}' target='_blank'>{1}</a>", EyouSoft.Common.Domain.UserPublicCenter + "/ScenicManage/NewScenicDetails.aspx?ScenicId=" + Area.ScenicId, Area.ScenicName); } } this.lbRoute.Text = strAboutInfo.Length > 0 ? strAboutInfo : "暂无"; } this.lbCompany.Text = Model.CompanyName; //发布企业 this.lbType.Text = Convert.ToString(Model.TypeId); //类别 this.lbTime.Text = string.Format("{0:yyyy-MM-dd}", Model.IssueTime); //发布时间 this.lbContent.Text = Model.Content; //内容 IList <MPeerNewsAttachInfo> lst = Model.AttachInfo; StringBuilder strPic = new StringBuilder(); StringBuilder strFile = new StringBuilder(); if (null != lst && lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { switch (lst[i].Type) { case AttachInfoType.图片: strPic.AppendFormat("<a href='{0}' title='{1}' target='_blank'>查看</a>", Domain.FileSystem + lst[i].Path, lst[i].FileName); break; case AttachInfoType.文件: strFile.AppendFormat("<a href='{0}' title='{1}' target='blank'>{2}</a>", Domain.FileSystem + lst[i].Path, lst[i].FileName, lst[i].FileName); break; } } } this.lbPic.Text = strPic.Length > 0 ? strPic.ToString() : "暂无图片"; //图片 this.lbFile.Text = strFile.Length > 0 ? strFile.ToString() : "暂无附件"; //附件下载 //点击次数加1 BLL.UpdateClickNum(id); }
/// <summary> /// 初始化 /// </summary> protected void InitData(string id) { ////相关专线、相关酒店、相关景区初始化值 string selInfoValue = string.Empty; //分类 this.ddlType.DataSource = EnumObj.GetList(typeof(EyouSoft.Model.NewsStructure.PeerNewType)); this.ddlType.DataTextField = "text"; this.ddlType.DataValueField = "value"; this.ddlType.DataBind(); //编辑初始化 if (!string.IsNullOrEmpty(id)) { IPeerNews BLL = BPeerNews.CreateInstance(); MPeerNews Model = BLL.GetPeerNews(id); if (null == Model) { return; } this.txtTitle.Value = Model.Title;//标题 //相关专线、相关酒店、相关景区 selInfoValue = Model.AreaId.ToString(); this.ddlType.SelectedValue = Convert.ToString((int)Model.TypeId); //分类 this.txtContent.Value = Model.Content; //内容 IList <MPeerNewsAttachInfo> lst = Model.AttachInfo; if (null != lst && lst.Count > 0) { StringBuilder strPic = new StringBuilder(); StringBuilder strFile = new StringBuilder(); StringBuilder strPicHidden = new StringBuilder(); StringBuilder strFileHidden = new StringBuilder(); for (int i = 0; i < lst.Count; i++) { switch (lst[i].Type) { case AttachInfoType.图片: strPic.AppendFormat("<a href='{0}' title='{1}' target='_blank'>查看</a><a href=\"javascript:void(0);\" onclick=\"NewsList.delFile(this,'pic');\"><img src='{2}/images/fujian_x.gif' border='0'/></a>", Domain.FileSystem + lst[i].Path, lst[i].FileName, this.ImageServerUrl); strPicHidden.AppendFormat(lst[i].Path + ","); break; case AttachInfoType.文件: strFile.AppendFormat("<a href='{0}' title='{1}' target='blank'>{1}</a><a href=\"javascript:void(0);\" onclick=\"NewsList.delFile(this,'file');\"><img src='{2}/images/fujian_x.gif' border='0'/></a>", Domain.FileSystem + lst[i].Path, lst[i].FileName, this.ImageServerUrl); strFileHidden.AppendFormat("{0}|{1},", lst[i].FileName, lst[i].Path); break; } } if (strPicHidden.Length > 0) { strPicHidden.Remove(strPicHidden.Length - 1, 1); } if (strFileHidden.Length > 0) { strFileHidden.Remove(strFileHidden.Length - 1, 1); } MessageBox.ResponseScript(this, string.Format("NewsList.setUploadHiddenValue('{0}','pic');NewsList.setUploadHiddenValue('{1}','file');", strPicHidden, strFileHidden)); this.lbPic.Text = strPic.Length > 0 ? strPic.ToString() : ""; //图片 this.lbFile.Text = strFile.Length > 0 ? strFile.ToString() : ""; //附件下载 } } this.getSelectInfo(selInfoValue); //this.InitTypeName(); }