private void GetGoodsList(string strSql) { Chain.BLL.Goods bllGoods = new Chain.BLL.Goods(); int Counts = this.NetPagerParameter.RecordCount; strSql = strSql + " and Goods.GoodsClassID = GoodsClass.ClassID and Goods.GoodsID = GoodsNumber.GoodsID and GoodsNumber.ShopID=" + this.sltShop.Value; DataTable dtGoods = bllGoods.GetListSP(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[] { strSql }).Tables[0]; this.NetPagerParameter.RecordCount = Counts; this.NetPagerParameter.CustomInfoHTML = string.Format("<div class=\"results\"><span>当前第{0}/{1}页 共{2}条记录 每页{3}条</span></div>", new object[] { this.NetPagerParameter.CurrentPageIndex, this.NetPagerParameter.PageCount, this.NetPagerParameter.RecordCount, this.NetPagerParameter.PageSize }); this.gvGoodsList.DataSource = dtGoods; this.gvGoodsList.DataBind(); PageBase.BindSerialRepeater(this.gvGoodsList, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1)); Chain.BLL.MemCustomField bllCustom = new Chain.BLL.MemCustomField(); List <Chain.Model.MemCustomField> fieldlist = bllCustom.GetModelList("CustomType=2 and CustomFieldIsShow=1"); if (fieldlist.Count > 0) { StringBuilder strHeader = new StringBuilder(); StringBuilder strHtml = new StringBuilder(); for (int i = 0; i < this.gvGoodsList.Items.Count; i++) { Literal ltlGoodsID = (Literal)this.gvGoodsList.Items[i].FindControl("ltlGoodsID"); Literal ltlHtml = (Literal)this.gvGoodsList.Items[i].FindControl("ltlHtml"); int GoodsID = Convert.ToInt32(ltlGoodsID.Text); DataRow[] drGoods = dtGoods.Select(string.Format(" GoodsID = {0}", GoodsID)); strHtml.Length = 0; foreach (Chain.Model.MemCustomField mdCustomField in fieldlist) { if (i == 0) { strHeader.AppendFormat("<th>{0}</th>", mdCustomField.CustomFieldName); } strHtml.AppendFormat("<td>{0}</td>", drGoods[0][mdCustomField.CustomField]); } ltlHtml.Text = strHtml.ToString(); } this.ltlHeader.Text = strHeader.ToString(); } }
protected void btnOut_Click(object sender, EventArgs e) { Chain.BLL.Goods bllGoods = new Chain.BLL.Goods(); int Counts = this.NetPagerParameter.RecordCount; string strSql = this.QueryCondition(); strSql += " and Goods.GoodsClassID = GoodsClass.ClassID and Goods.GoodsID = GoodsNumber.GoodsID"; strSql = PubFunction.GetShopAuthority(this._UserShopID, "ShopID", strSql); DataTable dtGoods = bllGoods.GetListSP(100000, 1, out Counts, new string[] { strSql }).Tables[0]; DataExcelInfo.GoodsListExcel(dtGoods, this._UserName); }