예제 #1
0
        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());
        }
예제 #2
0
        public string show_list()
        {
            pagesize = 16;
            int pi = string.IsNullOrEmpty(Request.QueryString["current"]) ? 1 : int.Parse(Request.QueryString["current"]);

            pageindex = pi;
            StringBuilder s = new StringBuilder();

            #region 数据查询
            SOSOshop.BLL.Db db       = new SOSOshop.BLL.Db();
            string          orderDjl = "";
            switch (Request["bDjl"])
            {
            case "1":
                orderDjl = "a.Product_ClickNum asc,";
                break;

            case "2":
                orderDjl = "a.Product_ClickNum desc,";
                break;
            }
            string sql = string.Format("select top {0} *," +
                                       " cgy," +                                                                                //采购员
                                                                                                                                //"(select b.is_cl from product_online_v_1 as b where b.Product_ID= a.Product_ID) as is_cl," +//可拆零
                                       "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," +
                                       "ISNULL((SELECT 1 FROM DrugsBase_ZYC WHERE DrugsBase_ID=a.DrugsBase_ID),0) is_ZYC " +
                                       "{1} WHERE (a.Product_ID NOT IN(SELECT TOP ({0} * ({2} - 1)) a.Product_ID {1} {3} order by {5}a.Product_ID desc)) {4} order by {5}a.Product_ID desc", pagesize, getFrom(), pageindex, where.Length > 1 ? " where 1=1 " + where : "", where, orderDjl);
            db.ChangeShop();
            DataTable dt = db.ExecuteTable(sql);
            #endregion

            #region 报表导出
            if (Request["input"] == "导出")
            {
                sql = string.Format("select " +
                                    "Product_id 商品编号,spid ERP编号,Product_Name 商品名,DrugsBase_ApprovalNumber 批准文号,DrugsBase_Manufacturer 生产厂家,DrugsBase_DrugName 通用名,DrugsBase_Formulation 剂型,Goods_ConveRatio 转换比,Goods_ConveRatio_Unit 转换比单位,Goods_Pcs 件装,Goods_Pcs_Small 中包装,Goods_Unit 包装单位,DrugsBase_Specification 规格, cgy 采购员 " +
                                    "{1} WHERE 1=1 {4} order by {5}a.Product_ID desc", int.MaxValue, getFrom(), 0, where.Length > 1 ? "" + where : "", where, orderDjl);
                dt = db.ExecuteTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows.Count < 10)
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            var dr = dt.NewRow();
                            dt.Rows.Add(dr.ItemArray);
                        }
                    }
                }

                ExportExcel(string.Format("商品数据_{0}.xls", DateTime.Now.ToString("yyyy-MM-dd")), dt.DataSet);
                return("");
            }
            #endregion

            //生成HTML
            s = GetHtml(dt);
            return(s.ToString());
        }