Esempio n. 1
0
 public static void OrderCreated(OrderInfo order, IUser user)
 {
     if ((order != null) && (user != null))
     {
         MessageTemplate template = MessageTemplateHelper.GetTemplate("OrderCreated");
         if (template != null)
         {
             MailMessage email = null;
             string innerSubject = null;
             string innerMessage = null;
             string smsMessage = null;
             SiteSettings siteSettings = HiContext.Current.SiteSettings;
             GenericOrderMessages(siteSettings, user.Username, user.Email, order.OrderId, order.GetTotal(), order.Remark, order.ModeName, order.ShipTo, order.Address, order.ZipCode, order.TelPhone, order.CellPhone, order.EmailAddress, order.ShipOrderNumber, order.RefundAmount, order.CloseReason, template, out email, out smsMessage, out innerSubject, out innerMessage);
             Send(template, siteSettings, user, false, email, innerSubject, innerMessage, smsMessage);
         }
     }
 }
Esempio n. 2
0
 PurchaseOrderInfo ConvertOrderToPurchaseOrder(OrderInfo order)
 {
     if (order == null)
     {
         return null;
     }
     StringBuilder builder = new StringBuilder();
     string query = "";
     foreach (LineItemInfo info in order.LineItems.Values)
     {
         builder.AppendFormat("'" + info.SkuId + "',", new object[0]);
     }
     if (builder.Length > 0)
     {
         builder = builder.Remove(builder.Length - 1, 1);
         query = string.Format("SELECT S.SkuId, S.CostPrice, p.ProductName FROM Hishop_Products P JOIN Hishop_SKUs S ON P.ProductId = S.ProductId WHERE S.SkuId IN({0});", builder);
     }
     if (order.Gifts.Count > 0)
     {
         StringBuilder builder2 = new StringBuilder();
         foreach (OrderGiftInfo info2 in order.Gifts)
         {
             builder2.AppendFormat(info2.GiftId.ToString() + ",", new object[0]);
         }
         builder2.Remove(builder2.Length - 1, 1);
         query = query + string.Format(" SELECT GiftId, CostPrice FROM Hishop_Gifts WHERE GiftId IN({0});", builder2.ToString());
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(query);
     Dictionary<string, PurchaseOrderItemInfo> dictionary = new Dictionary<string, PurchaseOrderItemInfo>();
     Dictionary<int, decimal> dictionary2 = new Dictionary<int, decimal>();
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         if (order.LineItems.Values.Count > 0)
         {
             while (reader.Read())
             {
                 PurchaseOrderItemInfo info3 = new PurchaseOrderItemInfo();
                 if (reader["CostPrice"] != DBNull.Value)
                 {
                     info3.ItemCostPrice = (decimal)reader["CostPrice"];
                 }
                 info3.ItemHomeSiteDescription = (string)reader["ProductName"];
                 dictionary.Add((string)reader["SkuId"], info3);
             }
         }
         if (order.Gifts.Count > 0)
         {
             if (order.LineItems.Count > 0)
             {
                 reader.NextResult();
             }
             while (reader.Read())
             {
                 dictionary2.Add((int)reader["GiftId"], (DBNull.Value == reader["CostPrice"]) ? 0M : Convert.ToDecimal(reader["CostPrice"]));
             }
         }
     }
     IUser user = Users.GetUser(HiContext.Current.SiteSettings.UserId.Value, false);
     if ((user == null) || (user.UserRole != UserRole.Distributor))
     {
         return null;
     }
     Distributor distributor = user as Distributor;
     PurchaseOrderInfo info4 = new PurchaseOrderInfo();
     info4.PurchaseOrderId = "PO" + order.OrderId;
     info4.OrderId = order.OrderId;
     info4.Remark = order.Remark;
     info4.PurchaseStatus = OrderStatus.WaitBuyerPay;
     info4.DistributorId = distributor.UserId;
     info4.Distributorname = distributor.Username;
     info4.DistributorEmail = distributor.Email;
     info4.DistributorRealName = distributor.RealName;
     info4.DistributorQQ = distributor.QQ;
     info4.DistributorWangwang = distributor.Wangwang;
     info4.DistributorMSN = distributor.MSN;
     info4.ShippingRegion = order.ShippingRegion;
     info4.Address = order.Address;
     info4.ZipCode = order.ZipCode;
     info4.ShipTo = order.ShipTo;
     info4.TelPhone = order.TelPhone;
     info4.CellPhone = order.CellPhone;
     info4.ShippingModeId = order.ShippingModeId;
     info4.ModeName = order.ModeName;
     info4.RegionId = order.RegionId;
     info4.Freight = order.Freight;
     info4.AdjustedFreight = order.Freight;
     info4.ShipOrderNumber = order.ShipOrderNumber;
     info4.Weight = order.Weight;
     info4.RefundStatus = RefundStatus.None;
     info4.OrderTotal = order.GetTotal();
     info4.ExpressCompanyName = order.ExpressCompanyName;
     info4.ExpressCompanyAbb = order.ExpressCompanyAbb;
     foreach (LineItemInfo info5 in order.LineItems.Values)
     {
         PurchaseOrderItemInfo item = new PurchaseOrderItemInfo();
         item.PurchaseOrderId = info4.PurchaseOrderId;
         item.SkuId = info5.SkuId;
         item.ProductId = info5.ProductId;
         item.SKU = info5.SKU;
         item.Quantity = info5.ShipmentQuantity;
         foreach (KeyValuePair<string, PurchaseOrderItemInfo> pair in dictionary)
         {
             if (pair.Key == info5.SkuId)
             {
                 item.ItemCostPrice = pair.Value.ItemCostPrice;
                 item.ItemHomeSiteDescription = pair.Value.ItemHomeSiteDescription;
             }
         }
         item.ItemPurchasePrice = info5.ItemCostPrice;
         item.ItemListPrice = info5.ItemListPrice;
         item.ItemDescription = info5.ItemDescription;
         item.SKUContent = info5.SKUContent;
         item.ThumbnailsUrl = info5.ThumbnailsUrl;
         item.ItemWeight = info5.ItemWeight;
         if (string.IsNullOrEmpty(item.ItemHomeSiteDescription))
         {
             item.ItemHomeSiteDescription = item.ItemDescription;
         }
         info4.PurchaseOrderItems.Add(item);
     }
     foreach (OrderGiftInfo info7 in order.Gifts)
     {
         PurchaseOrderGiftInfo info8 = new PurchaseOrderGiftInfo();
         info8.PurchaseOrderId = info4.PurchaseOrderId;
         foreach (KeyValuePair<int, decimal> pair2 in dictionary2)
         {
             if (pair2.Key == info7.GiftId)
             {
                 info8.CostPrice = pair2.Value;
             }
         }
         info8.PurchasePrice = info7.CostPrice;
         info8.GiftId = info7.GiftId;
         info8.GiftName = info7.GiftName;
         info8.Quantity = info7.Quantity;
         info8.ThumbnailsUrl = info7.ThumbnailsUrl;
         info4.PurchaseOrderGifts.Add(info8);
     }
     foreach (OrderOptionInfo info9 in order.OrderOptions)
     {
         PurchaseOrderOptionInfo info10 = new PurchaseOrderOptionInfo();
         info10.PurchaseOrderId = info4.PurchaseOrderId;
         info10.LookupListId = info9.LookupListId;
         info10.LookupItemId = info9.LookupItemId;
         info10.ListDescription = info9.ListDescription;
         info10.ItemDescription = info9.ItemDescription;
         info10.AdjustedPrice = info9.AdjustedPrice;
         info10.CustomerTitle = info9.CustomerTitle;
         info10.CustomerDescription = info9.CustomerDescription;
         info4.PurchaseOrderOptions.Add(info10);
     }
     return info4;
 }
