public void Member_Top_Favoriets() { StringBuilder strHTML = new StringBuilder(); int member_id = tools.CheckInt(Session["member_id"].ToString()); string productURL = string.Empty; //string targetURL = ""; QueryInfo Query = new QueryInfo(); Query.PageSize = 5; Query.CurrentPage = 1; Query.ParamInfos.Add(new ParamInfo("AND", "int", "MemberFavoritesInfo.Member_Favorites_MemberID", "=", member_id.ToString())); Query.ParamInfos.Add(new ParamInfo("AND", "int", "MemberFavoritesInfo.Member_Favorites_Type", "=", "0")); Query.OrderInfos.Add(new OrderInfo("MemberFavoritesInfo.Member_Favorites_ID", "Desc")); IList <MemberFavoritesInfo> favoriates = MyFavor.GetMemberFavoritess(Query); strHTML.Append("<div class=\"li01_box\">"); if (favoriates != null) { foreach (MemberFavoritesInfo entity in favoriates) { ProductInfo product = MyProduct.GetProductByID(entity.Member_Favorites_TargetID, pub.CreateUserPrivilege("ae7f5215-a21a-4af2-8d47-3cda2e1e2de8")); if (product != null) { productURL = tools.NullStr(Application["Site_URL"]).TrimEnd('/') + pageurl.FormatURL(pageurl.product_detail, product.Product_ID.ToString()); if (product.Product_IsInsale == 0 || product.Product_IsAudit == 0) { continue; } // productURL = pageurl.FormatURL(pageurl.product_detail, product.Product_ID.ToString()); strHTML.Append("<dl>"); strHTML.Append("<dt><a href=\"" + productURL + "\" target=\"_blank\">"); strHTML.Append("<img src=\"" + pub.FormatImgURL(product.Product_Img, "thumbnail") + "\" /></a></dt>"); strHTML.Append("<dd>"); strHTML.Append("<p><a href=\"" + productURL + "\" target=\"_blank\">" + product.Product_Name + "</a></p>"); //if (product.Product_PriceType == 1) //{ //strHTML.Append("<p>" + pub.FormatCurrency(product.Product_Price) + "</p>"); strHTML.Append("<p>" + pub.FormatCurrency(pub.Get_Member_Price(product.Product_ID, product.Product_Price)) + "</p>"); //} //else //{ // strHTML.Append("<p>" + pub.FormatCurrency(pub.GetProductPrice(product.Product_ManualFee, product.Product_Weight)) + "</p>"); //} strHTML.Append("</dd>"); strHTML.Append("<div class=\"clear\"></div>"); strHTML.Append("</dl>"); } } } else { strHTML.Append("<span class=\"tip\">暂无收藏的商品</span>"); } strHTML.Append("</div>"); Response.Write(strHTML.ToString()); }
public void GetPackages() { string keyword = tools.CheckStr(Request["keyword"]); int isinsale = tools.CheckInt(Request["isinsale"]); string PageUrl = "?keyword=" + keyword; QueryInfo Query = new QueryInfo(); Query.PageSize = 15; Query.CurrentPage = tools.CheckInt(Request["page"]); if (Query.CurrentPage < 1) { Query.CurrentPage = 1; } //Query.ParamInfos.Add(new ParamInfo("AND", "str", "PackageInfo.Package_Site", "=", pub.GetCurrentSite())); Query.ParamInfos.Add(new ParamInfo("AND", "int", "PackageInfo.Package_SupplierID", "=", tools.NullInt(Session["supplier_id"]).ToString())); if (isinsale == 1) { Query.ParamInfos.Add(new ParamInfo("AND", "int", "PackageInfo.Package_IsInsale", "=", "1")); } else if (isinsale == 2) { Query.ParamInfos.Add(new ParamInfo("AND", "int", "PackageInfo.Package_IsInsale", "=", "0")); } if (keyword.Length > 0) { Query.ParamInfos.Add(new ParamInfo("AND", "str", "PackageInfo.Package_Name", "like", keyword)); } Query.OrderInfos.Add(new OrderInfo("PackageInfo.Package_ID", "DESC")); //Response.Write("<table class=\"commontable\">"); //Response.Write("<tr>"); Response.Write("<table width=\"100%\" cellpadding=\"0\" align=\"center\" cellspacing=\"1\" style=\"background:#dadada;\" >"); Response.Write("<tr style=\"background:url(/images/ping.jpg); height:30px;\">"); Response.Write(" <th align=\"center\" valign=\"middle\">名称</th>"); Response.Write(" <th width=\"100\" align=\"center\" valign=\"middle\">捆绑价格</th>"); Response.Write(" <th width=\"100\" align=\"center\" valign=\"middle\">重量</th>"); Response.Write(" <th width=\"100\" align=\"center\" valign=\"middle\">销售状态</th>"); Response.Write(" <th width=\"100\" align=\"center\" valign=\"middle\">添加时间</th>"); Response.Write(" <th width=\"80\" align=\"center\" valign=\"middle\">操作</th>"); Response.Write("</tr>"); PageInfo pageinfo = MyBLL.GetPageInfo(Query, pub.CreateUserPrivilege("0dd17a70-862d-4e57-9b45-897b98e8a858")); IList <PackageInfo> entitys = MyBLL.GetPackages(Query, pub.CreateUserPrivilege("0dd17a70-862d-4e57-9b45-897b98e8a858")); if (entitys != null) { foreach (PackageInfo entity in entitys) { Response.Write("<tr bgcolor=\"#ffffff\">"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">" + entity.Package_Name + "</td>"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">" + pub.FormatCurrency(entity.Package_Price) + "</td>"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">" + entity.Package_Weight + "</td>"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">"); if (entity.Package_IsInsale == 1) { Response.Write("上架"); } else { Response.Write("下架"); } Response.Write("</td>"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">" + entity.Package_Addtime + "</td>"); Response.Write("<td height=\"35\" align=\"center\" valign=\"middle\">"); Response.Write("<a href=\"/supplier/package_edit.aspx?package_id=" + entity.Package_ID + "\">修改</a>"); Response.Write(" <a href=\"/supplier/package_do.aspx?action=move&package_id=" + entity.Package_ID + "\">删除</a>"); Response.Write("</td>"); Response.Write("</tr>"); } Response.Write("</table>"); Response.Write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" align=\"center\" cellpadding=\"2\"><tr><td align=\"right\" height=\"10\"></td></tr><tr><td align=\"right\"><div class=\"page\" style=\"float:right;\">"); pub.Page(pageinfo.PageCount, pageinfo.CurrentPage, PageUrl, pageinfo.PageSize, pageinfo.RecordCount); Response.Write("</div></td></tr></table>"); } else { Response.Write("<tr bgcolor=\"#ffffff\"><td height=\"35\" colspan=\"8\" align=\"center\">没有记录</td></tr>"); Response.Write("</table>"); } }
/// <summary> /// 搜索店铺下商品 /// </summary> /// <param name="supplier_id"></param> /// <returns></returns> public string ShopProducts(int supplier_id) { StringBuilder strHTML = new StringBuilder(); QueryInfo Query = new QueryInfo(); Query.PageSize = 3; Query.CurrentPage = 1; Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductInfo.Product_Site", "=", pub.GetCurrentSite())); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_IsInsale", "=", "1")); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_IsAudit", "=", "1")); Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductInfo.Product_SupplierID", "=", supplier_id.ToString())); Query.OrderInfos.Add(new OrderInfo("ProductInfo.Product_Sort", "ASC")); Query.OrderInfos.Add(new OrderInfo("ProductInfo.Product_ID", "DESC")); IList <ProductInfo> entitys = Myproduct.GetProductList(Query, pub.CreateUserPrivilege("ae7f5215-a21a-4af2-8d47-3cda2e1e2de8")); if (entitys != null) { string targetURL = string.Empty; foreach (ProductInfo entity in entitys) { targetURL = pageurl.FormatURL(pageurl.product_detail, entity.Product_ID.ToString()); strHTML.Append("<li><div class=\"img_box\"><a href=\"" + targetURL + "\" target=\"_blank\"><img src=\"" + pub.FormatImgURL(entity.Product_Img, "thumbnail") + "\" alt=\"" + entity.Product_Name + "\" /></a><i><a href=\"" + targetURL + "\" target=\"_blank\">" + entity.Product_Name + "</a></i></div><p><span>成交 " + entity.Product_SaleAmount + "个</span><strong>" + (entity.Product_PriceType == 1 ? pub.FormatCurrency(entity.Product_Price) : pub.FormatCurrency(pub.GetProductPrice(entity.Product_ManualFee, entity.Product_Weight))) + "</strong></p></li>"); } } entitys = null; return(strHTML.ToString()); }
/// <summary> /// 销售量(额)排名 /// </summary> /// <returns></returns> public string SalesAmountRanked() { string orders_status = tools.CheckStr(Request["orders_status"]); DateTime startDate; if (!DateTime.TryParse(tools.CheckStr(Request["startdate"]), out startDate)) { startDate = DateTime.Today.AddDays(-15); } DateTime endDate; if (!DateTime.TryParse(tools.CheckStr(Request["endDate"]), out endDate)) { endDate = DateTime.Today; } int PageSize = tools.CheckInt(Request["rows"]); int CurrentPage = tools.CheckInt(Request["page"]); int RecordCount = 0; int PageCount = 0; string SqlField = "G.Orders_Goods_Product_ID, SUM(Orders_Goods_Amount) AS saleCount, SUM(Orders_Goods_Product_Price * Orders_Goods_Amount) AS saleSum"; string SqlTable = "Orders_Goods AS G INNER JOIN Orders AS O ON G.Orders_Goods_OrdersID = O.Orders_ID"; string SqlOrder = "ORDER BY " + tools.CheckStr(Request["sidx"]) + " " + tools.CheckStr(Request["sord"]); string SqlParam = " WHERE O.Orders_Site = 'CN' AND Orders_SupplierID = " + tools.NullInt(Session["supplier_id"]); SqlParam += " AND DATEDIFF(d, O.Orders_Addtime, '" + startDate + "') <= 0 AND DATEDIFF(d, O.Orders_Addtime, '" + endDate + "') >= 0"; if (orders_status == "confirm") { SqlParam += " AND (Orders_Status > 0 AND Orders_Status < 3)"; } if (orders_status == "success") { SqlParam += " AND Orders_Status = 2"; } string SqlCount = "SELECT COUNT(DISTINCT Orders_Goods_Product_ID) FROM " + SqlTable + " " + SqlParam; DataTable DtList = null; try { RecordCount = (int)DBHelper.ExecuteScalar(SqlCount); PageCount = tools.CalculatePages(RecordCount, PageSize); CurrentPage = tools.DeterminePage(CurrentPage, PageCount); string SqlList = "SELECT * FROM (SELECT " + SqlField + " , ROW_NUMBER() OVER (" + SqlOrder + ") AS RowNumber FROM " + SqlTable + " " + SqlParam + " GROUP BY (G.Orders_Goods_Product_ID) ) AS T WHERE RowNumber > " + (CurrentPage - 1) * PageSize + " AND RowNumber < " + ((CurrentPage * PageSize) + 1); int Product_ID, saleCount, Supplier_ID; string Product_Name, Product_Code, Product_Spec, Supplier_Name, Cate_Name; double saleSum; DtList = DBHelper.Query(SqlList); if (DtList.Rows.Count > 0) { ProductInfo pEntity; SupplierInfo sEntity; CategoryInfo cEntity; StringBuilder jsonBuilder = new StringBuilder(); jsonBuilder.Append("{\"page\":" + CurrentPage + ",\"total\":" + PageCount + ",\"records\":" + RecordCount + ",\"rows\""); jsonBuilder.Append(":["); foreach (DataRow DrList in DtList.Rows) { Product_ID = tools.NullInt(DrList["Orders_Goods_Product_ID"]); saleCount = tools.NullInt(DrList["saleCount"]); saleSum = tools.NullDbl(DrList["saleSum"]); pEntity = product.GetProductByID(Product_ID); if (pEntity != null) { Product_Name = pEntity.Product_Name; //Product_Code = pEntity.Product_Code; Product_Spec = pEntity.Product_Spec; Supplier_ID = pEntity.Product_SupplierID; sEntity = supplier.GetSupplierByID(Supplier_ID); if (sEntity != null) { Supplier_Name = sEntity.Supplier_CompanyName; } else { Supplier_Name = Supplier_ID.ToString(); } sEntity = null; cEntity = category.GetCategoryByID(pEntity.Product_CateID, pub.CreateUserPrivilege("2883de94-8873-4c66-8f9a-75d80c004acb")); if (cEntity != null) { Cate_Name = cEntity.Cate_Name; } else { Cate_Name = pEntity.Product_CateID.ToString(); } } else { Product_Name = ""; //Product_Code = ""; Product_Spec = ""; Supplier_Name = string.Empty; Cate_Name = string.Empty; } pEntity = null; jsonBuilder.Append("{\"id\":" + Product_ID + ",\"cell\":["); //各字段 jsonBuilder.Append("\""); jsonBuilder.Append(Product_ID); jsonBuilder.Append("\","); //jsonBuilder.Append("\""); //jsonBuilder.Append(JsonStr(Product_Code)); //jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(JsonStr(Product_Name)); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(JsonStr(Supplier_Name)); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(JsonStr(Cate_Name)); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(JsonStr(Product_Spec)); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(saleCount); jsonBuilder.Append("\","); jsonBuilder.Append("\""); jsonBuilder.Append(pub.FormatCurrency(saleSum)); jsonBuilder.Append("\","); jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]},"); } jsonBuilder.Remove(jsonBuilder.Length - 1, 1); jsonBuilder.Append("]"); jsonBuilder.Append("}"); return(jsonBuilder.ToString()); } else { return(""); } } catch (Exception ex) { throw ex; return(""); } finally { if (DtList != null) { DtList.Dispose(); DtList = null; } } }
public void GetPromotionLimitis() { string page_url = ""; int curr_page = tools.CheckInt(Request["page"]); if (curr_page < 1) { curr_page = 1; } page_url = "/Promotion/Promotioning.aspx?flag=1"; int i = 0; QueryInfo Query = new QueryInfo(); Query.PageSize = 100; Query.CurrentPage = curr_page; Query.ParamInfos.Add(new ParamInfo("AND", "str", "PromotionLimitInfo.Promotion_Limit_Site", "=", "CN")); Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(s,{PromotionLimitInfo.Promotion_Limit_Starttime},'" + DateTime.Now + "')", ">=", "0")); Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(s,{PromotionLimitInfo.Promotion_Limit_Endtime},'" + DateTime.Now + "')", "<=", "0")); Query.OrderInfos.Add(new OrderInfo("PromotionLimitInfo.Promotion_Limit_Starttime", "ASC")); IList <PromotionLimitInfo> entitys = MyLimits.GetPromotionLimits(Query, pub.CreateUserPrivilege("22d21441-155a-4dc5-aec6-dcf5bdedd5cf")); PageInfo pageinfo = MyLimits.GetPageInfo(Query, pub.CreateUserPrivilege("22d21441-155a-4dc5-aec6-dcf5bdedd5cf")); if (entitys != null) { Response.Write(" <div id=\"webwrap\">"); Response.Write(" <div class=\"blk01\">"); Response.Write(" <ul class=\"lst1\">"); foreach (PromotionLimitInfo entity in entitys) { i++; Response.Write("<li><p class=\"p1\" id=\"limit_tip_" + i + "\" name=\"limit_tip\">"); TimeSpan span1 = entity.Promotion_Limit_Endtime - DateTime.Now; int timespan; timespan = (span1.Days * (24 * 3600)) + (span1.Hours * 3600) + (span1.Minutes * 60) + (span1.Seconds); Response.Write(" "); Response.Write("<script>updatetime1(" + timespan + ",'limit_tip_" + i + "')</script>"); Response.Write("</p>"); ProductInfo productinfo = myproduct.GetProductByID(entity.Promotion_Limit_ProductID); if (productinfo != null) { Response.Write("<a class=\"a2\" href=\"/Product/detail.aspx?Product_ID=" + entity.Promotion_Limit_ProductID + "\" target=\"_blank\" alt=\"" + productinfo.Product_Name + "\" title=\"" + productinfo.Product_Name + "\"><img src=\"" + pub.FormatImgURL(productinfo.Product_Img, "fullpath") + "\" width=\"170\" height=\"170\" onload=\"javascript:AutosizeImage(this,170,170);\"></a><p class=\"p2\"><a href=\"/Product/detail.aspx?Product_ID=" + entity.Promotion_Limit_ProductID + "\" target=\"_blank\" alt=\"" + productinfo.Product_Name + "\" title=\"" + productinfo.Product_Name + "\">" + productinfo.Product_Name + "</a></p>"); Response.Write("<p>原价:<span class=\"sp01\">¥" + pub.FormatCurrency(myproduct.Get_Member_Price(productinfo.Product_ID, productinfo.Product_Price)) + "</span></p>"); } Response.Write(" <p>抢购价: <strong>" + pub.FormatCurrency(entity.Promotion_Limit_Price) + "</strong></p>"); Response.Write("<a href=\"/Product/detail.aspx?Product_ID=" + entity.Promotion_Limit_ProductID + "\" target=\"_blank\" class=\"a1\"></a></li>"); } Response.Write("</ul><div class=\"clear\"></div>"); Response.Write("<div class=\"clear\"></div>"); Response.Write("</div>"); Response.Write("<table width=\"940px\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">"); Response.Write("<tr><td height=\"10\"></td></tr>"); Response.Write("<tr><td align=\"right\">"); pub.Page(pageinfo.PageCount, pageinfo.CurrentPage, page_url, pageinfo.PageSize, pageinfo.RecordCount); Response.Write("</td></tr>"); Response.Write("</table>"); Response.Write("<div class=\"clear\"></div>"); Response.Write("</div>"); } else { Response.Write("<div style=\"width:960px; margin:0 auto; text-align:center; height:40px; line-height:40px;\">暂无相关信息</div>"); } }