protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Page.Request.QueryString["OrderId"])) { base.GotoResourceNotFound(); } else { orderId = Page.Request.QueryString["OrderId"]; order = SubsiteSalesHelper.GetOrderInfo(orderId); btnUpdateOrderAmount.Click += new EventHandler(btnUpdateOrderAmount_Click); grdOrderGift.RowDeleting += new GridViewDeleteEventHandler(grdOrderGift_RowDeleting); grdProducts.RowDeleting += new GridViewDeleteEventHandler(grdProducts_RowDeleting); grdProducts.RowCommand += new GridViewCommandEventHandler(grdProducts_RowCommand); if (!Page.IsPostBack) { if (order == null) { base.GotoResourceNotFound(); } else { BindProductList(order); BindOtherAmount(order); BindTatolAmount(order); } } } }
private void BindShippingAddress(OrderInfo order) { string shippingRegion = string.Empty; if (!string.IsNullOrEmpty(order.ShippingRegion)) { shippingRegion = order.ShippingRegion; } if (!string.IsNullOrEmpty(order.Address)) { shippingRegion = shippingRegion + order.Address; } if (!string.IsNullOrEmpty(order.ShipTo)) { shippingRegion = shippingRegion + " " + order.ShipTo; } if (!string.IsNullOrEmpty(order.ZipCode)) { shippingRegion = shippingRegion + " " + order.ZipCode; } if (!string.IsNullOrEmpty(order.TelPhone)) { shippingRegion = shippingRegion + " " + order.TelPhone; } if (!string.IsNullOrEmpty(order.CellPhone)) { shippingRegion = shippingRegion + " " + order.CellPhone; } litReceivingInfo.Text = shippingRegion; }
public override bool ConfirmOrderFinish(OrderInfo order) { DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Orders SET FinishDate = @FinishDate, OrderStatus = @OrderStatus WHERE OrderId = @OrderId"); database.AddInParameter(sqlStringCommand, "FinishDate", DbType.DateTime, DateTime.Now); database.AddInParameter(sqlStringCommand, "OrderStatus", DbType.Int32, 5); database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, order.OrderId); return (database.ExecuteNonQuery(sqlStringCommand) > 0); }
public static bool ConfirmOrderFinish(OrderInfo order) { bool flag = false; if (order.CheckAction(OrderActions.BUYER_CONFIRM_GOODS)) { flag = TradeProvider.Instance().ConfirmOrderFinish(order); } return flag; }
public override bool ConfirmOrderFinish(OrderInfo order) { DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE distro_Orders SET OrderStatus=@OrderStatus,FinishDate=@FinishDate WHERE OrderId = @OrderId AND DistributorUserId=@DistributorUserId"); database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, order.OrderId); database.AddInParameter(sqlStringCommand, "FinishDate", DbType.DateTime, DateTime.Now); database.AddInParameter(sqlStringCommand, "OrderStatus", DbType.Int32, 5); database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value); return (database.ExecuteNonQuery(sqlStringCommand) > 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(); }
public static bool AddOrderGift(OrderInfo order, GiftInfo gift, int quantity) { bool flag; using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection()) { connection.Open(); DbTransaction dbTran = connection.BeginTransaction(); try { if (!SubsiteSalesProvider.Instance().AddOrderGift(order.OrderId, gift, quantity, dbTran)) { dbTran.Rollback(); return false; } bool flag2 = false; foreach (OrderGiftInfo info in order.Gifts) { if (info.GiftId == gift.GiftId) { flag2 = true; info.Quantity += quantity; } } if (!flag2) { OrderGiftInfo item = new OrderGiftInfo(); item.GiftId = gift.GiftId; item.OrderId = order.OrderId; item.GiftName = gift.Name; item.Quantity = quantity; item.CostPrice = gift.PurchasePrice; item.ThumbnailsUrl = gift.ThumbnailUrl40; order.Gifts.Add(item); } if (!SubsiteSalesProvider.Instance().UpdateOrderAmount(order, dbTran)) { dbTran.Rollback(); return false; } dbTran.Commit(); flag = true; } catch { dbTran.Rollback(); flag = false; } finally { connection.Close(); } } return flag; }
public static bool ConfirmOrderFinish(OrderInfo order) { bool flag = false; if (order.CheckAction(OrderActions.BUYER_CONFIRM_GOODS)) { order.OrderStatus = OrderStatus.Finished; order.FinishDate = new DateTime?(DateTime.Now); flag = new OrderDao().UpdateOrder(order, null); } return flag; }
private void BindOrderItems(OrderInfo order) { grdOrderItems.DataSource = order.LineItems.Values; grdOrderItems.DataBind(); if (order.Gifts.Count > 0) { grdOrderGifts.DataSource = order.Gifts; grdOrderGifts.DataBind(); } else { grdOrderGifts.Visible = false; } }
public override bool CreatOrder(OrderInfo orderInfo) { bool flag = false; using (DbConnection connection = this.database.CreateConnection()) { connection.Open(); DbTransaction dbTran = connection.BeginTransaction(); try { if (!this.CreatOrder(orderInfo, dbTran)) { dbTran.Rollback(); return false; } if ((orderInfo.LineItems.Values.Count > 0) && !this.AddOrderLineItems(orderInfo.OrderId, orderInfo.LineItems.Values, dbTran)) { dbTran.Rollback(); return false; } if ((orderInfo.Gifts.Count > 0) && !this.AddOrderGiftItems(orderInfo.OrderId, orderInfo.Gifts, dbTran)) { dbTran.Rollback(); return false; } if (((orderInfo.OrderOptions != null) && (orderInfo.OrderOptions.Count > 0)) && !this.AddOrderOptions(orderInfo.OrderId, orderInfo.OrderOptions, dbTran)) { dbTran.Rollback(); return false; } if (!string.IsNullOrEmpty(orderInfo.CouponCode) && !this.AddCouponUseRecord(orderInfo.CouponCode, dbTran)) { dbTran.Rollback(); return false; } dbTran.Commit(); flag = true; } catch { dbTran.Rollback(); throw; } finally { connection.Close(); } } return flag; }
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); } } }
protected void Page_Load(object sender, EventArgs e) { if (Page.Request.QueryString["OrderId"] == null) { base.GotoResourceNotFound(); } else { orderId = Page.Request.QueryString["OrderId"]; order = SubsiteSalesHelper.GetOrderInfo(orderId); btnReturn.Click += new EventHandler(btnReturn_Click); btnSearch.Click += new EventHandler(btnSearch_Click); btnClear.Click += new EventHandler(btnClear_Click); dlstGifts.ItemCommand += new DataListCommandEventHandler(dlstGifts_ItemCommand); dlstOrderGifts.DeleteCommand += new DataListCommandEventHandler(dlstOrderGifts_DeleteCommand); if (!base.IsPostBack) { if (order == null) { base.GotoResourceNotFound(); } else if (order.OrderStatus != OrderStatus.WaitBuyerPay) { base.GotoResourceNotFound(); } else { if (order.Gifts.Count > 0) { litPageTitle.Text = "编辑订单礼品"; litPageNote.Text = "修改赠送给买家的礼品."; } BindGifts(); BindOrderGifts(); } } } }
protected override void OnInit(EventArgs e) { if (string.IsNullOrEmpty(Page.Request.QueryString["OrderId"])) { base.GotoResourceNotFound(); } else { orderId = Page.Request.QueryString["OrderId"]; Order = SubsiteSalesHelper.GetOrderInfo(orderId); if (Order == null) { base.GotoResourceNotFound(); } else if (Order.OrderStatus != pageOrderStatus) { Redirect(); } else { base.OnInit(e); } } }
void DoValidate() { NameValueCollection values2 = new NameValueCollection(); values2.Add(this.Page.Request.Form); values2.Add(this.Page.Request.QueryString); NameValueCollection parameters = values2; this.Gateway = this.Page.Request.QueryString["HIGW"]; this.Notify = PaymentNotify.CreateInstance(this.Gateway, parameters); if (this.isBackRequest) { this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("PaymentReturn_url", new object[] { this.Gateway })) + "?" + this.Page.Request.Url.Query; } this.Amount = this.Notify.GetOrderAmount(); this.OrderId = this.Notify.GetOrderId(); this.Order = TradeHelper.GetOrderInfo(this.OrderId); if (this.Order == null) { this.ResponseStatus(true, "ordernotfound"); } else { this.Order.GatewayOrderId = this.Notify.GetGatewayOrderId(); PaymentModeInfo paymentMode = TradeHelper.GetPaymentMode(this.Order.PaymentTypeId); if (paymentMode == null) { this.ResponseStatus(true, "gatewaynotfound"); } else { this.Notify.Finished += new EventHandler<FinishedEventArgs>(this.Notify_Finished); this.Notify.NotifyVerifyFaild += new EventHandler(this.Notify_NotifyVerifyFaild); this.Notify.Payment += new EventHandler(this.Notify_Payment); this.Notify.VerifyNotify(0x7530, Cryptographer.Decrypt(paymentMode.Settings)); } } }
protected override void OnInit(EventArgs e) { if (string.IsNullOrEmpty(this.Page.Request.QueryString["OrderId"])) { base.GotoResourceNotFound(); } else { this.orderId = this.Page.Request.QueryString["OrderId"]; this.Order = OrderHelper.GetOrderInfo(this.orderId); if (this.Order == null) { base.GotoResourceNotFound(); } else if (this.Order.OrderStatus != this.pageOrderStatus) { this.Redirect(); } else { base.OnInit(e); } } }
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; 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; } }
static void ReducedPoint(OrderInfo order, Member member) { UserPointInfo point = new UserPointInfo(); point.OrderId = order.OrderId; point.UserId = member.UserId; point.TradeDate = DateTime.Now; point.TradeType = UserPointTradeType.Refund; point.Reduced = new int?(Convert.ToInt32((decimal)(order.RefundAmount / HiContext.Current.SiteSettings.PointsRate))); point.Points = member.Points - point.Reduced.Value; SalesProvider.Instance().AddMemberPoint(point); }
public static OrderInfo PopulateOrder(IDataRecord reader) { if (reader == null) { return null; } OrderInfo info = new OrderInfo { OrderId = (string) reader["OrderId"] }; if (DBNull.Value != reader["GatewayOrderId"]) { info.GatewayOrderId = (string) reader["GatewayOrderId"]; } if (DBNull.Value != reader["Remark"]) { info.Remark = (string) reader["Remark"]; } if (DBNull.Value != reader["ManagerMark"]) { info.ManagerMark = new OrderMark?((OrderMark) reader["ManagerMark"]); } if (DBNull.Value != reader["ManagerRemark"]) { info.ManagerRemark = (string) reader["ManagerRemark"]; } if (DBNull.Value != reader["AdjustedDiscount"]) { info.AdjustedDiscount = (decimal) reader["AdjustedDiscount"]; } if (DBNull.Value != reader["OrderStatus"]) { info.OrderStatus = (OrderStatus) reader["OrderStatus"]; } if (DBNull.Value != reader["CloseReason"]) { info.CloseReason = (string) reader["CloseReason"]; } if (DBNull.Value != reader["OrderPoint"]) { info.Points = (int) reader["OrderPoint"]; } info.OrderDate = (DateTime) reader["OrderDate"]; if (DBNull.Value != reader["PayDate"]) { info.PayDate = new DateTime?((DateTime) reader["PayDate"]); } if (DBNull.Value != reader["ShippingDate"]) { info.ShippingDate = new DateTime?((DateTime) reader["ShippingDate"]); } if (DBNull.Value != reader["FinishDate"]) { info.FinishDate = new DateTime?((DateTime) reader["FinishDate"]); } info.UserId = (int) reader["UserId"]; info.Username = (string) reader["Username"]; info.ReferralUserId = (int) reader["ReferralUserId"]; if (DBNull.Value != reader["EmailAddress"]) { info.EmailAddress = (string) reader["EmailAddress"]; } if (DBNull.Value != reader["RealName"]) { info.RealName = (string) reader["RealName"]; } if (DBNull.Value != reader["QQ"]) { info.QQ = (string) reader["QQ"]; } if (DBNull.Value != reader["Wangwang"]) { info.Wangwang = (string) reader["Wangwang"]; } if (DBNull.Value != reader["MSN"]) { info.MSN = (string) reader["MSN"]; } if (DBNull.Value != reader["ShippingRegion"]) { info.ShippingRegion = (string) reader["ShippingRegion"]; } if (DBNull.Value != reader["Address"]) { info.Address = (string) reader["Address"]; } if (DBNull.Value != reader["ZipCode"]) { info.ZipCode = (string) reader["ZipCode"]; } if (DBNull.Value != reader["ShipTo"]) { info.ShipTo = (string) reader["ShipTo"]; } if (DBNull.Value != reader["TelPhone"]) { info.TelPhone = (string) reader["TelPhone"]; } if (DBNull.Value != reader["CellPhone"]) { info.CellPhone = (string) reader["CellPhone"]; } if (DBNull.Value != reader["ShipToDate"]) { info.ShipToDate = (string) reader["ShipToDate"]; } if (DBNull.Value != reader["ShippingModeId"]) { info.ShippingModeId = (int) reader["ShippingModeId"]; } if (DBNull.Value != reader["ModeName"]) { info.ModeName = (string) reader["ModeName"]; } if (DBNull.Value != reader["RealShippingModeId"]) { info.RealShippingModeId = (int) reader["RealShippingModeId"]; } if (DBNull.Value != reader["RealModeName"]) { info.RealModeName = (string) reader["RealModeName"]; } if (DBNull.Value != reader["RegionId"]) { info.RegionId = (int) reader["RegionId"]; } if (DBNull.Value != reader["Freight"]) { info.Freight = (decimal) reader["Freight"]; } if (DBNull.Value != reader["AdjustedFreight"]) { info.AdjustedFreight = (decimal) reader["AdjustedFreight"]; } if (DBNull.Value != reader["ShipOrderNumber"]) { info.ShipOrderNumber = (string) reader["ShipOrderNumber"]; } if (DBNull.Value != reader["ExpressCompanyName"]) { info.ExpressCompanyName = (string) reader["ExpressCompanyName"]; } if (DBNull.Value != reader["ExpressCompanyAbb"]) { info.ExpressCompanyAbb = (string) reader["ExpressCompanyAbb"]; } if (DBNull.Value != reader["PaymentTypeId"]) { info.PaymentTypeId = (int) reader["PaymentTypeId"]; } if (DBNull.Value != reader["PaymentType"]) { info.PaymentType = (string) reader["PaymentType"]; } if (DBNull.Value != reader["PayCharge"]) { info.PayCharge = (decimal) reader["PayCharge"]; } if (DBNull.Value != reader["RefundStatus"]) { info.RefundStatus = (RefundStatus) reader["RefundStatus"]; } if (DBNull.Value != reader["RefundAmount"]) { info.RefundAmount = (decimal) reader["RefundAmount"]; } if (DBNull.Value != reader["RefundRemark"]) { info.RefundRemark = (string) reader["RefundRemark"]; } if (DBNull.Value != reader["Gateway"]) { info.Gateway = (string) reader["Gateway"]; } if (DBNull.Value != reader["ReducedPromotionId"]) { info.ReducedPromotionId = (int) reader["ReducedPromotionId"]; } if (DBNull.Value != reader["ReducedPromotionName"]) { info.ReducedPromotionName = (string) reader["ReducedPromotionName"]; } if (DBNull.Value != reader["ReducedPromotionAmount"]) { info.ReducedPromotionAmount = (decimal) reader["ReducedPromotionAmount"]; } if (DBNull.Value != reader["IsReduced"]) { info.IsReduced = (bool) reader["IsReduced"]; } if (DBNull.Value != reader["SentTimesPointPromotionId"]) { info.SentTimesPointPromotionId = (int) reader["SentTimesPointPromotionId"]; } if (DBNull.Value != reader["SentTimesPointPromotionName"]) { info.SentTimesPointPromotionName = (string) reader["SentTimesPointPromotionName"]; } if (DBNull.Value != reader["IsSendTimesPoint"]) { info.IsSendTimesPoint = (bool) reader["IsSendTimesPoint"]; } if (DBNull.Value != reader["TimesPoint"]) { info.TimesPoint = (decimal) reader["TimesPoint"]; } if (DBNull.Value != reader["FreightFreePromotionId"]) { info.FreightFreePromotionId = (int) reader["FreightFreePromotionId"]; } if (DBNull.Value != reader["FreightFreePromotionName"]) { info.FreightFreePromotionName = (string) reader["FreightFreePromotionName"]; } if (DBNull.Value != reader["IsFreightFree"]) { info.IsFreightFree = (bool) reader["IsFreightFree"]; } if (DBNull.Value != reader["CouponName"]) { info.CouponName = (string) reader["CouponName"]; } if (DBNull.Value != reader["CouponCode"]) { info.CouponCode = (string) reader["CouponCode"]; } if (DBNull.Value != reader["CouponAmount"]) { info.CouponAmount = (decimal) reader["CouponAmount"]; } if (DBNull.Value != reader["CouponValue"]) { info.CouponValue = (decimal) reader["CouponValue"]; } if (DBNull.Value != reader["GroupBuyId"]) { info.GroupBuyId = (int) reader["GroupBuyId"]; } if (DBNull.Value != reader["CountDownBuyId"]) { info.CountDownBuyId = (int) reader["CountDownBuyId"]; } if (DBNull.Value != reader["Bundlingid"]) { info.BundlingID = (int) reader["Bundlingid"]; } if (DBNull.Value != reader["BundlingPrice"]) { info.BundlingPrice = (decimal) reader["BundlingPrice"]; } if (DBNull.Value != reader["NeedPrice"]) { info.NeedPrice = (decimal) reader["NeedPrice"]; } if (DBNull.Value != reader["GroupBuyStatus"]) { info.GroupBuyStatus = (GroupBuyStatus) reader["GroupBuyStatus"]; } if (DBNull.Value != reader["Tax"]) { info.Tax = (decimal) reader["Tax"]; } else { info.Tax = 0M; } if (DBNull.Value != reader["InvoiceTitle"]) { info.InvoiceTitle = (string) reader["InvoiceTitle"]; } else { info.InvoiceTitle = ""; } if (!((DBNull.Value == reader["ReferralUserId"]) || string.IsNullOrEmpty(reader["ReferralUserId"].ToString()))) { info.ReferralUserId = (int) reader["ReferralUserId"]; } return info; }
public static bool UpdateOrderShippingMode(OrderInfo order) { ManagerHelper.CheckPrivilege(Privilege.EditOrders); if (order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_SHIPPING_MODE)) { bool flag = SalesProvider.Instance().UpdateOrderShippingMode(order); if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "修改了订单“{0}”的配送方式", new object[] { order.OrderId })); } return flag; } return false; }
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; }
public override bool CreatePurchaseOrder(OrderInfo order, DbTransaction dbTran) { string str; PurchaseOrderInfo info = ConvertOrderToPurchaseOrder(order); if (info == null) { return false; } DbCommand sqlStringCommand = database.GetSqlStringCommand(" "); StringBuilder builder = new StringBuilder(); builder.Append("INSERT INTO Hishop_PurchaseOrders(PurchaseOrderId, OrderId, Remark, ManagerMark, ManagerRemark, AdjustedDiscount,PurchaseStatus, CloseReason, PurchaseDate, DistributorId, Distributorname,DistributorEmail, DistributorRealName, DistributorQQ, DistributorWangwang, DistributorMSN,ShippingRegion, Address, ZipCode, ShipTo, TelPhone, CellPhone, ShippingModeId, ModeName,RealShippingModeId, RealModeName, RegionId, Freight, AdjustedFreight, ShipOrderNumber, Weight,RefundStatus, RefundAmount, RefundRemark, OrderTotal, PurchaseProfit, PurchaseTotal,ExpressCompanyName,ExpressCompanyAbb)VALUES (@PurchaseOrderId, @OrderId, @Remark, @ManagerMark, @ManagerRemark, @AdjustedDiscount,@PurchaseStatus, @CloseReason, @PurchaseDate, @DistributorId, @Distributorname,@DistributorEmail, @DistributorRealName, @DistributorQQ, @DistributorWangwang, @DistributorMSN,@ShippingRegion, @Address, @ZipCode, @ShipTo, @TelPhone, @CellPhone, @ShippingModeId, @ModeName,@RealShippingModeId, @RealModeName, @RegionId, @Freight, @AdjustedFreight, @ShipOrderNumber, @PurchaseWeight,@RefundStatus, @RefundAmount, @RefundRemark, @OrderTotal, @PurchaseProfit, @PurchaseTotal,@ExpressCompanyName,@ExpressCompanyAbb);"); database.AddInParameter(sqlStringCommand, "PurchaseOrderId", DbType.String, info.PurchaseOrderId); database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, info.OrderId); database.AddInParameter(sqlStringCommand, "Remark", DbType.String, info.Remark); if (info.ManagerMark.HasValue) { database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, (int)info.ManagerMark.Value); } else { database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, DBNull.Value); } database.AddInParameter(sqlStringCommand, "ManagerRemark", DbType.String, info.ManagerRemark); database.AddInParameter(sqlStringCommand, "AdjustedDiscount", DbType.Currency, info.AdjustedDiscount); database.AddInParameter(sqlStringCommand, "PurchaseStatus", DbType.Int32, (int)info.PurchaseStatus); database.AddInParameter(sqlStringCommand, "CloseReason", DbType.String, info.CloseReason); database.AddInParameter(sqlStringCommand, "PurchaseDate", DbType.DateTime, DateTime.Now); database.AddInParameter(sqlStringCommand, "DistributorId", DbType.Int32, info.DistributorId); database.AddInParameter(sqlStringCommand, "Distributorname", DbType.String, info.Distributorname); database.AddInParameter(sqlStringCommand, "DistributorEmail", DbType.String, info.DistributorEmail); database.AddInParameter(sqlStringCommand, "DistributorRealName", DbType.String, info.DistributorRealName); database.AddInParameter(sqlStringCommand, "DistributorQQ", DbType.String, info.DistributorQQ); database.AddInParameter(sqlStringCommand, "DistributorWangwang", DbType.String, info.DistributorWangwang); database.AddInParameter(sqlStringCommand, "DistributorMSN", DbType.String, info.DistributorMSN); database.AddInParameter(sqlStringCommand, "ShippingRegion", DbType.String, info.ShippingRegion); database.AddInParameter(sqlStringCommand, "Address", DbType.String, info.Address); database.AddInParameter(sqlStringCommand, "ZipCode", DbType.String, info.ZipCode); database.AddInParameter(sqlStringCommand, "ShipTo", DbType.String, info.ShipTo); database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, info.TelPhone); database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, info.CellPhone); database.AddInParameter(sqlStringCommand, "ShippingModeId", DbType.Int32, info.ShippingModeId); database.AddInParameter(sqlStringCommand, "ModeName", DbType.String, info.ModeName); database.AddInParameter(sqlStringCommand, "RealShippingModeId", DbType.Int32, info.RealShippingModeId); database.AddInParameter(sqlStringCommand, "RealModeName", DbType.String, info.RealModeName); database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, info.RegionId); database.AddInParameter(sqlStringCommand, "Freight", DbType.Currency, info.Freight); database.AddInParameter(sqlStringCommand, "AdjustedFreight", DbType.Currency, info.AdjustedFreight); database.AddInParameter(sqlStringCommand, "ShipOrderNumber", DbType.String, info.ShipOrderNumber); database.AddInParameter(sqlStringCommand, "PurchaseWeight", DbType.Int32, info.Weight); database.AddInParameter(sqlStringCommand, "RefundStatus", DbType.Int32, (int)info.RefundStatus); database.AddInParameter(sqlStringCommand, "RefundAmount", DbType.Currency, info.RefundAmount); database.AddInParameter(sqlStringCommand, "RefundRemark", DbType.String, info.RefundRemark); database.AddInParameter(sqlStringCommand, "OrderTotal", DbType.Currency, info.OrderTotal); database.AddInParameter(sqlStringCommand, "PurchaseProfit", DbType.Currency, info.GetPurchaseProfit()); database.AddInParameter(sqlStringCommand, "PurchaseTotal", DbType.Currency, info.GetPurchaseTotal()); database.AddInParameter(sqlStringCommand, "ExpressCompanyAbb", DbType.String, info.ExpressCompanyAbb); database.AddInParameter(sqlStringCommand, "ExpressCompanyName", DbType.String, info.ExpressCompanyName); int num = 0; foreach (PurchaseOrderItemInfo info2 in info.PurchaseOrderItems) { str = num.ToString(); builder.Append("INSERT INTO Hishop_PurchaseOrderItems(PurchaseOrderId, SkuId, ProductId, SKU, Quantity, CostPrice, ").Append("ItemListPrice, ItemPurchasePrice, ItemDescription, ItemHomeSiteDescription, SKUContent, ThumbnailsUrl, Weight) VALUES( @PurchaseOrderId").Append(",@SkuId").Append(str).Append(",@ProductId").Append(str).Append(",@SKU").Append(str).Append(",@Quantity").Append(str).Append(",@CostPrice").Append(str).Append(",@ItemListPrice").Append(str).Append(",@ItemPurchasePrice").Append(str).Append(",@ItemDescription").Append(str).Append(",@ItemHomeSiteDescription").Append(str).Append(",@SKUContent").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Weight").Append(str).Append(");"); database.AddInParameter(sqlStringCommand, "SkuId" + str, DbType.String, info2.SkuId); database.AddInParameter(sqlStringCommand, "ProductId" + str, DbType.Int32, info2.ProductId); database.AddInParameter(sqlStringCommand, "SKU" + str, DbType.String, info2.SKU); database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info2.Quantity); database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info2.ItemCostPrice); database.AddInParameter(sqlStringCommand, "ItemListPrice" + str, DbType.Currency, info2.ItemListPrice); database.AddInParameter(sqlStringCommand, "ItemPurchasePrice" + str, DbType.Currency, info2.ItemPurchasePrice); database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info2.ItemDescription); database.AddInParameter(sqlStringCommand, "ItemHomeSiteDescription" + str, DbType.String, info2.ItemHomeSiteDescription); database.AddInParameter(sqlStringCommand, "SKUContent" + str, DbType.String, info2.SKUContent); database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info2.ThumbnailsUrl); database.AddInParameter(sqlStringCommand, "Weight" + str, DbType.Int32, info2.ItemWeight); num++; } foreach (PurchaseOrderGiftInfo info3 in info.PurchaseOrderGifts) { str = num.ToString(); builder.Append("INSERT INTO Hishop_PurchaseOrderGifts(PurchaseOrderId, GiftId, GiftName, CostPrice, PurchasePrice, ").Append("ThumbnailsUrl, Quantity) VALUES( @PurchaseOrderId,").Append("@GiftId").Append(str).Append(",@GiftName").Append(str).Append(",@CostPrice").Append(str).Append(",@PurchasePrice").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Quantity").Append(str).Append(");"); database.AddInParameter(sqlStringCommand, "GiftId" + str, DbType.Int32, info3.GiftId); database.AddInParameter(sqlStringCommand, "GiftName" + str, DbType.String, info3.GiftName); database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info3.Quantity); database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info3.CostPrice); database.AddInParameter(sqlStringCommand, "PurchasePrice" + str, DbType.Currency, info3.PurchasePrice); database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info3.ThumbnailsUrl); num++; } foreach (PurchaseOrderOptionInfo info4 in info.PurchaseOrderOptions) { str = num.ToString(); builder.Append("INSERT INTO Hishop_PurchaseOrderOptions (PurchaseOrderId, LookupListId, LookupItemId, ListDescription, ItemDescription, AdjustedPrice, CustomerTitle, CustomerDescription)").Append(" VALUES (@PurchaseOrderId, @LookupListId").Append(str).Append(", @LookupItemId").Append(str).Append(", @ListDescription").Append(str).Append(", @ItemDescription").Append(str).Append(", @AdjustedPrice").Append(str).Append(", @CustomerTitle").Append(str).Append(", @CustomerDescription").Append(str).Append(");"); database.AddInParameter(sqlStringCommand, "LookupListId" + str, DbType.Int32, info4.LookupListId); database.AddInParameter(sqlStringCommand, "LookupItemId" + str, DbType.Int32, info4.LookupItemId); database.AddInParameter(sqlStringCommand, "ListDescription" + str, DbType.String, info4.ListDescription); database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info4.ItemDescription); database.AddInParameter(sqlStringCommand, "AdjustedPrice" + str, DbType.Currency, info4.AdjustedPrice); database.AddInParameter(sqlStringCommand, "CustomerTitle" + str, DbType.String, info4.CustomerTitle); database.AddInParameter(sqlStringCommand, "CustomerDescription" + str, DbType.String, info4.CustomerDescription); num++; } sqlStringCommand.CommandText = builder.ToString().Remove(builder.Length - 1); if (dbTran != null) { return (database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0); } return (database.ExecuteNonQuery(sqlStringCommand) > 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()); }
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; } } }
public abstract bool CreatOrder(OrderInfo orderInfo);
public static OrderInfo PopulateOrder(IDataRecord reader) { if (reader == null) { return null; } OrderInfo info = new OrderInfo(); info.OrderId = (string) reader["OrderId"]; if (DBNull.Value != reader["GatewayOrderId"]) { info.GatewayOrderId = (string) reader["GatewayOrderId"]; } if (DBNull.Value != reader["Remark"]) { info.Remark = (string) reader["Remark"]; } if (DBNull.Value != reader["ManagerMark"]) { info.ManagerMark = new OrderMark?((OrderMark) reader["ManagerMark"]); } if (DBNull.Value != reader["ManagerRemark"]) { info.ManagerRemark = (string) reader["ManagerRemark"]; } if (DBNull.Value != reader["AdjustedDiscount"]) { info.AdjustedDiscount = (decimal) reader["AdjustedDiscount"]; } if (DBNull.Value != reader["OrderStatus"]) { info.OrderStatus = (OrderStatus) reader["OrderStatus"]; } if (DBNull.Value != reader["CloseReason"]) { info.CloseReason = (string) reader["CloseReason"]; } if (DBNull.Value != reader["OrderPoint"]) { info.Points = (int) reader["OrderPoint"]; } info.OrderDate = (DateTime) reader["OrderDate"]; if (DBNull.Value != reader["PayDate"]) { info.PayDate = (DateTime) reader["PayDate"]; } if (DBNull.Value != reader["ShippingDate"]) { info.ShippingDate = (DateTime) reader["ShippingDate"]; } if (DBNull.Value != reader["FinishDate"]) { info.FinishDate = (DateTime) reader["FinishDate"]; } info.UserId = (int) reader["UserId"]; info.Username = (string) reader["Username"]; if (DBNull.Value != reader["EmailAddress"]) { info.EmailAddress = (string) reader["EmailAddress"]; } if (DBNull.Value != reader["RealName"]) { info.RealName = (string) reader["RealName"]; } if (DBNull.Value != reader["QQ"]) { info.QQ = (string) reader["QQ"]; } if (DBNull.Value != reader["Wangwang"]) { info.Wangwang = (string) reader["Wangwang"]; } if (DBNull.Value != reader["MSN"]) { info.MSN = (string) reader["MSN"]; } if (DBNull.Value != reader["ShippingRegion"]) { info.ShippingRegion = (string) reader["ShippingRegion"]; } if (DBNull.Value != reader["Address"]) { info.Address = (string) reader["Address"]; } if (DBNull.Value != reader["ZipCode"]) { info.ZipCode = (string) reader["ZipCode"]; } if (DBNull.Value != reader["ShipTo"]) { info.ShipTo = (string) reader["ShipTo"]; } if (DBNull.Value != reader["TelPhone"]) { info.TelPhone = (string) reader["TelPhone"]; } if (DBNull.Value != reader["CellPhone"]) { info.CellPhone = (string) reader["CellPhone"]; } if (DBNull.Value != reader["ShippingModeId"]) { info.ShippingModeId = (int) reader["ShippingModeId"]; } if (DBNull.Value != reader["ModeName"]) { info.ModeName = (string) reader["ModeName"]; } if (DBNull.Value != reader["RealShippingModeId"]) { info.RealShippingModeId = (int) reader["RealShippingModeId"]; } if (DBNull.Value != reader["RealModeName"]) { info.RealModeName = (string) reader["RealModeName"]; } if (DBNull.Value != reader["RegionId"]) { info.RegionId = (int) reader["RegionId"]; } if (DBNull.Value != reader["Freight"]) { info.Freight = (decimal) reader["Freight"]; } if (DBNull.Value != reader["AdjustedFreight"]) { info.AdjustedFreight = (decimal) reader["AdjustedFreight"]; } if (DBNull.Value != reader["ShipOrderNumber"]) { info.ShipOrderNumber = (string) reader["ShipOrderNumber"]; } if (DBNull.Value != reader["ExpressCompanyName"]) { info.ExpressCompanyName = (string) reader["ExpressCompanyName"]; } if (DBNull.Value != reader["ExpressCompanyAbb"]) { info.ExpressCompanyAbb = (string) reader["ExpressCompanyAbb"]; } if (DBNull.Value != reader["PaymentTypeId"]) { info.PaymentTypeId = (int) reader["PaymentTypeId"]; } if (DBNull.Value != reader["PaymentType"]) { info.PaymentType = (string) reader["PaymentType"]; } if (DBNull.Value != reader["PayCharge"]) { info.PayCharge = (decimal) reader["PayCharge"]; } if (DBNull.Value != reader["AdjustedPayCharge"]) { info.AdjustedPayCharge = (decimal) reader["AdjustedPayCharge"]; } if (DBNull.Value != reader["RefundStatus"]) { info.RefundStatus = (RefundStatus) reader["RefundStatus"]; } if (DBNull.Value != reader["RefundAmount"]) { info.RefundAmount = (decimal) reader["RefundAmount"]; } if (DBNull.Value != reader["RefundRemark"]) { info.RefundRemark = (string) reader["RefundRemark"]; } if (DBNull.Value != reader["ActivityName"]) { info.ActivityName = (string) reader["ActivityName"]; } if (DBNull.Value != reader["ActivityId"]) { info.ActivityId = (int) reader["ActivityId"]; } if (DBNull.Value != reader["EightFree"]) { info.EightFree = (bool) reader["EightFree"]; } if (DBNull.Value != reader["ProcedureFeeFree"]) { info.ProcedureFeeFree = (bool) reader["ProcedureFeeFree"]; } if (DBNull.Value != reader["OrderOptionFree"]) { info.OrderOptionFree = (bool) reader["OrderOptionFree"]; } if (DBNull.Value != reader["DiscountName"]) { info.DiscountName = (string) reader["DiscountName"]; } if (DBNull.Value != reader["DiscountId"]) { info.DiscountId = (int) reader["DiscountId"]; } if (DBNull.Value != reader["DiscountValue"]) { info.DiscountValue = (decimal) reader["DiscountValue"]; } if (DBNull.Value != reader["DiscountAmount"]) { info.DiscountAmount = (decimal) reader["DiscountAmount"]; } if (DBNull.Value != reader["DiscountValueType"]) { info.DiscountValueType = (DiscountValueType) reader["DiscountValueType"]; } if (DBNull.Value != reader["CouponName"]) { info.CouponName = (string) reader["CouponName"]; } if (DBNull.Value != reader["CouponCode"]) { info.CouponCode = (string) reader["CouponCode"]; } if (DBNull.Value != reader["CouponAmount"]) { info.CouponAmount = (decimal) reader["CouponAmount"]; } if (DBNull.Value != reader["CouponValue"]) { info.CouponValue = (decimal) reader["CouponValue"]; } if (DBNull.Value != reader["GroupBuyId"]) { info.GroupBuyId = (int) reader["GroupBuyId"]; } if (DBNull.Value != reader["NeedPrice"]) { info.NeedPrice = (decimal) reader["NeedPrice"]; } if (DBNull.Value != reader["GroupBuyStatus"]) { info.GroupBuyStatus = (GroupBuyStatus) reader["GroupBuyStatus"]; } return info; }
static void ReduceDeduct(OrderInfo order, Member member) { int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct; if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0)) { IUser user = Users.GetUser(member.ReferralUserId.Value, false); if ((user != null) && (user.UserRole == UserRole.Member)) { Member member2 = user as Member; if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance) { decimal num2 = member2.Balance - ((order.RefundAmount * referralDeduct) / 100M); BalanceDetailInfo balanceDetail = new BalanceDetailInfo(); balanceDetail.UserId = member2.UserId; balanceDetail.UserName = member2.Username; balanceDetail.TradeDate = DateTime.Now; balanceDetail.TradeType = TradeTypes.ReferralDeduct; balanceDetail.Expenses = new decimal?((order.RefundAmount * referralDeduct) / 100M); balanceDetail.Balance = num2; balanceDetail.Remark = string.Format("退回提成因为'{0}'的订单{1}已退款", order.Username, order.OrderId); MemberProvider.Instance().InsertBalanceDetail(balanceDetail); } } } }
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); }
public static bool ClearOrderGifts(OrderInfo order) { bool flag; ManagerHelper.CheckPrivilege(Privilege.EditOrders); using (DbConnection connection = DatabaseFactory.CreateDatabase().CreateConnection()) { connection.Open(); DbTransaction dbTran = connection.BeginTransaction(); try { SalesProvider provider = SalesProvider.Instance(); order.Gifts.Clear(); if (!provider.ClearOrderGifts(order.OrderId, dbTran)) { dbTran.Rollback(); return false; } if (!provider.UpdateOrderAmount(order, dbTran)) { dbTran.Rollback(); return false; } dbTran.Commit(); flag = true; } catch { dbTran.Rollback(); flag = false; } finally { connection.Close(); } } if (flag) { EventLogs.WriteOperationLog(Privilege.EditOrders, string.Format(CultureInfo.InvariantCulture, "清空了订单号为\"{0}\"的订单礼品", new object[] { order.OrderId })); } return flag; }
private void btnRemark_Click(object sender, EventArgs e) { if (txtRemark.Text.Length > 300) { ShowMsg("备忘录长度限制在300个字符以内", false); } else { OrderInfo info2 = new OrderInfo(); info2.OrderId = hidOrderId.Value; OrderInfo order = info2; if (orderRemarkImageForRemark.SelectedItem != null) { order.ManagerMark = orderRemarkImageForRemark.SelectedValue; } order.ManagerRemark = Globals.HtmlEncode(txtRemark.Text.Trim()); if (SubsiteSalesHelper.SaveRemark(order)) { BindOrders(); ShowMsg("保存备忘录成功", true); } else { ShowMsg("保存失败", false); } } }
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); } }