Esempio n. 3
0
 private void SetControl(OrderInfo order)
 {
     if (!order.CheckAction(OrderActions.SELLER_REJECT_REFUND))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         lblTotalPrice.Money = order.GetTotal();
         Member user = Users.GetUser(order.UserId, false) as Member;
         if (user == null)
         {
             base.GotoResourceNotFound();
         }
         if (!user.IsOpenBalance)
         {
             rdolist.Items[1].Enabled = false;
             divBalance.Visible = true;
         }
         if (order.OrderStatus == OrderStatus.SellerAlreadySent)
         {
             lblDescription.InnerHtml = "退款金额不得大于订单总金额.已发货订单允许全额或部分退款,退款后订单自动变为交易成功状态。";
             lblTui.InnerHtml = "部分退款";
         }
         else
         {
             lblDescription.InnerHtml = "已付款等待发货订单只允许全额退款.团购订单若不是以团购失败结束,则会扣除违约金,退款后订单自动变为关闭状态";
             lblTui.InnerHtml = "全额退款";
             if ((order.GroupBuyId > 0) && (order.GroupBuyStatus != GroupBuyStatus.Failed))
             {
                 txtRefundTotal.Text = (order.GetTotal() - order.NeedPrice).ToString();
             }
             else
             {
                 txtRefundTotal.Text = order.GetTotal().ToString();
             }
             txtRefundTotal.Enabled = false;
         }
     }
 }
