protected void NewsDetailsInit(string newsId) { //获得News实体 EyouSoft.Model.CompanyStructure.CompanyAffiche NModel = EyouSoft.BLL.CompanyStructure.CompanyAffiche.CreateInstance().GetModel(EyouSoft.Common.Utils.GetInt(newsId)); string CompanyId = "0"; if (NModel != null) { this.Page.Title = NModel.AfficheTitle; CompanyId = NModel.CompanyId; this.AdvancedControl11.SetAgencyId = CompanyId; this.AdvancedControl11.CityId = this.CityId; this.lblTitle.Text = NModel.AfficheTitle; this.lblContent.Text = NModel.AfficheInfo; } //获得网店信息 EyouSoft.Model.CompanyStructure.SupplierInfo SModel = EyouSoft.BLL.CompanyStructure.SupplierInfo.CreateInstance().GetModel(CompanyId); if (SModel != null) { string backurl = SiteUserInfo.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.旅游用品店) == true?EyouSoft.Common.URLREWRITE.TravelProtects.TravelAdvancedShopUrl(this.CityId, SModel.ID) : EyouSoft.Common.URLREWRITE.Car.CarAdvancedShopUrl(this.CityId, SModel.ID); this.litGoBack.Text = "<a href=\"" + backurl + "\" style=\"cursor:pointer; font-size:12px;\">返回</a>"; this.AdvancedControl11.SetAgencyId = SModel.ID; this.ImgHead.ImageUrl = Domain.FileSystem + SModel.CompanyImg; this.lblUserName.Text = SModel.ContactInfo.ContactName; this.lblTelPhone.Text = SModel.ContactInfo.Tel; this.lblFax.Text = SModel.ContactInfo.Fax; this.lblUrl.Text = "<a href=\"" + SModel.WebSite + "\" target=\"_blank\" >" + SModel.WebSite.Replace("http://", "") + "</a>"; MQ = SModel.ContactInfo.MQ; this.lblAddress.Text = SModel.CompanyAddress; this.Page.Title += "_" + SModel.CompanyName + "_"; } if (SModel.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.景区)) { this.CityAndMenu1.HeadMenuIndex = 4; this.Page.Title += "景区"; } if (SModel.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.酒店)) { this.CityAndMenu1.HeadMenuIndex = 5; this.Page.Title += "酒店"; } if (SModel.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.车队)) { this.CityAndMenu1.HeadMenuIndex = 6; this.Page.Title += "车队"; } if (SModel.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.旅游用品店)) { this.CityAndMenu1.HeadMenuIndex = 7; this.Page.Title += "旅游用品店"; } if (SModel.CompanyRole.HasRole(EyouSoft.Model.CompanyStructure.CompanyType.购物店)) { this.CityAndMenu1.HeadMenuIndex = 8; this.Page.Title += "购物店"; } }
/// <summary> /// 获取资讯实体类 /// </summary> /// <param name="ID">主键编号</param> /// <returns>资讯实体</returns> public virtual EyouSoft.Model.CompanyStructure.CompanyAffiche GetModel(int ID) { EyouSoft.Model.CompanyStructure.CompanyAffiche model = null; DbCommand dc = this._database.GetSqlStringCommand(SQL_CompanyAffiche_GETMODEL); this._database.AddInParameter(dc, "ID", DbType.Int32, ID); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { if (dr.Read()) { model = new EyouSoft.Model.CompanyStructure.CompanyAffiche(); model.ID = dr.GetInt32(0); model.OperatorName = dr.GetString(1); model.CompanyId = dr.GetString(2); if (!dr.IsDBNull(3)) { model.AfficheClass = (EyouSoft.Model.CompanyStructure.CompanyAfficheType) int.Parse(dr.GetByte(3).ToString()); } model.AfficheTitle = dr.GetString(4); model.AfficheInfo = dr.GetString(5); model.IsHot = dr.GetString(6) == "1" ? true : false; model.IsTop = dr.GetString(7) == "1" ? true : false; model.PicPath = dr.GetString(8); model.IssueTime = dr.GetDateTime(9); } } return(model); }
/// <summary> /// 修改 /// </summary> /// <param name="Model">公司资讯实体</param> /// <returns>false:失败 true:成功</returns> public bool Update(EyouSoft.Model.CompanyStructure.CompanyAffiche Model) { if (Model == null) { return(false); } return(idal.Update(Model)); }
/// <summary> /// 添加新闻 /// </summary> private void InsertNews() { if (!IsCompanyCheck) { Response.Clear(); Response.Write("[{isSuccess:false,Message:'对不起,新注册用户还未审核,没有权限进入供应商网店管理!'}]"); Response.End(); } //if (!this.IsSupplyUser) //{ // Response.Clear(); // Response.Write("[{isSuccess:false,ErrorMessage:'对不起,你的公司身份不是属于供应商,没有权限进入供应商网店管理!'}]"); // Response.End(); // return; //} bool isTrue = false; EyouSoft.Model.CompanyStructure.CompanyAffiche model = new EyouSoft.Model.CompanyStructure.CompanyAffiche(); model.AfficheClass = ComAfficheType; string AfficheInfo = Server.UrlDecode(Request.Form["addnews_AfficheInfo"]); //AfficheInfo = Utils.EditInputText(Server.UrlDecode(AfficheInfo.Substring(0, AfficheInfo.Length > 4000 ? 4000 : AfficheInfo.Length))); model.AfficheInfo = Utils.EditInputText(AfficheInfo); model.AfficheTitle = Utils.GetFormValue("addnews_AfficheTitle", 50); model.CompanyId = CompanyID; model.CompanyType = this.SiteUserInfo.CompanyRole.RoleItems[0]; model.OperatorID = this.SiteUserInfo.ID; model.OperatorName = this.SiteUserInfo.UserName; model.IssueTime = Utils.GetDateTime(Request.Form["addnews_IssueTime"]); model.IsTop = false; model.IsPicNews = false; model.IsHot = false; model.Clicks = 0; model.PicPath = ""; if (Request.QueryString["AfficheID"] != null && !string.IsNullOrEmpty(Request.QueryString["AfficheID"])) { model.ID = Utils.GetInt(Request.QueryString["AfficheID"]); isTrue = EyouSoft.BLL.CompanyStructure.CompanyAffiche.CreateInstance().Update(model); } else { isTrue = EyouSoft.BLL.CompanyStructure.CompanyAffiche.CreateInstance().Add(model); } if (isTrue) { Response.Clear(); Response.Write("[{isSuccess:true,ErrorMessage:' 公司信息保存成功!'}]"); Response.End(); } model = null; }
/// <summary> /// 初始化 /// </summary> private void InitPage() { if (!string.IsNullOrEmpty(Request.QueryString["AfficheID"])) { int AfficheID = Utils.GetInt(Request.QueryString["AfficheID"]); EyouSoft.Model.CompanyStructure.CompanyAffiche model = EyouSoft.BLL.CompanyStructure.CompanyAffiche.CreateInstance().GetModel(AfficheID); if (model != null) { AfficheTitle = model.AfficheTitle; this.AfficheInfo = model.AfficheInfo; } model = null; } }
/// <summary> /// 修改 /// </summary> /// <param name="Model">公司资讯实体</param> /// <returns>false:失败 true:成功</returns> public virtual bool Update(EyouSoft.Model.CompanyStructure.CompanyAffiche Model) { DbCommand dc = this._database.GetSqlStringCommand(SQL_CompanyAffiche_UPDATE); this._database.AddInParameter(dc, "ID", DbType.Int32, Model.ID); this._database.AddInParameter(dc, "AfficheClass", DbType.Byte, (int)Model.AfficheClass); this._database.AddInParameter(dc, "AfficheTitle", DbType.String, Model.AfficheTitle); this._database.AddInParameter(dc, "AfficheInfo", DbType.String, Model.AfficheInfo); this._database.AddInParameter(dc, "IsHot", DbType.AnsiStringFixedLength, Model.IsHot ? "1" : "0"); this._database.AddInParameter(dc, "IsPicNews", DbType.AnsiStringFixedLength, Model.IsPicNews ? "1" : "0"); this._database.AddInParameter(dc, "PicPath", DbType.String, Model.PicPath); this._database.AddInParameter(dc, "IsTop", DbType.AnsiStringFixedLength, Model.IsTop ? "1" : "0"); return(DbHelper.ExecuteSql(dc, this._database) > 0 ? true : false); }
/// <summary> /// 分页获取指定公司指定资讯类别的列表 /// </summary> /// <param name="pageSize">每页显示的条数</param> /// <param name="pageIndex">当前页码</param> /// <param name="recordCount">总记录数</param> /// <param name="CompanyID">公司编号 =""返回所有公司,否则返回指定公司的数据</param> /// <param name="afficheType">资讯类别 =null返回所有类别,否则返回指定类别的数据</param> /// <param name="IsHot">是否热门 =null返回所有</param> /// <param name="IsTop">是否置顶 =null返回所有</param> /// <param name="IsPicNews">是否图片新闻 =null返回所有</param> /// <returns></returns> public virtual IList <EyouSoft.Model.CompanyStructure.CompanyAffiche> GetList(int pageSize, int pageIndex, ref int recordCount, string CompanyID, EyouSoft.Model.CompanyStructure.CompanyAfficheType?afficheType, bool?IsHot, bool?IsTop, bool?IsPicNews) { IList <EyouSoft.Model.CompanyStructure.CompanyAffiche> list = new List <EyouSoft.Model.CompanyStructure.CompanyAffiche>(); string tableName = "tbl_CompanyAffiche"; string fields = "ID,OperatorName,CompanyID,AfficheClass,AfficheTitle,AfficheInfo,IsHot,IsTop,PicPath,IssueTime"; string primaryKey = "ID"; string orderByString = "IsTop DESC,IsHot DESC,IssueTime DESC"; #region 生成查询条件 StringBuilder strWhere = new StringBuilder(); if (!string.IsNullOrEmpty(CompanyID)) { strWhere.AppendFormat(" CompanyID='{0}' ", CompanyID); } if (afficheType != null) { int afficheClass = (int)afficheType; if (strWhere.Length > 0) { strWhere.AppendFormat(" AND AfficheClass={0} ", afficheClass); } else { strWhere.AppendFormat(" AfficheClass={0} ", afficheClass); } } if (IsHot != null) { string IsHotNum = IsHot.Value ? "1" : "0"; if (strWhere.Length > 0) { strWhere.AppendFormat(" AND IsHot='{0}' ", IsHotNum); } else { strWhere.AppendFormat(" IsHot='{0}' ", IsHotNum); } } if (IsTop != null) { string IsTopNum = IsTop.Value ? "1" : "0"; if (strWhere.Length > 0) { strWhere.AppendFormat(" AND IsTop='{0}' ", IsTopNum); } else { strWhere.AppendFormat(" IsTop='{0}' ", IsTopNum); } } if (IsPicNews != null) { string IsPicNewsNum = IsPicNews.Value ? "1" : "0"; if (strWhere.Length > 0) { strWhere.AppendFormat(" AND IsPicNews='{0}' ", IsPicNewsNum); } else { strWhere.AppendFormat(" IsPicNews='{0}' ", IsPicNewsNum); } } #endregion using (IDataReader dr = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, strWhere.ToString(), orderByString)) { while (dr.Read()) { EyouSoft.Model.CompanyStructure.CompanyAffiche model = new EyouSoft.Model.CompanyStructure.CompanyAffiche(); model.ID = dr.GetInt32(0); model.OperatorName = dr.GetString(1); model.CompanyId = dr.GetString(2); if (!dr.IsDBNull(3)) { model.AfficheClass = (EyouSoft.Model.CompanyStructure.CompanyAfficheType) int.Parse(dr.GetByte(3).ToString()); } model.AfficheTitle = dr.GetString(4); model.AfficheInfo = dr.GetString(5); model.IsHot = dr.GetString(6) == "1" ? true : false; model.IsTop = dr.GetString(7) == "1" ? true : false; model.PicPath = dr.GetString(8); model.IssueTime = dr.GetDateTime(9); list.Add(model); model = null; } } return(list); }