예제 #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 page()
        {
            param  = "&shopname=" + Request["shopname"];
            param += "&changjia=" + Request["changjia"];
            param += "&pihao=" + Request["pihao"];
            param += "&Price=" + Request["Price"];
            param += "&is_cl=" + Request["is_cl"];
            param += "&sellType=" + Request["sellType"];
            param += "&es=" + Request["es"];
            param += "&bStock=" + Request["bStock"];
            param += "&bShelves=" + Request["bShelves"];
            param += "&bGoodsImage=" + Request["bGoodsImage"];
            param += "&bMaid=" + Request["bMaid"];
            param += "&bGgy=" + Request["bGgy"];
            param += "&bQtzs=" + Request["bQtzs"];
            param += "&bJyQtzs=" + Request["bJyQtzs"];
            param += "&bYsJg=" + Request["bYsJg"];
            param += "&bYsFl=" + Request["bYsFl"];
            param += "&cgy=" + Request["cgy"];
            param += "&bKong=" + Request["bKong"];
            param += "&cuxiao=" + Request["cuxiao"];
            param += "&bSms=" + Request["bSms"] + "&bYlyx=" + Request["bYlyx"] +
                     "&bBq1=" + Request["bBq1"] + "&bBq2=" + Request["bBq2"] + "&bBq3=" + Request["bBq3"] + "&bgys=" + Request["bgys"]
                     + "&bjgqj=" + Request["bjgqj"]
                     + "&bjgqj_s=" + Request["bjgqj_s"]
                     + "&bjgqj_e=" + Request["bjgqj_e"]
                     + "&bStock_s=" + Request["bStock_s"]
                     + "&bStock_e=" + Request["bStock_e"];
            SOSOshop.BLL.Db db  = new SOSOshop.BLL.Db();
            string          sql = "select count(a.product_name) as c" + getFrom() + (where.Length > 1 ? " where 1=1 " + where + "" : "");
            //Response.Write(sql);
            int    recordcount = (int)db.ExecuteTable(sql).Rows[0]["c"];
            double cs          = (double)recordcount / pagesize;

            //页总数
            pagecount = int.Parse(Math.Ceiling(cs).ToString());
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            s.Append("共<span style='color: Red'>" + recordcount + "</span>条记录");
            s.Append("<a href=\"?current=1" + param + "\">");
            s.Append("<<");
            s.Append("</a> ");
            int j, i;

            j = i = 0;
            if (pageindex > 5)
            {
                i = pageindex - 5;
                j = i;
            }
            for (; i < j + 9 && i < pagecount; i++)
            {
                s.Append("<a href=\"?current=" + (i + 1) + param +
                         (pageindex == i + 1 ? "\" style=\"color:Red" : "")
                         + "\">");
                s.Append(i + 1);
                s.Append("</a> ");
            }
            s.Append("<a href=\"?current=" + pagecount + param + "\">");
            s.Append(">>");
            s.Append("</a> ");

            return(s.ToString());
        }
예제 #3
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());
        }