Esempio n. 4
0
 private void WriteOrderInfo(OrderInfo order, ShippersInfo shipper)
 {
     string[] strArray = RegionHelper.GetFullRegion(order.RegionId, ",").Split(new char[] { ',' });
     StringBuilder builder = new StringBuilder();
     builder.AppendLine("<nodes>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>收货人-姓名</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.ShipTo);
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>收货人-电话</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.TelPhone + "_");
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>收货人-手机</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.CellPhone + "_");
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>收货人-邮编</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.ZipCode + "_");
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>收货人-地址</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.Address);
     builder.AppendLine("</item>");
     if (strArray.Length > 0)
     {
         builder.AppendLine("<item>");
         builder.AppendLine("<name>收货人-地区1级</name>");
         builder.AppendFormat("<rename>{0}</rename>", strArray[0]);
         builder.AppendLine("</item>");
     }
     if (strArray.Length > 1)
     {
         builder.AppendLine("<item>");
         builder.AppendLine("<name>收货人-地区2级</name>");
         builder.AppendFormat("<rename>{0}</rename>", strArray[1]);
         builder.AppendLine("</item>");
     }
     if (strArray.Length > 2)
     {
         builder.AppendLine("<item>");
         builder.AppendLine("<name>收货人-地区3级</name>");
         builder.AppendFormat("<rename>{0}</rename>", strArray[2]);
         builder.AppendLine("</item>");
     }
     if (shipper != null)
     {
         string[] strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, ",").Split(new char[] { ',' });
         builder.AppendLine("<item>");
         builder.AppendLine("<name>发货人-姓名</name>");
         builder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName);
         builder.AppendLine("</item>");
         builder.AppendLine("<item>");
         builder.AppendLine("<name>发货人-手机</name>");
         builder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_");
         builder.AppendLine("</item>");
         builder.AppendLine("<item>");
         builder.AppendLine("<name>发货人-电话</name>");
         builder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_");
         builder.AppendLine("</item>");
         builder.AppendLine("<item>");
         builder.AppendLine("<name>发货人-地址</name>");
         builder.AppendFormat("<rename>{0}</rename>", shipper.Address);
         builder.AppendLine("</item>");
         builder.AppendLine("<item>");
         builder.AppendLine("<name>发货人-邮编</name>");
         builder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_");
         builder.AppendLine("</item>");
         if (strArray2.Length > 0)
         {
             builder.AppendLine("<item>");
             builder.AppendLine("<name>发货人-地区1级</name>");
             builder.AppendFormat("<rename>{0}</rename>", strArray2[0]);
             builder.AppendLine("</item>");
         }
         if (strArray2.Length > 1)
         {
             builder.AppendLine("<item>");
             builder.AppendLine("<name>发货人-地区2级</name>");
             builder.AppendFormat("<rename>{0}</rename>", strArray2[1]);
             builder.AppendLine("</item>");
         }
         if (strArray2.Length > 2)
         {
             builder.AppendLine("<item>");
             builder.AppendLine("<name>发货人-地区3级</name>");
             builder.AppendFormat("<rename>{0}</rename>", strArray2[2]);
             builder.AppendLine("</item>");
         }
     }
     builder.AppendLine("<item>");
     builder.AppendLine("<name>订单-订单号</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.OrderId);
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>订单-总金额</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.GetTotal() + "_");
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>订单-物品总重量</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.Weight);
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>订单-备注</name>");
     builder.AppendFormat("<rename>{0}</rename>", order.ManagerRemark);
     builder.AppendLine("</item>");
     string str3 = "";
     if ((order.LineItems != null) && (order.LineItems.Count > 0))
     {
         foreach (LineItemInfo info in order.LineItems.Values)
         {
             object obj2 = str3;
             str3 = string.Concat(new object[] { obj2, "货号 ", info.SKU, " ", info.SKUContent, " \x00d7", info.ShipmentQuantity, "\n" });
         }
         str3 = str3.Replace(";", "").Replace(";", "").Replace(":", ":");
     }
     builder.AppendLine("<item>");
     builder.AppendLine("<name>订单-详情</name>");
     builder.AppendFormat("<rename>{0}</rename>", str3);
     builder.AppendLine("</item>");
     if (order.ShippingDate == DateTime.Parse("0001-1-1"))
     {
         builder.AppendLine("<item>");
         builder.AppendLine("<name>订单-送货时间</name>");
         builder.AppendFormat("<rename>{0}</rename>", "null");
         builder.AppendLine("</item>");
     }
     else
     {
         builder.AppendLine("<item>");
         builder.AppendLine("<name>订单-送货时间</name>");
         builder.AppendFormat("<rename>{0}</rename>", order.ShippingDate);
         builder.AppendLine("</item>");
     }
     builder.AppendLine("<item>");
     builder.AppendLine("<name>网店名称</name>");
     builder.AppendFormat("<rename>{0}</rename>", SettingsManager.GetMasterSettings(true).SiteName);
     builder.AppendLine("</item>");
     builder.AppendLine("<item>");
     builder.AppendLine("<name>自定义内容</name>");
     builder.AppendFormat("<rename>{0}</rename>", "null");
     builder.AppendLine("</item>");
     builder.AppendLine("</nodes>");
     base.Response.Write(builder.ToString());
 }
