/// <summary> /// 获取后台轮换广告列表 /// </summary> /// <param name="pageSize">每页显示条数</param> /// <param name="pageIndex">当前页码</param> /// <param name="recordCount">总记录数</param> /// <param name="CompanyID">公司编号 为空返回全部,否则返回指定公司的轮换广告集合</param> /// <returns>轮换广告列表集合</returns> public virtual IList <EyouSoft.Model.ShopStructure.HighShopAdv> GetList(int pageSize, int pageIndex, ref int recordCount, string CompanyID) { IList <EyouSoft.Model.ShopStructure.HighShopAdv> list = new List <EyouSoft.Model.ShopStructure.HighShopAdv>(); string tableName = "tbl_HighShopAdv"; string fields = " ID,ImagePath,LinkAddress,SortID,CompanyID,IssueTime "; string primaryKey = "ID"; string orderByString = "SortID DESC,IssueTime DESC"; string strWhere = string.Empty; if (!string.IsNullOrEmpty(CompanyID)) { strWhere = string.Format(" CompanyID='{0}' ", CompanyID); } using (IDataReader dr = DbHelper.ExecuteReader(this._database, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, strWhere, orderByString)) { while (dr.Read()) { EyouSoft.Model.ShopStructure.HighShopAdv model = new EyouSoft.Model.ShopStructure.HighShopAdv(); model.ID = dr.GetString(0); model.ImagePath = dr.GetString(1); model.LinkAddress = dr.GetString(2); model.SortID = dr.GetByte(3); model.CompanyID = dr.GetString(4); list.Add(model); model = null; } } return(list); }
/// <summary> /// 获取指定编号的轮换广告信息 /// </summary> /// <param name="CompanyID">公司编号</param> /// <returns>轮换广告列表集合</returns> public virtual EyouSoft.Model.ShopStructure.HighShopAdv GetModel(string CompanyID) { EyouSoft.Model.ShopStructure.HighShopAdv model = null; DbCommand dc = this._database.GetSqlStringCommand(SQL_HighShopAdv_GETMODEL); this._database.AddInParameter(dc, "ID", DbType.AnsiStringFixedLength, CompanyID); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { while (dr.Read()) { model = new EyouSoft.Model.ShopStructure.HighShopAdv(); model.ID = dr.GetString(0); model.ImagePath = dr.GetString(1); model.LinkAddress = dr.GetString(2); } } return(model); }
/// <summary> /// 前台获取指定公司的轮换广告列表 /// </summary> /// <param name="TopNumber">需要获取的记录数</param> /// <param name="CompanyID">公司编号</param> /// <returns>轮换广告列表集合</returns> public virtual IList <EyouSoft.Model.ShopStructure.HighShopAdv> GetWebList(int TopNumber, string CompanyID) { IList <EyouSoft.Model.ShopStructure.HighShopAdv> list = new List <EyouSoft.Model.ShopStructure.HighShopAdv>(); DbCommand dc = this._database.GetSqlStringCommand(string.Format(SQL_HighShopAdv_GETLISTBYCOMPANYID, TopNumber > 0?string.Format(" top {0} ", TopNumber):string.Empty)); this._database.AddInParameter(dc, "CompanyID", DbType.AnsiStringFixedLength, CompanyID); using (IDataReader dr = DbHelper.ExecuteReader(dc, this._database)) { while (dr.Read()) { EyouSoft.Model.ShopStructure.HighShopAdv model = new EyouSoft.Model.ShopStructure.HighShopAdv(); model.ID = dr.GetString(0); model.ImagePath = dr.GetString(1); model.LinkAddress = dr.GetString(2); model.SortID = dr.GetByte(dr.GetOrdinal("SortID")); list.Add(model); model = null; } } return(list); }
protected void btnSave_Click(object sender, EventArgs e) { IList <EyouSoft.Model.ShopStructure.HighShopAdv> list = new List <EyouSoft.Model.ShopStructure.HighShopAdv>(); EyouSoft.Model.ShopStructure.HighShopAdv model = null; string[] ids = null; if (!string.IsNullOrEmpty(hdfids.Value)) { ids = hdfids.Value.Split(','); } for (int i = 1; i <= 5; i++) { model = new EyouSoft.Model.ShopStructure.HighShopAdv(); model.CompanyID = CompanyId; model.IssueTime = System.DateTime.Now; model.SortID = Utils.GetInt(Utils.InputText(((TextBox)Page.FindControl("txtSort" + i.ToString())).Text)); string url = url = Utils.InputText(((TextBox)Page.FindControl("txtLinkAddress" + i.ToString())).Text); model.LinkAddress = url; if (url != "") { if (url.IndexOf("http://") < 0) { model.LinkAddress = Utils.InputText("http://" + url); } } model.OperatorID = this.SiteUserInfo.ID; list.Add(model); } string newImgPath1 = Utils.GetFormValue("sfupic1$hidFileName"); string newImgPath2 = Utils.GetFormValue("sfupic2$hidFileName"); string newImgPath3 = Utils.GetFormValue("sfupic3$hidFileName"); string newImgPath4 = Utils.GetFormValue("sfupic4$hidFileName"); string newImgPath5 = Utils.GetFormValue("sfupic5$hidFileName"); if (newImgPath1.Length > 0) { list[0].ImagePath = newImgPath1; } else { list[0].ImagePath = Utils.GetFormValue(hdfAgoImgPath1.UniqueID); } if (newImgPath2.Length > 0) { list[1].ImagePath = newImgPath2; } else { list[1].ImagePath = Utils.GetFormValue(hdfAgoImgPath2.UniqueID); } if (newImgPath3.Length > 0) { list[2].ImagePath = newImgPath3; } else { list[2].ImagePath = Utils.GetFormValue(hdfAgoImgPath3.UniqueID); } if (newImgPath4.Length > 0) { list[3].ImagePath = newImgPath4; } else { list[3].ImagePath = Utils.GetFormValue(hdfAgoImgPath4.UniqueID); } if (newImgPath5.Length > 0) { list[4].ImagePath = newImgPath5; } else { list[4].ImagePath = Utils.GetFormValue(hdfAgoImgPath5.UniqueID); } if (ids != null) { for (int i = 0; i < ids.Length; i++) { list[i].ID = ids[i]; } } if (EyouSoft.BLL.ShopStructure.HighShopAdv.CreateInstance().Update(CompanyId, list)) { MessageBox.ResponseScript(this.Page, "alert(\"操作成功!\");parent.Boxy.getIframeDialog('" + Request.QueryString["iframeId"] + "').hide(function(){window.parent.location.reload();});"); } else { EyouSoft.Common.Function.MessageBox.ResponseScript(this.Page, "alert('操作失败!');"); } list = null; model = null; }