protected override void AttachChildControls()
 {
     this.vshoporders = (VshopTemplatedRepeater) this.FindControl("vshoporders");
     this.litfinishnum = (Literal) this.FindControl("litfinishnum");
     this.litallnum = (Literal) this.FindControl("litallnum");
     int result = 0;
     int.TryParse(HttpContext.Current.Request.QueryString.Get("status"), out result);
     OrderQuery query = new OrderQuery {
         UserId = new int?(Globals.GetCurrentMemberUserId())
     };
     if (result != 5)
     {
         query.Status = OrderStatus.Finished;
         this.litfinishnum.Text = DistributorsBrower.GetDistributorOrderCount(query).ToString();
         query.Status = OrderStatus.All;
         this.litallnum.Text = DistributorsBrower.GetDistributorOrderCount(query).ToString();
     }
     else
     {
         this.litallnum.Text = DistributorsBrower.GetDistributorOrderCount(query).ToString();
         query.Status = OrderStatus.Finished;
         this.litfinishnum.Text = DistributorsBrower.GetDistributorOrderCount(query).ToString();
     }
     this.vshoporders.DataSource = DistributorsBrower.GetDistributorOrder(query);
     this.vshoporders.DataBind();
 }
Beispiel #2
0
 protected override void AttachChildControls()
 {
     PageTitle.AddSiteNameTitle("会员中心");
     MemberInfo currentMember = MemberProcessor.GetCurrentMember();
     if (currentMember != null)
     {
         this.litUserName = (Literal) this.FindControl("litUserName");
         this.litExpenditure = (Literal) this.FindControl("litExpenditure");
         this.litExpenditure.SetWhenIsNotNull(currentMember.Expenditure.ToString("F2"));
         this.litMemberGrade = (Literal) this.FindControl("litMemberGrade");
         MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(currentMember.GradeId);
         if (memberGrade != null)
         {
             this.litMemberGrade.SetWhenIsNotNull(memberGrade.Name);
         }
         this.litUserName.Text = string.IsNullOrEmpty(currentMember.RealName) ? currentMember.UserName : currentMember.RealName;
         this.Page.Session["stylestatus"] = "1";
         this.litWaitForRecieveCount = (Literal) this.FindControl("litWaitForRecieveCount");
         this.litWaitForPayCount = (Literal) this.FindControl("litWaitForPayCount");
         OrderQuery query = new OrderQuery {
             Status = OrderStatus.WaitBuyerPay
         };
         int userOrderCount = MemberProcessor.GetUserOrderCount(Globals.GetCurrentMemberUserId(), query);
         this.litWaitForPayCount.SetWhenIsNotNull(userOrderCount.ToString());
         query.Status = OrderStatus.SellerAlreadySent;
         this.litWaitForRecieveCount.SetWhenIsNotNull(MemberProcessor.GetUserOrderCount(Globals.GetCurrentMemberUserId(), query).ToString());
     }
 }
Beispiel #3
0
 private void BindUserOrderStatistics()
 {
     OrderQuery userOrder = new OrderQuery {
         UserName = this.userName,
         ShipTo = this.shipTo,
         StartDate = this.dateStart,
         EndDate = this.dateEnd,
         OrderId = this.orderId,
         PageSize = this.pager.PageSize,
         PageIndex = this.pager.PageIndex,
         SortBy = "OrderDate",
         SortOrder = SortAction.Desc
     };
     OrderStatisticsInfo userOrders = SalesHelper.GetUserOrders(userOrder);
     this.rp_orderStatistics.DataSource = userOrders.OrderTbl;
     this.rp_orderStatistics.DataBind();
     this.pager.TotalRecords = userOrders.TotalCount;
     this.lblPageCount.Text = string.Format("当前页共计<span class=\"colorG\">{0}</span>个 <span style=\"padding-left:10px;\">订单金额共计</span><span class=\"colorG\">{1}</span>元 <span style=\"padding-left:10px;\">订单毛利润共计</span><span class=\"colorG\">{2}</span>元 ", userOrders.OrderTbl.Rows.Count, Globals.FormatMoney(userOrders.TotalOfPage), Globals.FormatMoney(userOrders.ProfitsOfPage));
     this.lblSearchCount.Text = string.Format("当前查询结果共计<span class=\"colorG\">{0}</span>个 <span style=\"padding-left:10px;\">订单金额共计</span><span class=\"colorG\">{1}</span>元 <span style=\"padding-left:10px;\">订单毛利润共计</span><span class=\"colorG\">{2}</span>元 ", userOrders.TotalCount, Globals.FormatMoney(userOrders.TotalOfSearch), Globals.FormatMoney(userOrders.ProfitsOfSearch));
 }