Esempio n. 5
0
 bool CreatOrder(OrderInfo orderInfo, DbTransaction dbTran)
 {
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_distro_CreateOrder");
     this.database.AddInParameter(storedProcCommand, "OrderId", DbType.String, orderInfo.OrderId);
     this.database.AddInParameter(storedProcCommand, "OrderDate", DbType.DateTime, orderInfo.OrderDate);
     this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, orderInfo.UserId);
     this.database.AddInParameter(storedProcCommand, "UserName", DbType.String, orderInfo.Username);
     this.database.AddInParameter(storedProcCommand, "Wangwang", DbType.String, orderInfo.Wangwang);
     this.database.AddInParameter(storedProcCommand, "RealName", DbType.String, orderInfo.RealName);
     this.database.AddInParameter(storedProcCommand, "EmailAddress", DbType.String, orderInfo.EmailAddress);
     this.database.AddInParameter(storedProcCommand, "Remark", DbType.String, orderInfo.Remark);
     this.database.AddInParameter(storedProcCommand, "AdjustedDiscount", DbType.Currency, orderInfo.AdjustedDiscount);
     this.database.AddInParameter(storedProcCommand, "OrderStatus", DbType.Int32, (int) orderInfo.OrderStatus);
     this.database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     this.database.AddInParameter(storedProcCommand, "ShippingRegion", DbType.String, orderInfo.ShippingRegion);
     this.database.AddInParameter(storedProcCommand, "Address", DbType.String, orderInfo.Address);
     this.database.AddInParameter(storedProcCommand, "ZipCode", DbType.String, orderInfo.ZipCode);
     this.database.AddInParameter(storedProcCommand, "ShipTo", DbType.String, orderInfo.ShipTo);
     this.database.AddInParameter(storedProcCommand, "TelPhone", DbType.String, orderInfo.TelPhone);
     this.database.AddInParameter(storedProcCommand, "CellPhone", DbType.String, orderInfo.CellPhone);
     this.database.AddInParameter(storedProcCommand, "ShippingModeId", DbType.Int32, orderInfo.ShippingModeId);
     this.database.AddInParameter(storedProcCommand, "ModeName", DbType.String, orderInfo.ModeName);
     this.database.AddInParameter(storedProcCommand, "RegionId", DbType.Int32, orderInfo.RegionId);
     this.database.AddInParameter(storedProcCommand, "Freight", DbType.Currency, orderInfo.Freight);
     this.database.AddInParameter(storedProcCommand, "AdjustedFreight", DbType.Currency, orderInfo.AdjustedFreight);
     this.database.AddInParameter(storedProcCommand, "ShipOrderNumber", DbType.String, orderInfo.ShipOrderNumber);
     this.database.AddInParameter(storedProcCommand, "Weight", DbType.Int32, orderInfo.Weight);
     this.database.AddInParameter(storedProcCommand, "ExpressCompanyName", DbType.String, orderInfo.ExpressCompanyName);
     this.database.AddInParameter(storedProcCommand, "ExpressCompanyAbb", DbType.String, orderInfo.ExpressCompanyAbb);
     this.database.AddInParameter(storedProcCommand, "PaymentTypeId", DbType.Int32, orderInfo.PaymentTypeId);
     this.database.AddInParameter(storedProcCommand, "PaymentType", DbType.String, orderInfo.PaymentType);
     this.database.AddInParameter(storedProcCommand, "PayCharge", DbType.Currency, orderInfo.PayCharge);
     this.database.AddInParameter(storedProcCommand, "AdjustedPayCharge", DbType.Currency, orderInfo.AdjustedPayCharge);
     this.database.AddInParameter(storedProcCommand, "RefundStatus", DbType.Int32, (int) orderInfo.RefundStatus);
     this.database.AddInParameter(storedProcCommand, "OrderTotal", DbType.Currency, orderInfo.GetTotal());
     this.database.AddInParameter(storedProcCommand, "OrderPoint", DbType.Int32, orderInfo.GetTotalPoints());
     this.database.AddInParameter(storedProcCommand, "OrderCostPrice", DbType.Currency, orderInfo.GetCostPrice());
     this.database.AddInParameter(storedProcCommand, "OrderProfit", DbType.Currency, orderInfo.GetProfit());
     this.database.AddInParameter(storedProcCommand, "OptionPrice", DbType.Currency, orderInfo.GetOptionPrice());
     this.database.AddInParameter(storedProcCommand, "Amount", DbType.Currency, orderInfo.GetAmount());
     this.database.AddInParameter(storedProcCommand, "ActivityName", DbType.String, orderInfo.ActivityName);
     this.database.AddInParameter(storedProcCommand, "ActivityId", DbType.Int32, orderInfo.ActivityId);
     this.database.AddInParameter(storedProcCommand, "EightFree", DbType.Boolean, orderInfo.EightFree);
     this.database.AddInParameter(storedProcCommand, "ProcedureFeeFree", DbType.Boolean, orderInfo.ProcedureFeeFree);
     this.database.AddInParameter(storedProcCommand, "OrderOptionFree", DbType.Boolean, orderInfo.OrderOptionFree);
     this.database.AddInParameter(storedProcCommand, "DiscountName", DbType.String, orderInfo.DiscountName);
     this.database.AddInParameter(storedProcCommand, "DiscountId", DbType.Int32, orderInfo.DiscountId);
     this.database.AddInParameter(storedProcCommand, "DiscountValue", DbType.Currency, orderInfo.DiscountValue);
     this.database.AddInParameter(storedProcCommand, "DiscountValueType", DbType.Int32, (int) orderInfo.DiscountValueType);
     this.database.AddInParameter(storedProcCommand, "DiscountAmount", DbType.Currency, orderInfo.GetDiscountAmount());
     this.database.AddInParameter(storedProcCommand, "CouponName", DbType.String, orderInfo.CouponName);
     this.database.AddInParameter(storedProcCommand, "CouponCode", DbType.String, orderInfo.CouponCode);
     this.database.AddInParameter(storedProcCommand, "CouponAmount", DbType.Currency, orderInfo.CouponAmount);
     this.database.AddInParameter(storedProcCommand, "CouponValue", DbType.Currency, orderInfo.CouponValue);
     if (orderInfo.GroupBuyId > 0)
     {
         this.database.AddInParameter(storedProcCommand, "GroupBuyId", DbType.Int32, orderInfo.GroupBuyId);
         this.database.AddInParameter(storedProcCommand, "NeedPrice", DbType.Currency, orderInfo.NeedPrice);
         this.database.AddInParameter(storedProcCommand, "GroupBuyStatus", DbType.Int32, 1);
     }
     else
     {
         this.database.AddInParameter(storedProcCommand, "GroupBuyId", DbType.Int32, DBNull.Value);
         this.database.AddInParameter(storedProcCommand, "NeedPrice", DbType.Currency, DBNull.Value);
         this.database.AddInParameter(storedProcCommand, "GroupBuyStatus", DbType.Int32, DBNull.Value);
     }
     return (this.database.ExecuteNonQuery(storedProcCommand, dbTran) == 1);
 }
