public string show_list() { pagesize = 16; int pi = string.IsNullOrEmpty(Request.QueryString["current"]) ? 1 : int.Parse(Request.QueryString["current"]); pageindex = pi; System.Text.StringBuilder s = new System.Text.StringBuilder(); SOSOshop.BLL.Db db = new SOSOshop.BLL.Db(); db.ChangeShop(); #region 数据查询 string sql = string.Format("select top {0} *," + "ISNULL((SELECT Product_ID FROM product_online_v WHERE Product_ID=a.Product_ID),0)st," +//是否上架(在前台显示) "(select b.Price_01 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_01," + "(select b.Price_02 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_02," + "(select stock from product_online_v_1 as c where c.Product_ID=a.Product_ID) as stock," + "(select isnull(stock,0) from Stock_Lock as c where c.Product_ID=a.Product_ID) as stock1" + "{1} WHERE (a.Product_ID NOT IN(SELECT TOP ({0} * ({2} - 1)) a.Product_ID {1} {3} order by a.Product_ID desc)) {4} order by a.Product_ID desc", pagesize, getFrom(), pageindex, where.Length > 1 ? " where 1=1 " + where : "", where); SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument> dbM = new SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument>("Config"); dbM.ChangeDB("datasynchronism"); var cli = dbM._mongoCollection.FindAll(); DataTable dt = db.ExecuteTable(sql); #endregion //生成HTML s = GetHtml(dt); return(s.ToString()); }
public string show_list() { pagesize = 16; int pi = string.IsNullOrEmpty(Request.QueryString["current"]) ? 1 : int.Parse(Request.QueryString["current"]); pageindex = pi; System.Text.StringBuilder s = new System.Text.StringBuilder(); SOSOshop.BLL.Db db = new SOSOshop.BLL.Db(); string sql = string.Format("select top {0} *," + "ISNULL((SELECT Product_ID FROM product_online_v WHERE Product_ID=a.Product_ID),0)st," +//是否上架(在前台显示) "(select b.Price_01 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_01," + "(select b.Price_02 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_02," + "(select stock from product_online_v_1 as c where c.Product_ID=a.Product_ID) as stock," + "(select isnull(stock,0) from Stock_Lock as c where c.Product_ID=a.Product_ID) as stock1" + "{1} WHERE (a.Product_ID NOT IN(SELECT TOP ({0} * ({2} - 1)) a.Product_ID {1} {3} order by a.Product_ID desc)) {4} order by a.Product_ID desc", pagesize, getFrom(), pageindex, where.Length > 1 ? " where 1=1 " + where : "", where); //Response.Write(sql); //Response.End(); SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument> dbM = new SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument>("Config"); dbM.ChangeDB("datasynchronism"); var cli = dbM._mongoCollection.FindAll(); DataTable dt = db.ExecuteTable(sql); foreach (DataRow item in dt.Rows) { s.Append("<tr>"); s.Append(table(item["Product_ID"])); s.Append(table("<a title='" + item["created"] + "'>" + item["Product_Name"] + "</a>")); var Specification = Public.GetSpecificationAndS(item) + "x" + item["Goods_Pcs"]; s.Append("<td title='规格:" + Specification + " 剂型:" + item["DrugsBase_Formulation"] + "'><div class='textOverFlow'>" + Specification + "<div></td>");//+ +item["DrugsBase_Specification"].ToString() + "x" + item["Goods_ConveRatio"].ToString() + "x" + item["Goods_Pcs"].ToString() + "</td>"); s.Append(table(item["DrugsBase_ApprovalNumber"])); s.Append(table(item["DrugsBase_Manufacturer"])); decimal Price_01 = 0; decimal.TryParse(Convert.ToString(item["Price_01"]), out Price_01); s.Append(table(string.Format("{0:f2}", Price_01))); decimal Price_02 = 0; decimal.TryParse(Convert.ToString(item["Price_02"]), out Price_02); s.Append(table(string.Format("{0:f2}", Price_02))); if (!Library.Lang.DataValidator.isNumber(item["stock"])) { item["stock"] = 0; } if (!Library.Lang.DataValidator.isNumber(item["stock1"])) { item["stock1"] = 0; } s.Append(table(string.Format("<a title='库存:{1},锁库:{2}'>{0}</a>", int.Parse(item["stock"].ToString()) - int.Parse(item["stock1"].ToString()), item["stock"], item["stock1"]))); s.Append(table(_101shop.Common.SellType.GetType(int.Parse(item["sellType"].ToString())))); //s.Append(table(Convert.ToString(item["is_cl"]).Trim() == "" ? "否" : Convert.ToString(item["is_cl"]).Trim()));//可拆零 //非停用药品处理上下架操作 string disabled = ""; if ((int)item["st"] == 0) { if ((int)item["Product_bShelves"] == 0) { s.Append(table("下架")); } else { if ((int)item["Product_bShelves"] == -1) { s.Append(table("暂不上架")); } else { s.Append(table("待上架")); disabled = "disabled"; } } } else { s.Append(table("上架")); } s.Append(table("<a href='javascript:putad(" + item["product_id"] + ")'>放入广告位</a>")); s.Append("</tr>"); } return(s.ToString()); }
public string show_list() { pagesize = 1000; int pi = string.IsNullOrEmpty(Request.QueryString["current"]) ? 1 : int.Parse(Request.QueryString["current"]); pageindex = pi; System.Text.StringBuilder s = new System.Text.StringBuilder(); SOSOshop.BLL.Db db = new SOSOshop.BLL.Db(); string sql = string.Format("select *," + "(SELECT top 1 fullPath FROM dbo.Tag_PharmAttribute WHERE id IN (SELECT Tag_PharmAttribute_id FROM dbo.Tag_PharmProduct WHERE product_id=a.DrugsBase_ID AND Tag_PharmAttribute_id IN (SELECT id FROM dbo.Tag_PharmAttribute WHERE tag_id=69)))fullPath," + "(select count(*) from [exchange].[dbo].[LinkRegionBidPricing]a1 where a1.goods_id=a.goods_id) as 中标," + "(select count(*) from [exchange].[dbo].[LinkRegionLimitPricing]b1 where b1.goods_id=a.goods_id) as 挂网," + "(select p2.cgy from dbo.spzl p1 inner join dbo.spzl_jg p2 on p1.spid=p2.spid AND p1.sx1=p2.jigid and p1.spid=a.spid) as cgy," + //采购员 //"(select b.is_cl from product_online_v_1 as b where b.Product_ID= a.Product_ID) as is_cl," +//可拆零 "(select b.Price_01 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_01," + "(select b.Price_02 from product_online_v_1 as b where b.Product_ID= a.Product_ID) as price_02," + "ISNULL((SELECT Product_ID FROM product_online_v WHERE Product_ID=a.Product_ID),0)st," +//是否上架(在前台显示) "(select stock from product_online_v_1 as c where c.Product_ID=a.Product_ID) as stock," + "(select isnull(stock,0) from Stock_Lock as c where c.Product_ID=a.Product_ID) as stock1," + "(SELECT iden FROM dbo.Product_Centre WHERE product_id=a.Product_ID) iden," + "ISNULL((SELECT 1 FROM DrugsBase_ZYC WHERE DrugsBase_ID=a.DrugsBase_ID),0) is_ZYC," + "(select p2.jigid from dbo.spzl p1 inner join dbo.spzl_jg p2 on p1.spid=p2.spid AND p1.sx1=p2.jigid and p1.spid=a.spid) as es " +//e商 "{1} WHERE (a.Product_ID NOT IN(SELECT TOP ({0} * ({2} - 1)) a.Product_ID {1} {3} order by a.Product_ID desc)) {4} order by a.Product_ID desc", pagesize, getFrom(), pageindex, where.Length > 1 ? " where 1=1 " + where : "", where); DataTable dt = db.ExecuteTable(sql); SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument> dbM = new SOSOshop.BLL.MongoHelper <MongoDB.Bson.BsonDocument>("Config"); dbM.ChangeDB("datasynchronism"); var cli = dbM._mongoCollection.FindAll(); foreach (DataRow item in dt.Rows) { s.Append("<tr>"); s.Append(table(item["Product_ID"])); s.Append(table(item["Product_Name"])); s.Append("<td>" + Public.GetSpecificationAndS(item) + "x" + item["Goods_Pcs"] + "</td>");//+ +item["DrugsBase_Specification"].ToString() + "x" + item["Goods_ConveRatio"].ToString() + "x" + item["Goods_Pcs"].ToString() + "</td>"); s.Append(table(item["DrugsBase_Formulation"])); s.Append(table(item["DrugsBase_ApprovalNumber"])); s.Append(table(item["DrugsBase_Manufacturer"])); s.Append(table(item["Product_Advertisement"])); s.Append(table(item["Product_SellingPoint"])); decimal Price_01 = 0; decimal.TryParse(Convert.ToString(item["Price_01"]), out Price_01); s.Append(table(string.Format("{0:f2}", Price_01))); decimal Price_02 = 0; decimal.TryParse(Convert.ToString(item["Price_02"]), out Price_02); s.Append(table(string.Format("{0:f2}", Price_02))); if (!Library.Lang.DataValidator.isNumber(item["stock"])) { item["stock"] = 0; } if (!Library.Lang.DataValidator.isNumber(item["stock1"])) { item["stock1"] = 0; } s.Append(table(string.Format("<a title='库存:{1},锁库:{2}'>{0}</a>", int.Parse(item["stock"].ToString()) - int.Parse(item["stock1"].ToString()), item["stock"], item["stock1"]))); //e商 s.Append(table(item["es"])); //供货商 string iden = "101"; if (cli.Count() > 0 && !item.IsNull("iden") && Library.Lang.DataValidator.isNumber(item["iden"])) { var idens = cli.Where(x => x["_id"].AsString == item["iden"].ToString()); if (idens.Count() > 0) { iden = idens.First()["_id"].AsString; } } s.Append(table(iden)); if ("1" == Request["bBq1"]) { s.Append(table(0 < (int)item["中标"] ? "中标基本药物" : "调入基本药物")); if (item["fullPath"] != DBNull.Value) { s.Append(table(fullPath((string)item["fullPath"]))); } else { s.Append(table("")); } } s.Append(table(_101shop.Common.SellType.GetType(int.Parse(item["sellType"].ToString())))); //s.Append(table(Convert.ToString(item["is_cl"]).Trim() == "" ? "否" : Convert.ToString(item["is_cl"]).Trim()));//可拆零 s.Append(table(item["cgy"])); if ((int)item["st"] == 0) { if ((int)item["Product_bShelves"] == 0) { s.Append(table("下架")); } else { if ((int)item["Product_bShelves"] == -1) { s.Append(table("暂不上架")); } else { s.Append(table("<a title='单击变更状态为暂不上架' style='' class='dbShelves' href='javascript:ishelves(-1, " + item["Product_id"] + ")'>待上架</a>")); } } } else { s.Append(table("上架")); } s.Append("</tr>"); } string jystr = ""; if ("1" == Request["bBq1"]) { jystr = @" <th scope='col'> 药品属性 </th> <th scope='col'> 基药分类 </th>"; } return(string.Format("<table border='1'><tbody><tr><th>商品编号</th><th>商品名称</th><th>规格(含转换比、件装</th><th>剂型</th><th>批准文号</th>" + "<th>生产厂家</th><th>广告词</th><th>卖点</th><th>批发价</th><th>OTC价</th><th>库存</th><th>e商</th><th>供应商</th>" + jystr + "<th>销售方式</th><th scope=col>采购员</th><th>状态</th></tr></tbody>{0}</table>", s.ToString())); }