Beispiel #4
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("会员订单");
            int result = 0;
            int.TryParse(HttpContext.Current.Request.QueryString.Get("status"), out result);
            OrderQuery query = new OrderQuery();
            switch (result)
            {
                case 1:
                    query.Status = OrderStatus.WaitBuyerPay;
                    break;

                case 3:
                    query.Status = OrderStatus.SellerAlreadySent;
                    break;
            }
            this.rptOrders = (VshopTemplatedRepeater) this.FindControl("rptOrders");
            this.rptOrders.DataSource = MemberProcessor.GetUserOrder(Globals.GetCurrentMemberUserId(), query);
            this.rptOrders.DataBind();
        }
Beispiel #5
0
 public int GetUserOrderCount(int userId, OrderQuery query)
 {
     string str = string.Empty;
     if (query.Status == OrderStatus.WaitBuyerPay)
     {
         str = str + " AND OrderStatus = 1 AND Gateway <> 'hishop.plugins.payment.podrequest'";
     }
     else if (query.Status == OrderStatus.SellerAlreadySent)
     {
         str = str + " AND (OrderStatus = 2 OR OrderStatus = 3 OR (OrderStatus = 1 AND Gateway = 'hishop.plugins.payment.podrequest'))";
     }
     string str2 = "SELECT COUNT(1)  FROM Hishop_Orders o WHERE UserId = @UserId";
     str2 = str2 + str;
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str2);
     sqlStringCommand.CommandType = CommandType.Text;
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId);
     return (int) this.database.ExecuteScalar(sqlStringCommand);
 }
Beispiel #6
0
 public DataSet GetUserOrder(int userId, OrderQuery query)
 {
     string str = string.Empty;
     if (query.Status == OrderStatus.WaitBuyerPay)
     {
         str = str + " AND OrderStatus = 1 AND Gateway <> 'hishop.plugins.payment.podrequest'";
     }
     else if (query.Status == OrderStatus.SellerAlreadySent)
     {
         str = str + " AND (OrderStatus = 2 OR OrderStatus = 3 OR (OrderStatus = 1 AND Gateway = 'hishop.plugins.payment.podrequest'))";
     }
     string str2 = "SELECT OrderId, OrderDate, OrderStatus,PaymentTypeId, OrderTotal, (SELECT SUM(Quantity) FROM Hishop_OrderItems WHERE OrderId = o.OrderId) as ProductSum FROM Hishop_Orders o WHERE UserId = @UserId";
     str2 = (str2 + str + " ORDER BY OrderDate DESC") + " SELECT OrderId, ThumbnailsUrl, ItemDescription, SKUContent, SKU, ProductId FROM Hishop_OrderItems WHERE OrderId IN (SELECT OrderId FROM Hishop_Orders WHERE UserId = @UserId" + str + ")";
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str2);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, userId);
     DataSet set = this.database.ExecuteDataSet(sqlStringCommand);
     DataColumn parentColumn = set.Tables[0].Columns["OrderId"];
     DataColumn childColumn = set.Tables[1].Columns["OrderId"];
     DataRelation relation = new DataRelation("OrderItems", parentColumn, childColumn);
     set.Relations.Add(relation);
     return set;
 }