Esempio n. 6
0
 static void UpdateUserAccount(OrderInfo order)
 {
     int userId = order.UserId;
     if (userId == 0x44c)
     {
         userId = 0;
     }
     IUser user = Users.GetUser(userId, false);
     if ((user != null) && (user.UserRole == UserRole.Member))
     {
         Member member = user as Member;
         UserPointInfo point = new UserPointInfo();
         point.OrderId = order.OrderId;
         point.UserId = member.UserId;
         point.TradeDate = DateTime.Now;
         point.TradeType = UserPointTradeType.Bounty;
         point.Increased = new int?(order.GetTotalPoints());
         point.Points = order.GetTotalPoints() + member.Points;
         if ((point.Points > 0x7fffffff) || (point.Points < 0))
         {
             point.Points = 0x7fffffff;
         }
         SalesProvider.Instance().AddMemberPoint(point);
         int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct;
         if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0))
         {
             IUser user2 = Users.GetUser(member.ReferralUserId.Value, false);
             if ((user2 != null) && (user2.UserRole == UserRole.Member))
             {
                 Member member2 = user2 as Member;
                 if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance)
                 {
                     decimal num3 = member2.Balance + ((order.GetTotal() * referralDeduct) / 100M);
                     BalanceDetailInfo balanceDetail = new BalanceDetailInfo();
                     balanceDetail.UserId = member2.UserId;
                     balanceDetail.UserName = member2.Username;
                     balanceDetail.TradeDate = DateTime.Now;
                     balanceDetail.TradeType = TradeTypes.ReferralDeduct;
                     balanceDetail.Income = new decimal?((order.GetTotal() * referralDeduct) / 100M);
                     balanceDetail.Balance = num3;
                     balanceDetail.Remark = string.Format("提成来自'{0}'的订单{1}", order.Username, order.OrderId);
                     MemberProvider.Instance().InsertBalanceDetail(balanceDetail);
                 }
             }
         }
         SalesProvider.Instance().UpdateUserAccount(order.GetTotal(), order.UserId);
         int historyPoint = SalesProvider.Instance().GetHistoryPoint(member.UserId);
         SalesProvider.Instance().ChangeMemberGrade(member.UserId, member.GradeId, historyPoint);
         Users.ClearUserCache(user);
     }
 }
Esempio n. 7
0
 public override bool UpdateOrderAmount(OrderInfo order, DbTransaction dbTran)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Orders SET OrderTotal = @OrderTotal, OrderProfit=@OrderProfit, AdjustedFreight = @AdjustedFreight, AdjustedPayCharge = @AdjustedPayCharge, AdjustedDiscount=@AdjustedDiscount, OrderPoint=@OrderPoint, Amount=@Amount,OrderCostPrice=@OrderCostPrice WHERE OrderId = @OrderId");
     database.AddInParameter(sqlStringCommand, "OrderTotal", DbType.Currency, order.GetTotal());
     database.AddInParameter(sqlStringCommand, "AdjustedFreight", DbType.Currency, order.AdjustedFreight);
     database.AddInParameter(sqlStringCommand, "AdjustedPayCharge", DbType.Currency, order.AdjustedPayCharge);
     database.AddInParameter(sqlStringCommand, "OrderCostPrice", DbType.Currency, order.GetCostPrice());
     database.AddInParameter(sqlStringCommand, "AdjustedDiscount", DbType.Currency, order.AdjustedDiscount);
     database.AddInParameter(sqlStringCommand, "OrderPoint", DbType.Int32, order.GetTotalPoints());
     database.AddInParameter(sqlStringCommand, "OrderProfit", DbType.Currency, order.GetProfit());
     database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, order.OrderId);
     database.AddInParameter(sqlStringCommand, "Amount", DbType.Currency, order.GetAmount());
     if (dbTran != null)
     {
         return (database.ExecuteNonQuery(sqlStringCommand, dbTran) == 1);
     }
     return (database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
Esempio n. 8
0
 void FillOrderPaymentMode(OrderInfo orderInfo)
 {
     orderInfo.PaymentTypeId = int.Parse(inputPaymentModeId.Value);
     PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode(orderInfo.PaymentTypeId);
     if (paymentMode != null)
     {
         orderInfo.PaymentType = Globals.HtmlEncode(paymentMode.Name);
         orderInfo.AdjustedPayCharge = orderInfo.PayCharge = ShoppingProcessor.CalcPayCharge(orderInfo.GetTotal(), paymentMode);
     }
 }
Esempio n. 9
0
 public override bool UserPayOrder(OrderInfo order, bool isBalancePayOrder, DbTransaction dbTran)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("UPDATE Hishop_Orders SET OrderStatus = {0}, PayDate = '{1}', GatewayOrderId = @GatewayOrderId ,OrderPoint=@OrderPoint WHERE OrderId = '{2}';", 2, DateTime.Now, order.OrderId);
     if (isBalancePayOrder)
     {
         Member user = Users.GetUser(order.UserId, false) as Member;
         decimal num = user.Balance - order.GetTotal();
         if ((user.Balance - user.RequestBalance) < order.GetTotal())
         {
             return false;
         }
         builder.AppendFormat("INSERT INTO Hishop_BalanceDetails(UserId,UserName, TradeDate, TradeType, Expenses, Balance,Remark) VALUES({0},'{1}', '{2}', {3}, {4}, {5},'{6}');", new object[] { order.UserId, HiContext.Current.User.Username, DateTime.Now, 3, order.GetTotal(), num, string.Format("对订单{0}付款", order.OrderId) });
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     database.AddInParameter(sqlStringCommand, "GatewayOrderId", DbType.String, order.GatewayOrderId);
     database.AddInParameter(sqlStringCommand, "OrderPoint", DbType.Int32, order.GetTotalPoints());
     return (database.ExecuteNonQuery(sqlStringCommand, dbTran) >= 1);
 }
Esempio n. 10
0
 private void BindTatolAmount(OrderInfo order)
 {
     decimal amount = order.GetAmount();
     lblAllPrice.Money = amount;
     lblWeight.Text = order.Weight.ToString(CultureInfo.InvariantCulture);
     litIntegral.Text = order.GetTotalPoints().ToString(CultureInfo.InvariantCulture);
     litTotal.Text = Globals.FormatMoney(order.GetTotal());
 }
Esempio n. 11
0
 void BindOrderItems(OrderInfo order)
 {
     this.orderItems.DataSource = order.LineItems.Values;
     this.orderItems.DataBind();
     if (order.Gifts.Count > 0)
     {
         this.plOrderGift.Visible = true;
         this.grdOrderGift.DataSource = order.Gifts;
         this.grdOrderGift.DataBind();
     }
     this.lblCartMoney.Money = order.GetAmount();
     this.litWeight.Text = order.Weight.ToString();
     this.lblPayCharge.Money = order.AdjustedPayCharge;
     this.lblOptionPrice.Money = order.GetOptionPrice();
     this.lblFreight.Money = order.AdjustedFreight;
     this.lblAdjustedDiscount.Money = order.AdjustedDiscount;
     this.litCouponValue.Text = order.CouponName + " -" + Globals.FormatMoney(order.CouponValue);
     this.lblDiscount.Money = order.GetAmount() - order.GetDiscountedAmount();
     if (order.OrderStatus == OrderStatus.WaitBuyerPay)
     {
         this.litPoints.Text = order.GetTotalPoints().ToString(CultureInfo.InvariantCulture);
     }
     else
     {
         this.litPoints.Text = order.Points.ToString(CultureInfo.InvariantCulture);
     }
     this.litTotalPrice.Money = order.GetTotal();
 }
Esempio n. 12
0
 void BindOrderBase(OrderInfo order)
 {
     this.litOrderId.Text = order.OrderId;
     this.lbltotalPrice.Money = order.GetTotal();
     this.litAddDate.Time = order.OrderDate;
     this.lblOrderStatus.OrderStatusCode = order.OrderStatus;
     if (order.OrderStatus == OrderStatus.Closed)
     {
         this.litCloseReason.Text = order.CloseReason;
     }
     this.litRemark.Text = order.Remark;
 }
Esempio n. 13
0
 public static bool UserPayOrder(OrderInfo order, bool isBalancePayOrder)
 {
     bool flag = false;
     if (order.CheckAction(OrderActions.BUYER_PAY))
     {
         using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection())
         {
             connection.Open();
             DbTransaction dbTran = connection.BeginTransaction();
             try
             {
                 if (!TradeProvider.Instance().UserPayOrder(order, isBalancePayOrder, dbTran))
                 {
                     dbTran.Rollback();
                     return false;
                 }
                 if ((HiContext.Current.SiteSettings.IsDistributorSettings && (order.GroupBuyId <= 0)) && !PurchaseOrderProvider.CreateInstance().CreatePurchaseOrder(order, dbTran))
                 {
                     dbTran.Rollback();
                     return false;
                 }
                 flag = true;
                 dbTran.Commit();
             }
             catch
             {
                 dbTran.Rollback();
                 return false;
             }
             finally
             {
                 connection.Close();
             }
         }
         if (!flag)
         {
             return flag;
         }
         if (!HiContext.Current.SiteSettings.IsDistributorSettings)
         {
             TradeProvider.Instance().UpdateStockPayOrder(order.OrderId);
         }
         TradeProvider.Instance().UpdateProductSaleCounts(order.LineItems);
         if ((order.UserId == 0) || (order.UserId == 0x44c))
         {
             return flag;
         }
         IUser user = Users.GetUser(order.UserId, false);
         if (((user == null) || (user.UserRole != UserRole.Member)) && ((user == null) || (user.UserRole != UserRole.Underling)))
         {
             return flag;
         }
         Member member = user as Member;
         UserPointInfo point = new UserPointInfo();
         point.OrderId = order.OrderId;
         point.UserId = member.UserId;
         point.TradeDate = DateTime.Now;
         point.TradeType = UserPointTradeType.Bounty;
         point.Increased = new int?(order.GetTotalPoints());
         point.Points = order.GetTotalPoints() + member.Points;
         if ((point.Points > 0x7fffffff) || (point.Points < 0))
         {
             point.Points = 0x7fffffff;
         }
         TradeProvider.Instance().AddMemberPoint(point);
         int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct;
         if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0))
         {
             IUser user2 = Users.GetUser(member.ReferralUserId.Value, false);
             if ((user2 != null) && ((user2.UserRole == UserRole.Member) || (user2.UserRole == UserRole.Underling)))
             {
                 Member member2 = user2 as Member;
                 if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance)
                 {
                     decimal num2 = member2.Balance + ((order.GetTotal() * referralDeduct) / 100M);
                     BalanceDetailInfo balanceDetails = new BalanceDetailInfo();
                     balanceDetails.UserId = member2.UserId;
                     balanceDetails.UserName = member2.Username;
                     balanceDetails.TradeDate = DateTime.Now;
                     balanceDetails.TradeType = TradeTypes.ReferralDeduct;
                     balanceDetails.Income = new decimal?((order.GetTotal() * referralDeduct) / 100M);
                     balanceDetails.Balance = num2;
                     balanceDetails.Remark = string.Format("提成来自'{0}'的订单{1}", order.Username, order.OrderId);
                     PersonalProvider.Instance().AddBalanceDetail(balanceDetails);
                 }
             }
         }
         TradeProvider.Instance().UpdateUserAccount(order.GetTotal(), point.Points, order.UserId);
         int historyPoint = TradeProvider.Instance().GetHistoryPoint(member.UserId);
         TradeProvider.Instance().ChangeMemberGrade(member.UserId, member.GradeId, historyPoint);
         Users.ClearUserCache(user);
     }
     return flag;
 }