Beispiel #7
0
 public DbQueryResult GetOrders(OrderQuery query)
 {
     StringBuilder builder = new StringBuilder("1=1");
     if (query.Type.HasValue)
     {
         if (((OrderQuery.OrderType) query.Type.Value) == OrderQuery.OrderType.GroupBuy)
         {
             builder.Append(" And GroupBuyId > 0 ");
         }
         else
         {
             builder.Append(" And GroupBuyId is null ");
         }
     }
     if ((query.OrderId != string.Empty) && (query.OrderId != null))
     {
         builder.AppendFormat(" AND OrderId = '{0}'", DataHelper.CleanSearchString(query.OrderId));
     }
     if (query.UserId.HasValue)
     {
         builder.AppendFormat(" AND UserId = '{0}'", query.UserId.Value);
     }
     if (query.PaymentType.HasValue)
     {
         builder.AppendFormat(" AND PaymentTypeId = '{0}'", query.PaymentType.Value);
     }
     if (query.GroupBuyId.HasValue)
     {
         builder.AppendFormat(" AND GroupBuyId = {0}", query.GroupBuyId.Value);
     }
     if (!string.IsNullOrEmpty(query.ProductName))
     {
         builder.AppendFormat(" AND OrderId IN (SELECT OrderId FROM Hishop_OrderItems WHERE ItemDescription LIKE '%{0}%')", DataHelper.CleanSearchString(query.ProductName));
     }
     if (!string.IsNullOrEmpty(query.ShipTo))
     {
         builder.AppendFormat(" AND ShipTo LIKE '%{0}%'", DataHelper.CleanSearchString(query.ShipTo));
     }
     if (query.RegionId.HasValue)
     {
         builder.AppendFormat(" AND ShippingRegion like '%{0}%'", DataHelper.CleanSearchString(RegionHelper.GetFullRegion(query.RegionId.Value, ",")));
     }
     if (!string.IsNullOrEmpty(query.UserName))
     {
         builder.AppendFormat(" AND  UserName  = '******' ", DataHelper.CleanSearchString(query.UserName));
     }
     if (query.Status == OrderStatus.History)
     {
         builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2} AND OrderDate < '{3}'", new object[] { 1, 4, 9, DateTime.Now.AddMonths(-3) });
     }
     else if (query.Status == OrderStatus.BuyerAlreadyPaid)
     {
         builder.AppendFormat(" AND (OrderStatus = {0} OR (OrderStatus = 1 AND Gateway = 'hishop.plugins.payment.podrequest'))", (int) query.Status);
     }
     else if (query.Status != OrderStatus.All)
     {
         builder.AppendFormat(" AND OrderStatus = {0}", (int) query.Status);
     }
     if (query.StartDate.HasValue)
     {
         builder.AppendFormat(" AND datediff(dd,'{0}',OrderDate)>=0", DataHelper.GetSafeDateTimeFormat(query.StartDate.Value));
     }
     if (query.EndDate.HasValue)
     {
         builder.AppendFormat(" AND datediff(dd,'{0}',OrderDate)<=0", DataHelper.GetSafeDateTimeFormat(query.EndDate.Value));
     }
     if (query.ShippingModeId.HasValue)
     {
         builder.AppendFormat(" AND ShippingModeId = {0}", query.ShippingModeId.Value);
     }
     if (query.IsPrinted.HasValue)
     {
         builder.AppendFormat(" AND ISNULL(IsPrinted, 0)={0}", query.IsPrinted.Value);
     }
     return DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_Order", "OrderId", builder.ToString(), "*");
 }
Beispiel #8
0
 public int GetDistributorOrderCount(OrderQuery query)
 {
     string str = string.Empty;
     if (query.Status == OrderStatus.Finished)
     {
         str = str + " AND OrderStatus=" + ((int) query.Status);
     }
     string str2 = "SELECT COUNT(*)  FROM Hishop_Orders o WHERE ReferralUserId = @ReferralUserId";
     str2 = str2 + str;
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str2);
     sqlStringCommand.CommandType = CommandType.Text;
     this.database.AddInParameter(sqlStringCommand, "ReferralUserId", DbType.Int32, query.UserId);
     return (int) this.database.ExecuteScalar(sqlStringCommand);
 }
Beispiel #9
0
 public DataSet GetDistributorOrder(OrderQuery query)
 {
     string str = string.Empty;
     if (query.Status == OrderStatus.Finished)
     {
         str = str + " AND OrderStatus=" + ((int) query.Status);
     }
     string str2 = "SELECT OrderId, OrderDate, OrderStatus,PaymentTypeId, OrderTotal,(SELECT SUM(Quantity) FROM Hishop_OrderItems WHERE OrderId = o.OrderId) as ProductSum,isnull((SELECT sum(CommTotal) FROM Hishop_Commissions WHERE UserId=@UserId AND OrderId=o.OrderId),0) AS CommTotal FROM Hishop_Orders o WHERE ReferralUserId = @UserId";
     str2 = (str2 + str + " ORDER BY OrderDate DESC") + " SELECT OrderId, ThumbnailsUrl, ItemDescription, SKUContent, SKU, ProductId,Quantity,ItemListPrice FROM Hishop_OrderItems WHERE OrderId IN (SELECT OrderId FROM Hishop_Orders WHERE ReferralUserId = @UserId" + str + ")";
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str2);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, query.UserId);
     DataSet set = this.database.ExecuteDataSet(sqlStringCommand);
     DataColumn parentColumn = set.Tables[0].Columns["OrderId"];
     DataColumn childColumn = set.Tables[1].Columns["OrderId"];
     DataRelation relation = new DataRelation("OrderItems", parentColumn, childColumn);
     set.Relations.Add(relation);
     return set;
 }