Esempio n. 14
0
 public static bool UserPayOrder(OrderInfo order)
 {
     OrderDao dao = new OrderDao();
     order.OrderStatus = OrderStatus.BuyerAlreadyPaid;
     order.PayDate = new DateTime?(DateTime.Now);
     bool flag = dao.UpdateOrder(order, null);
     if (flag)
     {
         dao.UpdatePayOrderStock(order.OrderId);
         foreach (LineItemInfo info in order.LineItems.Values)
         {
             ProductDao dao2 = new ProductDao();
             ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
             productDetails.SaleCounts += info.Quantity;
             productDetails.ShowSaleCounts += info.Quantity;
             dao2.UpdateProduct(productDetails, null);
         }
         MemberInfo member = GetMember(order.UserId);
         if (member == null)
         {
             return flag;
         }
         MemberDao dao3 = new MemberDao();
         PointDetailInfo point = new PointDetailInfo {
             OrderId = order.OrderId,
             UserId = member.UserId,
             TradeDate = DateTime.Now,
             TradeType = PointTradeType.Bounty,
             Increased = new int?(order.Points),
             Points = order.Points + member.Points
         };
         if ((point.Points > 0x7fffffff) || (point.Points < 0))
         {
             point.Points = 0x7fffffff;
         }
         PointDetailDao dao4 = new PointDetailDao();
         dao4.AddPointDetail(point);
         member.Expenditure += order.GetTotal();
         member.OrderNumber++;
         dao3.Update(member);
         Messenger.OrderPayment(member, order.OrderId, order.GetTotal());
         int historyPoint = dao4.GetHistoryPoint(member.UserId);
         List<MemberGradeInfo> memberGrades = new MemberGradeDao().GetMemberGrades() as List<MemberGradeInfo>;
         foreach (MemberGradeInfo info5 in from item in memberGrades
             orderby item.Points descending
             select item)
         {
             if (member.GradeId == info5.GradeId)
             {
                 return flag;
             }
             if (info5.Points <= historyPoint)
             {
                 member.GradeId = info5.GradeId;
                 dao3.Update(member);
                 return flag;
             }
         }
     }
     return flag;
 }
Esempio n. 15
0
 private void BindRemark(OrderInfo order)
 {
     this.spanOrderId.Text = order.OrderId;
     this.lblorderDateForRemark.Time = order.OrderDate;
     this.lblorderTotalForRemark.Money = order.GetTotal();
     this.txtRemark.Text = Globals.HtmlDecode(order.ManagerRemark);
     this.orderRemarkImageForRemark.SelectedValue = order.ManagerMark;
 }
Esempio n. 16
0
        private void BindOrderInfo(OrderInfo order)
        {
            litAddress.Text = order.ShippingRegion + order.Address;
            litCellPhone.Text = order.CellPhone;
            litTelPhone.Text = order.TelPhone;
            litZipCode.Text = order.ZipCode;
            litOrderId.Text = order.OrderId;
            litOrderDate.Text = order.OrderDate.ToString();
            litPayType.Text = order.PaymentType;
            litRemark.Text = order.Remark;
            litShipperMode.Text = order.RealModeName;
            litShippNo.Text = order.ShipOrderNumber;
            litSkipTo.Text = order.ShipTo;
            litActivity.Text = order.ActivityName;
            string str = string.Empty;
            if (order.OrderOptions.Count > 0)
            {
                IList<OrderOptionInfo> orderOptions = order.OrderOptions;
                str = str + "(";
                foreach (OrderOptionInfo info in orderOptions)
                {
                    string str2 = str;
                    str = str2 + info.ListDescription + ":" + info.ItemDescription + ";" + info.CustomerTitle + ":" + info.CustomerDescription;
                }
                str = str + ")";
                litOptionDes.Text = str;
            }
            switch (order.OrderStatus)
            {
                case OrderStatus.WaitBuyerPay:
                    litOrderStatus.Text = "等待付款";
                    break;

                case OrderStatus.BuyerAlreadyPaid:
                    litOrderStatus.Text = "已付款等待发货";
                    break;

                case OrderStatus.SellerAlreadySent:
                    litOrderStatus.Text = "已发货";
                    break;

                case OrderStatus.Closed:
                    litOrderStatus.Text = "已关闭";
                    break;

                case OrderStatus.Finished:
                    litOrderStatus.Text = "已完成";
                    break;
            }
            litPayMoney.Money = order.AdjustedPayCharge;
            litOptionMoney.Money = order.GetOptionPrice();
            litShippMoney.Money = order.AdjustedFreight;
            litTotalMoney.Money = order.GetTotal();
            litDiscountMoney.Money = order.AdjustedDiscount;
            litCouponMoney.Money = order.CouponValue;
            litItemsMoney.Money = order.GetAmount();
        }