Beispiel #10
0
 private OrderQuery GetOrderQuery()
 {
     int num4;
     int num5;
     OrderQuery query = new OrderQuery();
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["OrderId"]))
     {
         query.OrderId = Globals.UrlDecode(this.Page.Request.QueryString["OrderId"]);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ProductName"]))
     {
         query.ProductName = Globals.UrlDecode(this.Page.Request.QueryString["ProductName"]);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ShipTo"]))
     {
         query.ShipTo = Globals.UrlDecode(this.Page.Request.QueryString["ShipTo"]);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["UserName"]))
     {
         query.UserName = Globals.UrlDecode(this.Page.Request.QueryString["UserName"]);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["StartDate"]))
     {
         query.StartDate = new DateTime?(DateTime.Parse(this.Page.Request.QueryString["StartDate"]));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["GroupBuyId"]))
     {
         query.GroupBuyId = new int?(int.Parse(this.Page.Request.QueryString["GroupBuyId"]));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["EndDate"]))
     {
         query.EndDate = new DateTime?(DateTime.Parse(this.Page.Request.QueryString["EndDate"]));
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["OrderStatus"]))
     {
         int num = 0;
         if (int.TryParse(this.Page.Request.QueryString["OrderStatus"], out num))
         {
             query.Status = (OrderStatus) num;
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["IsPrinted"]))
     {
         int num2 = 0;
         if (int.TryParse(this.Page.Request.QueryString["IsPrinted"], out num2))
         {
             query.IsPrinted = new int?(num2);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["ModeId"]))
     {
         int num3 = 0;
         if (int.TryParse(this.Page.Request.QueryString["ModeId"], out num3))
         {
             query.ShippingModeId = new int?(num3);
         }
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["region"]) && int.TryParse(this.Page.Request.QueryString["region"], out num4))
     {
         query.RegionId = new int?(num4);
     }
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["UserId"]) && int.TryParse(this.Page.Request.QueryString["UserId"], out num5))
     {
         query.UserId = new int?(num5);
     }
     int result = 0;
     if (int.TryParse(base.Request.QueryString["orderType"], out result) && (result > 0))
     {
         query.Type = new OrderQuery.OrderType?((OrderQuery.OrderType) result);
     }
     query.PageIndex = this.pager.PageIndex;
     query.PageSize = this.pager.PageSize;
     query.SortBy = "OrderDate";
     query.SortOrder = SortAction.Desc;
     return query;
 }
 public static int GetDistributorOrderCount(OrderQuery query)
 {
     return new OrderDao().GetDistributorOrderCount(query);
 }
 public static DataSet GetDistributorOrder(OrderQuery query)
 {
     return new OrderDao().GetDistributorOrder(query);
 }
Beispiel #13
0
 private void btnCreateReport_Click(object sender, EventArgs e)
 {
     OrderQuery userOrder = new OrderQuery {
         UserName = this.userName,
         ShipTo = this.shipTo,
         StartDate = this.dateStart,
         EndDate = this.dateEnd,
         OrderId = this.orderId,
         PageSize = this.pager.PageSize,
         PageIndex = this.pager.PageIndex,
         SortBy = "OrderDate",
         SortOrder = SortAction.Desc
     };
     OrderStatisticsInfo userOrdersNoPage = SalesHelper.GetUserOrdersNoPage(userOrder);
     StringBuilder builder = new StringBuilder();
     builder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");
     builder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">");
     builder.AppendLine("<td>订单号</td>");
     builder.AppendLine("<td>下单时间</td>");
     builder.AppendLine("<td>总订单金额</td>");
     builder.AppendLine("<td>昵称</td>");
     builder.AppendLine("<td>收货人</td>");
     builder.AppendLine("<td>利润</td>");
     builder.AppendLine("</tr>");
     foreach (DataRow row in userOrdersNoPage.OrderTbl.Rows)
     {
         builder.AppendLine("<tr>");
         builder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + row["OrderId"].ToString() + "</td>");
         builder.AppendLine("<td>" + row["OrderDate"].ToString() + "</td>");
         builder.AppendLine("<td>" + row["Total"].ToString() + "</td>");
         builder.AppendLine("<td>" + row["UserName"].ToString() + "</td>");
         builder.AppendLine("<td>" + row["ShipTo"].ToString() + "</td>");
         builder.AppendLine("<td>" + row["Profits"].ToString() + "</td>");
         builder.AppendLine("</tr>");
     }
     builder.AppendLine("<tr>");
     builder.AppendLine("<td>当前查询结果共计," + userOrdersNoPage.TotalCount + "</td>");
     builder.AppendLine("<td>订单金额共计," + userOrdersNoPage.TotalOfSearch + "</td>");
     builder.AppendLine("<td>订单毛利润共计," + userOrdersNoPage.ProfitsOfSearch + "</td>");
     builder.AppendLine("<td></td>");
     builder.AppendLine("</tr>");
     builder.AppendLine("</table>");
     this.Page.Response.Clear();
     this.Page.Response.Buffer = false;
     this.Page.Response.Charset = "GB2312";
     this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=UserOrderStatistics.xls");
     this.Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
     this.Page.Response.ContentType = "application/ms-excel";
     this.Page.EnableViewState = false;
     this.Page.Response.Write(builder.ToString());
     this.Page.Response.End();
 }
Beispiel #14
0
 public static DbQueryResult GetOrders(OrderQuery query)
 {
     return new OrderDao().GetOrders(query);
 }