public long CreateOrder(OrderInfo orderInfo) { using (SqlConnection connection = DbHelperSQL.GetConnection) { connection.Open(); using (SqlTransaction transaction = connection.BeginTransaction()) { try { orderInfo.OrderId = Globals.SafeLong(DbHelperSQL.GetSingle4Trans(this.GenerateOrderInfo(orderInfo), transaction).ToString(), (long) (-1L)); DbHelperSQL.ExecuteSqlTran4Indentity(this.GenerateOrderItems(orderInfo), transaction); DbHelperSQL.ExecuteSqlTran4Indentity(this.GenerateOrderAction(orderInfo), transaction); DbHelperSQL.ExecuteSqlTran4Indentity(this.CutSKUStock(orderInfo), transaction); if ((orderInfo.SubOrders != null) && (orderInfo.SubOrders.Count > 0)) { foreach (OrderInfo info in orderInfo.SubOrders) { info.ParentOrderId = orderInfo.OrderId; this.CreateSubOrder(info, transaction); } } transaction.Commit(); } catch (SqlException) { transaction.Rollback(); throw; } } } return orderInfo.OrderId; }
public static bool PayForOrder(OrderInfo orderInfo, User currentUser = new User()) { if ((orderInfo.OrderItems == null) || (orderInfo.OrderItems.Count < 1)) { orderInfo = orderManage.GetModelInfoByCache(orderInfo.OrderId); } if (orderInfo.HasChildren && (orderInfo.SubOrders.Count < 1)) { orderInfo.SubOrders = orderManage.GetModelList(" ParentOrderId=" + orderInfo.OrderId); } return service.PayForOrder(orderInfo, currentUser); }
public bool CancelOrder(OrderInfo orderInfo, User currentUser = new User()) { List<CommandInfo> cmdList = new List<CommandInfo>(); if ((orderInfo.OrderItems != null) && (orderInfo.OrderItems.Count > 0)) { foreach (Maticsoft.Model.Shop.Order.OrderItems items in orderInfo.OrderItems) { StringBuilder builder = new StringBuilder(); builder.Append("update Shop_SKUs set Stock=Stock+@Stock"); builder.Append(" where SKU=@SKU"); SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@SKU", SqlDbType.NVarChar, 50), new SqlParameter("@Stock", SqlDbType.Int, 4) }; parameterArray[0].Value = items.SKU; parameterArray[1].Value = items.Quantity; cmdList.Add(new CommandInfo(builder.ToString(), parameterArray)); } } StringBuilder builder2 = new StringBuilder(); builder2.Append("UPDATE Shop_Orders SET OrderStatus=-1, UpdatedDate=@UpdatedDate"); builder2.Append(" where OrderId=@OrderId OR ParentOrderId=@OrderId"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@UpdatedDate", SqlDbType.DateTime) }; para[0].Value = orderInfo.OrderId; para[1].Value = DateTime.Now; CommandInfo item = new CommandInfo(builder2.ToString(), para, EffentNextType.ExcuteEffectRows); cmdList.Add(item); StringBuilder builder3 = new StringBuilder(); builder3.Append("insert into Shop_OrderAction("); builder3.Append("OrderId,OrderCode,UserId,Username,ActionCode,ActionDate,Remark)"); builder3.Append(" values ("); builder3.Append("@OrderId,@OrderCode,@UserId,@Username,@ActionCode,@ActionDate,@Remark)"); SqlParameter[] parameterArray3 = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Username", SqlDbType.NVarChar, 200), new SqlParameter("@ActionCode", SqlDbType.NVarChar, 100), new SqlParameter("@ActionDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x3e8) }; parameterArray3[0].Value = orderInfo.OrderId; parameterArray3[1].Value = orderInfo.OrderCode; parameterArray3[2].Value = (currentUser != null) ? currentUser.UserID : orderInfo.BuyerID; parameterArray3[3].Value = (currentUser != null) ? currentUser.NickName : orderInfo.BuyerName; parameterArray3[4].Value = 0x65; parameterArray3[5].Value = DateTime.Now; if ((currentUser != null) && (currentUser.UserType == "AA")) { parameterArray3[6].Value = "管理员取消订单"; } else { parameterArray3[6].Value = "取消订单"; } item = new CommandInfo(builder3.ToString(), parameterArray3, EffentNextType.ExcuteEffectRows); cmdList.Add(item); return (DbHelperSQL.ExecuteSqlTran(cmdList) > 0); }
public long CreateSubOrder(OrderInfo subInfo, SqlTransaction transaction) { subInfo.OrderId = Globals.SafeLong(DbHelperSQL.GetSingle4Trans(this.GenerateOrderInfo(subInfo), transaction).ToString(), (long) (-1L)); DbHelperSQL.ExecuteSqlTran4Indentity(this.GenerateOrderItems(subInfo), transaction); DbHelperSQL.ExecuteSqlTran4Indentity(this.GenerateOrderAction(subInfo), transaction); return subInfo.OrderId; }
public bool PayForOrder(OrderInfo orderInfo, User currentUser = new User()) { List<CommandInfo> cmdList = new List<CommandInfo>(); StringBuilder builder = new StringBuilder(); builder.Append("UPDATE Shop_Orders SET OrderStatus=1, PaymentStatus=2, UpdatedDate=@UpdatedDate"); builder.Append(" WHERE OrderId=@OrderId OR ParentOrderId=@OrderId"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@UpdatedDate", SqlDbType.DateTime) }; para[0].Value = orderInfo.OrderId; para[1].Value = DateTime.Now; cmdList.Add(new CommandInfo(builder.ToString(), para, EffentNextType.ExcuteEffectRows)); StringBuilder builder2 = new StringBuilder(); builder2.Append("insert into Shop_OrderAction("); builder2.Append("OrderId,OrderCode,UserId,Username,ActionCode,ActionDate,Remark)"); builder2.Append(" values ("); builder2.Append("@OrderId,@OrderCode,@UserId,@Username,@ActionCode,@ActionDate,@Remark)"); SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Username", SqlDbType.NVarChar, 200), new SqlParameter("@ActionCode", SqlDbType.NVarChar, 100), new SqlParameter("@ActionDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x3e8) }; parameterArray2[0].Value = orderInfo.OrderId; parameterArray2[1].Value = orderInfo.OrderCode; parameterArray2[2].Value = (currentUser != null) ? currentUser.UserID : orderInfo.BuyerID; parameterArray2[3].Value = "系统"; parameterArray2[4].Value = 0x66; parameterArray2[5].Value = DateTime.Now; parameterArray2[6].Value = "支付订单"; cmdList.Add(new CommandInfo(builder2.ToString(), parameterArray2, EffentNextType.ExcuteEffectRows)); if (orderInfo.HasChildren && (orderInfo.SubOrders.Count > 0)) { foreach (OrderInfo info in orderInfo.SubOrders) { parameterArray2 = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Username", SqlDbType.NVarChar, 200), new SqlParameter("@ActionCode", SqlDbType.NVarChar, 100), new SqlParameter("@ActionDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x3e8) }; parameterArray2[0].Value = info.OrderId; parameterArray2[1].Value = info.OrderCode; parameterArray2[2].Value = (currentUser != null) ? currentUser.UserID : orderInfo.BuyerID; parameterArray2[3].Value = "系统"; parameterArray2[4].Value = 0x66; parameterArray2[5].Value = DateTime.Now; parameterArray2[6].Value = "支付订单"; cmdList.Add(new CommandInfo(builder2.ToString(), parameterArray2, EffentNextType.ExcuteEffectRows)); } } if ((orderInfo.OrderItems != null) && (orderInfo.OrderItems.Count > 0)) { foreach (Maticsoft.Model.Shop.Order.OrderItems items in orderInfo.OrderItems) { StringBuilder builder3 = new StringBuilder(); builder3.Append("update Shop_Products SET SaleCounts=SaleCounts+@Stock"); builder3.Append(" where ProductId=@ProductId"); SqlParameter[] parameterArray3 = new SqlParameter[] { new SqlParameter("@ProductId", SqlDbType.BigInt), new SqlParameter("@Stock", SqlDbType.Int, 4) }; parameterArray3[0].Value = items.ProductId; parameterArray3[1].Value = items.Quantity; cmdList.Add(new CommandInfo(builder3.ToString(), parameterArray3)); } } return (DbHelperSQL.ExecuteSqlTran(cmdList) > 0); }
private List<CommandInfo> GenerateOrderItems(OrderInfo orderInfo) { List<CommandInfo> list = new List<CommandInfo>(); foreach (Maticsoft.Model.Shop.Order.OrderItems items in orderInfo.OrderItems) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Shop_OrderItems("); builder.Append("OrderId,OrderCode,ProductId,ProductCode,SKU,Name,ThumbnailsUrl,Description,Quantity,ShipmentQuantity,CostPrice,SellPrice,AdjustedPrice,Attribute,Remark,Weight,Deduct,Points,ProductLineId,SupplierId,SupplierName)"); builder.Append(" values ("); builder.Append("@OrderId,@OrderCode,@ProductId,@ProductCode,@SKU,@Name,@ThumbnailsUrl,@Description,@Quantity,@ShipmentQuantity,@CostPrice,@SellPrice,@AdjustedPrice,@Attribute,@Remark,@Weight,@Deduct,@Points,@ProductLineId,@SupplierId,@SupplierName)"); builder.Append(";select @@IDENTITY"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@ProductId", SqlDbType.BigInt, 8), new SqlParameter("@ProductCode", SqlDbType.NVarChar, 50), new SqlParameter("@SKU", SqlDbType.NVarChar, 200), new SqlParameter("@Name", SqlDbType.NVarChar, 200), new SqlParameter("@ThumbnailsUrl", SqlDbType.NVarChar, 300), new SqlParameter("@Description", SqlDbType.NVarChar, 500), new SqlParameter("@Quantity", SqlDbType.Int, 4), new SqlParameter("@ShipmentQuantity", SqlDbType.Int, 4), new SqlParameter("@CostPrice", SqlDbType.Money, 8), new SqlParameter("@SellPrice", SqlDbType.Money, 8), new SqlParameter("@AdjustedPrice", SqlDbType.Money, 8), new SqlParameter("@Attribute", SqlDbType.Text), new SqlParameter("@Remark", SqlDbType.Text), new SqlParameter("@Weight", SqlDbType.Int, 4), new SqlParameter("@Deduct", SqlDbType.Money, 8), new SqlParameter("@Points", SqlDbType.Int, 4), new SqlParameter("@ProductLineId", SqlDbType.Int, 4), new SqlParameter("@SupplierId", SqlDbType.Int, 4), new SqlParameter("@SupplierName", SqlDbType.NVarChar, 100) }; para[0].Value = orderInfo.OrderId; para[1].Value = orderInfo.OrderCode; para[2].Value = items.ProductId; para[3].Value = items.ProductCode; para[4].Value = items.SKU; para[5].Value = items.Name; para[6].Value = items.ThumbnailsUrl; para[7].Value = items.Description; para[8].Value = items.Quantity; para[9].Value = items.ShipmentQuantity; para[10].Value = items.CostPrice; para[11].Value = items.SellPrice; para[12].Value = items.AdjustedPrice; para[13].Value = items.Attribute; para[14].Value = items.Remark; para[15].Value = items.Weight; para[0x10].Value = items.Deduct; para[0x11].Value = items.Points; para[0x12].Value = items.ProductLineId; para[0x13].Value = items.SupplierId; para[20].Value = items.SupplierName; list.Add(new CommandInfo(builder.ToString(), para, EffentNextType.ExcuteEffectRows)); } return list; }
public static bool CancelOrder(OrderInfo orderInfo, User currentUser) { return service.CancelOrder(orderInfo, currentUser); }
public bool Update(OrderInfo model) { StringBuilder builder = new StringBuilder(); builder.Append("update Shop_Orders set "); builder.Append("OrderCode=@OrderCode,"); builder.Append("ParentOrderId=@ParentOrderId,"); builder.Append("CreatedDate=@CreatedDate,"); builder.Append("UpdatedDate=@UpdatedDate,"); builder.Append("BuyerID=@BuyerID,"); builder.Append("BuyerName=@BuyerName,"); builder.Append("BuyerEmail=@BuyerEmail,"); builder.Append("BuyerCellPhone=@BuyerCellPhone,"); builder.Append("RegionId=@RegionId,"); builder.Append("ShipRegion=@ShipRegion,"); builder.Append("ShipAddress=@ShipAddress,"); builder.Append("ShipZipCode=@ShipZipCode,"); builder.Append("ShipName=@ShipName,"); builder.Append("ShipTelPhone=@ShipTelPhone,"); builder.Append("ShipCellPhone=@ShipCellPhone,"); builder.Append("ShipEmail=@ShipEmail,"); builder.Append("ShippingModeId=@ShippingModeId,"); builder.Append("ShippingModeName=@ShippingModeName,"); builder.Append("RealShippingModeId=@RealShippingModeId,"); builder.Append("RealShippingModeName=@RealShippingModeName,"); builder.Append("ShipperId=@ShipperId,"); builder.Append("ShipperName=@ShipperName,"); builder.Append("ShipperAddress=@ShipperAddress,"); builder.Append("ShipperCellPhone=@ShipperCellPhone,"); builder.Append("Freight=@Freight,"); builder.Append("FreightAdjusted=@FreightAdjusted,"); builder.Append("FreightActual=@FreightActual,"); builder.Append("Weight=@Weight,"); builder.Append("ShippingStatus=@ShippingStatus,"); builder.Append("ShipOrderNumber=@ShipOrderNumber,"); builder.Append("ExpressCompanyName=@ExpressCompanyName,"); builder.Append("ExpressCompanyAbb=@ExpressCompanyAbb,"); builder.Append("PaymentTypeId=@PaymentTypeId,"); builder.Append("PaymentTypeName=@PaymentTypeName,"); builder.Append("PaymentGateway=@PaymentGateway,"); builder.Append("PaymentStatus=@PaymentStatus,"); builder.Append("RefundStatus=@RefundStatus,"); builder.Append("PayCurrencyCode=@PayCurrencyCode,"); builder.Append("PayCurrencyName=@PayCurrencyName,"); builder.Append("PaymentFee=@PaymentFee,"); builder.Append("PaymentFeeAdjusted=@PaymentFeeAdjusted,"); builder.Append("GatewayOrderId=@GatewayOrderId,"); builder.Append("OrderTotal=@OrderTotal,"); builder.Append("OrderPoint=@OrderPoint,"); builder.Append("OrderCostPrice=@OrderCostPrice,"); builder.Append("OrderProfit=@OrderProfit,"); builder.Append("OrderOtherCost=@OrderOtherCost,"); builder.Append("OrderOptionPrice=@OrderOptionPrice,"); builder.Append("DiscountName=@DiscountName,"); builder.Append("DiscountAmount=@DiscountAmount,"); builder.Append("DiscountAdjusted=@DiscountAdjusted,"); builder.Append("DiscountValue=@DiscountValue,"); builder.Append("DiscountValueType=@DiscountValueType,"); builder.Append("CouponCode=@CouponCode,"); builder.Append("CouponName=@CouponName,"); builder.Append("CouponAmount=@CouponAmount,"); builder.Append("CouponValue=@CouponValue,"); builder.Append("CouponValueType=@CouponValueType,"); builder.Append("ActivityName=@ActivityName,"); builder.Append("ActivityFreeAmount=@ActivityFreeAmount,"); builder.Append("ActivityStatus=@ActivityStatus,"); builder.Append("GroupBuyId=@GroupBuyId,"); builder.Append("GroupBuyPrice=@GroupBuyPrice,"); builder.Append("GroupBuyStatus=@GroupBuyStatus,"); builder.Append("Amount=@Amount,"); builder.Append("OrderType=@OrderType,"); builder.Append("OrderStatus=@OrderStatus,"); builder.Append("SellerID=@SellerID,"); builder.Append("SellerName=@SellerName,"); builder.Append("SellerEmail=@SellerEmail,"); builder.Append("SellerCellPhone=@SellerCellPhone,"); builder.Append("CommentStatus=@CommentStatus,"); builder.Append("SupplierId=@SupplierId,"); builder.Append("SupplierName=@SupplierName,"); builder.Append("ReferID=@ReferID,"); builder.Append("ReferURL=@ReferURL,"); builder.Append("OrderIP=@OrderIP,"); builder.Append("Remark=@Remark,"); builder.Append("ProductTotal=@ProductTotal,"); builder.Append("HasChildren=@HasChildren,"); builder.Append("IsReviews=@IsReviews"); builder.Append(" where OrderId=@OrderId"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@ParentOrderId", SqlDbType.BigInt, 8), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@UpdatedDate", SqlDbType.DateTime), new SqlParameter("@BuyerID", SqlDbType.Int, 4), new SqlParameter("@BuyerName", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@ShipRegion", SqlDbType.NVarChar, 300), new SqlParameter("@ShipAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipZipCode", SqlDbType.NVarChar, 20), new SqlParameter("@ShipName", SqlDbType.NVarChar, 50), new SqlParameter("@ShipTelPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipEmail", SqlDbType.NVarChar, 100), new SqlParameter("@ShippingModeId", SqlDbType.Int, 4), new SqlParameter("@ShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@RealShippingModeId", SqlDbType.Int, 4), new SqlParameter("@RealShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperId", SqlDbType.Int, 4), new SqlParameter("@ShipperName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipperCellPhone", SqlDbType.NVarChar, 20), new SqlParameter("@Freight", SqlDbType.Money, 8), new SqlParameter("@FreightAdjusted", SqlDbType.Money, 8), new SqlParameter("@FreightActual", SqlDbType.Money, 8), new SqlParameter("@Weight", SqlDbType.Int, 4), new SqlParameter("@ShippingStatus", SqlDbType.SmallInt, 2), new SqlParameter("@ShipOrderNumber", SqlDbType.NVarChar, 50), new SqlParameter("@ExpressCompanyName", SqlDbType.NVarChar, 500), new SqlParameter("@ExpressCompanyAbb", SqlDbType.NVarChar, 500), new SqlParameter("@PaymentTypeId", SqlDbType.Int, 4), new SqlParameter("@PaymentTypeName", SqlDbType.NVarChar, 100), new SqlParameter("@PaymentGateway", SqlDbType.NVarChar, 50), new SqlParameter("@PaymentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@RefundStatus", SqlDbType.SmallInt, 2), new SqlParameter("@PayCurrencyCode", SqlDbType.NVarChar, 20), new SqlParameter("@PayCurrencyName", SqlDbType.NVarChar, 20), new SqlParameter("@PaymentFee", SqlDbType.Money, 8), new SqlParameter("@PaymentFeeAdjusted", SqlDbType.Money, 8), new SqlParameter("@GatewayOrderId", SqlDbType.NVarChar, 100), new SqlParameter("@OrderTotal", SqlDbType.Money, 8), new SqlParameter("@OrderPoint", SqlDbType.Int, 4), new SqlParameter("@OrderCostPrice", SqlDbType.Money, 8), new SqlParameter("@OrderProfit", SqlDbType.Money, 8), new SqlParameter("@OrderOtherCost", SqlDbType.Money, 8), new SqlParameter("@OrderOptionPrice", SqlDbType.Money, 8), new SqlParameter("@DiscountName", SqlDbType.NVarChar, 200), new SqlParameter("@DiscountAmount", SqlDbType.Money, 8), new SqlParameter("@DiscountAdjusted", SqlDbType.Money, 8), new SqlParameter("@DiscountValue", SqlDbType.Money, 8), new SqlParameter("@DiscountValueType", SqlDbType.SmallInt, 2), new SqlParameter("@CouponCode", SqlDbType.NVarChar, 50), new SqlParameter("@CouponName", SqlDbType.NVarChar, 100), new SqlParameter("@CouponAmount", SqlDbType.Money, 8), new SqlParameter("@CouponValue", SqlDbType.Money, 8), new SqlParameter("@CouponValueType", SqlDbType.SmallInt, 2), new SqlParameter("@ActivityName", SqlDbType.NVarChar, 200), new SqlParameter("@ActivityFreeAmount", SqlDbType.Money, 8), new SqlParameter("@ActivityStatus", SqlDbType.SmallInt, 2), new SqlParameter("@GroupBuyId", SqlDbType.Int, 4), new SqlParameter("@GroupBuyPrice", SqlDbType.Money, 8), new SqlParameter("@GroupBuyStatus", SqlDbType.SmallInt, 2), new SqlParameter("@Amount", SqlDbType.Money, 8), new SqlParameter("@OrderType", SqlDbType.SmallInt, 2), new SqlParameter("@OrderStatus", SqlDbType.SmallInt, 2), new SqlParameter("@SellerID", SqlDbType.Int, 4), new SqlParameter("@SellerName", SqlDbType.NVarChar, 100), new SqlParameter("@SellerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@SellerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@CommentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@SupplierId", SqlDbType.Int, 4), new SqlParameter("@SupplierName", SqlDbType.NVarChar, 100), new SqlParameter("@ReferID", SqlDbType.NVarChar, 50), new SqlParameter("@ReferURL", SqlDbType.NVarChar, 200), new SqlParameter("@OrderIP", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x7d0), new SqlParameter("@ProductTotal", SqlDbType.Money, 8), new SqlParameter("@HasChildren", SqlDbType.Bit, 1), new SqlParameter("@IsReviews", SqlDbType.Bit, 1), new SqlParameter("@OrderId", SqlDbType.BigInt, 8) }; cmdParms[0].Value = model.OrderCode; cmdParms[1].Value = model.ParentOrderId; cmdParms[2].Value = model.CreatedDate; cmdParms[3].Value = model.UpdatedDate; cmdParms[4].Value = model.BuyerID; cmdParms[5].Value = model.BuyerName; cmdParms[6].Value = model.BuyerEmail; cmdParms[7].Value = model.BuyerCellPhone; cmdParms[8].Value = model.RegionId; cmdParms[9].Value = model.ShipRegion; cmdParms[10].Value = model.ShipAddress; cmdParms[11].Value = model.ShipZipCode; cmdParms[12].Value = model.ShipName; cmdParms[13].Value = model.ShipTelPhone; cmdParms[14].Value = model.ShipCellPhone; cmdParms[15].Value = model.ShipEmail; cmdParms[0x10].Value = model.ShippingModeId; cmdParms[0x11].Value = model.ShippingModeName; cmdParms[0x12].Value = model.RealShippingModeId; cmdParms[0x13].Value = model.RealShippingModeName; cmdParms[20].Value = model.ShipperId; cmdParms[0x15].Value = model.ShipperName; cmdParms[0x16].Value = model.ShipperAddress; cmdParms[0x17].Value = model.ShipperCellPhone; cmdParms[0x18].Value = model.Freight; cmdParms[0x19].Value = model.FreightAdjusted; cmdParms[0x1a].Value = model.FreightActual; cmdParms[0x1b].Value = model.Weight; cmdParms[0x1c].Value = model.ShippingStatus; cmdParms[0x1d].Value = model.ShipOrderNumber; cmdParms[30].Value = model.ExpressCompanyName; cmdParms[0x1f].Value = model.ExpressCompanyAbb; cmdParms[0x20].Value = model.PaymentTypeId; cmdParms[0x21].Value = model.PaymentTypeName; cmdParms[0x22].Value = model.PaymentGateway; cmdParms[0x23].Value = model.PaymentStatus; cmdParms[0x24].Value = model.RefundStatus; cmdParms[0x25].Value = model.PayCurrencyCode; cmdParms[0x26].Value = model.PayCurrencyName; cmdParms[0x27].Value = model.PaymentFee; cmdParms[40].Value = model.PaymentFeeAdjusted; cmdParms[0x29].Value = model.GatewayOrderId; cmdParms[0x2a].Value = model.OrderTotal; cmdParms[0x2b].Value = model.OrderPoint; cmdParms[0x2c].Value = model.OrderCostPrice; cmdParms[0x2d].Value = model.OrderProfit; cmdParms[0x2e].Value = model.OrderOtherCost; cmdParms[0x2f].Value = model.OrderOptionPrice; cmdParms[0x30].Value = model.DiscountName; cmdParms[0x31].Value = model.DiscountAmount; cmdParms[50].Value = model.DiscountAdjusted; cmdParms[0x33].Value = model.DiscountValue; cmdParms[0x34].Value = model.DiscountValueType; cmdParms[0x35].Value = model.CouponCode; cmdParms[0x36].Value = model.CouponName; cmdParms[0x37].Value = model.CouponAmount; cmdParms[0x38].Value = model.CouponValue; cmdParms[0x39].Value = model.CouponValueType; cmdParms[0x3a].Value = model.ActivityName; cmdParms[0x3b].Value = model.ActivityFreeAmount; cmdParms[60].Value = model.ActivityStatus; cmdParms[0x3d].Value = model.GroupBuyId; cmdParms[0x3e].Value = model.GroupBuyPrice; cmdParms[0x3f].Value = model.GroupBuyStatus; cmdParms[0x40].Value = model.Amount; cmdParms[0x41].Value = model.OrderType; cmdParms[0x42].Value = model.OrderStatus; cmdParms[0x43].Value = model.SellerID; cmdParms[0x44].Value = model.SellerName; cmdParms[0x45].Value = model.SellerEmail; cmdParms[70].Value = model.SellerCellPhone; cmdParms[0x47].Value = model.CommentStatus; cmdParms[0x48].Value = model.SupplierId; cmdParms[0x49].Value = model.SupplierName; cmdParms[0x4a].Value = model.ReferID; cmdParms[0x4b].Value = model.ReferURL; cmdParms[0x4c].Value = model.OrderIP; cmdParms[0x4d].Value = model.Remark; cmdParms[0x4e].Value = model.ProductTotal; cmdParms[0x4f].Value = model.HasChildren; cmdParms[80].Value = model.IsReviews; cmdParms[0x51].Value = model.OrderId; return (DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
private string SubmitOrder(HttpContext context) { ShoppingCartInfo info2; Action<ShoppingCartItem> action = null; ShoppingCartHelper shoppingCartHelper; OrderInfo mainOrder; Maticsoft.Model.Shop.Order.OrderItems tmpOrderItem; JsonObject obj2 = new JsonObject(); PaymentModeInfo paymentModeInfo = this.GetPaymentModeInfo(context); if (paymentModeInfo == null) { obj2.Accumulate("STATUS", "NOPAYMENTMODEINFO"); return obj2.ToString(); } User buyerUserInfo = this.GetBuyerUserInfo(context); if (buyerUserInfo == null) { obj2.Accumulate("STATUS", "NOLOGIN"); return obj2.ToString(); } if (buyerUserInfo.UserType == "AA") { obj2.Accumulate("STATUS", "UNAUTHORIZED"); return obj2.ToString(); } try { info2 = this.GetShoppingCart(context, buyerUserInfo, out shoppingCartHelper); } catch (ArgumentNullException) { obj2.Accumulate("STATUS", "PROSALEEXPIRED"); return obj2.ToString(); } if (((info2 == null) || (info2.Items == null)) || (info2.Items.Count < 1)) { obj2.Accumulate("STATUS", "NOSHOPPINGCARTINFO"); return obj2.ToString(); } List<ShoppingCartItem> list = new List<ShoppingCartItem>(); foreach (ShoppingCartItem item in info2.Items) { if (item.Quantity > this._skuInfoManage.GetStockBySKU(item.SKU)) { list.Add(item); } } if (list.Count > 0) { obj2.Accumulate("STATUS", "NOSTOCK"); obj2.Accumulate("DATA", list); if (shoppingCartHelper != null) { if (action == null) { action = delegate (ShoppingCartItem info) { shoppingCartHelper.RemoveItem(info.ItemId); }; } list.ForEach(action); } return obj2.ToString(); } Maticsoft.Model.Shop.Shipping.ShippingAddress shippingAddress = this.GetShippingAddress(context); if (shippingAddress == null) { obj2.Accumulate("STATUS", "NOSHIPPINGADDRESS"); return obj2.ToString(); } Maticsoft.Model.Ms.Regions modelByCache = this._regionManage.GetModelByCache(shippingAddress.RegionId); if (modelByCache == null) { obj2.Accumulate("STATUS", "NOREGIONINFO"); return obj2.ToString(); } Maticsoft.Model.Shop.Shipping.ShippingType shippingType = this.GetShippingType(context); if (shippingType == null) { obj2.Accumulate("STATUS", "NOSHIPPINGTYPE"); return obj2.ToString(); } mainOrder = new OrderInfo { CreatedDate = DateTime.Now, OrderCode = mainOrder.CreatedDate.ToString("yyyyMMddHHmmssfff"), PaymentTypeId = paymentModeInfo.ModeId, PaymentTypeName = paymentModeInfo.Name, PaymentGateway = paymentModeInfo.Gateway, Weight = new int?(info2.TotalWeight), FreightAdjusted = mainOrder.FreightActual = mainOrder.Freight = new decimal?(info2.CalcFreight(shippingType)), CouponAmount = 0 }; string couponCode = context.Request.Form["Coupon"]; Maticsoft.Model.Shop.Coupon.CouponInfo couponInfo = this.couponBll.GetCouponInfo(couponCode, false); if (couponInfo != null) { mainOrder.CouponAmount = new decimal?(couponInfo.CouponPrice); mainOrder.CouponCode = couponInfo.CouponCode; mainOrder.CouponName = couponInfo.CouponName; mainOrder.CouponValue = new decimal?(couponInfo.CouponPrice); mainOrder.CouponValueType = 1; } mainOrder.ProductTotal = info2.TotalSellPrice; decimal totalCostPrice = info2.TotalCostPrice; mainOrder.OrderCostPrice = totalCostPrice + mainOrder.FreightActual; mainOrder.OrderTotal = info2.TotalSellPrice + mainOrder.Freight.Value; mainOrder.Amount = (info2.TotalAdjustedPrice + mainOrder.FreightAdjusted.Value) - mainOrder.CouponAmount.Value; mainOrder.OrderType = 1; mainOrder.OrderStatus = 0; mainOrder.BuyerID = buyerUserInfo.UserID; mainOrder.BuyerName = buyerUserInfo.UserName; mainOrder.BuyerEmail = string.IsNullOrWhiteSpace(buyerUserInfo.Email) ? "*****@*****.**" : buyerUserInfo.Email; mainOrder.BuyerCellPhone = buyerUserInfo.Phone; Dictionary<int, List<Maticsoft.Model.Shop.Order.OrderItems>> dicSuppOrderItems = new Dictionary<int, List<Maticsoft.Model.Shop.Order.OrderItems>>(); int orderPoint = 0; info2.Items.ForEach(delegate (ShoppingCartItem item) { Maticsoft.Model.Shop.Order.OrderItems items = new Maticsoft.Model.Shop.Order.OrderItems { Name = item.Name, SKU = item.SKU, Quantity = item.Quantity, ShipmentQuantity = item.Quantity, ThumbnailsUrl = item.ThumbnailsUrl, Points = item.Points, Weight = item.Weight, ProductId = item.ProductId, Description = item.Description, CostPrice = item.CostPrice, SellPrice = item.SellPrice, AdjustedPrice = item.AdjustedPrice, Deduct = new decimal?(item.SellPrice - item.AdjustedPrice), SupplierId = item.SupplierId, SupplierName = item.SupplierName }; tmpOrderItem = items; if ((item.SkuValues != null) && (item.SkuValues.Length > 0)) { tmpOrderItem.Attribute = string.Join(",", item.SkuValues); } mainOrder.OrderItems.Add(tmpOrderItem); if (tmpOrderItem.SupplierId.HasValue && (tmpOrderItem.SupplierId.Value > 0)) { if (dicSuppOrderItems.ContainsKey(tmpOrderItem.SupplierId.Value)) { dicSuppOrderItems[tmpOrderItem.SupplierId.Value].Add(tmpOrderItem); } else { List<Maticsoft.Model.Shop.Order.OrderItems> list = new List<Maticsoft.Model.Shop.Order.OrderItems> { tmpOrderItem }; dicSuppOrderItems.Add(tmpOrderItem.SupplierId.Value, list); } } orderPoint += tmpOrderItem.Points; }); mainOrder.OrderPoint = orderPoint; mainOrder.RegionId = new int?(shippingAddress.RegionId); mainOrder.ShipRegion = modelByCache.RegionName; mainOrder.ShipName = shippingAddress.ShipName; mainOrder.ShipEmail = shippingAddress.EmailAddress; mainOrder.ShipCellPhone = shippingAddress.CelPhone; mainOrder.ShipTelPhone = shippingAddress.TelPhone; mainOrder.ShipAddress = shippingAddress.Address; mainOrder.ShipZipCode = shippingAddress.Zipcode; mainOrder.ShippingModeId = new int?(shippingType.ModeId); mainOrder.ShippingModeName = shippingType.Name; mainOrder.RealShippingModeId = new int?(shippingType.ModeId); mainOrder.RealShippingModeName = shippingType.Name; mainOrder.ShippingStatus = 0; mainOrder.ExpressCompanyName = shippingType.ExpressCompanyName; mainOrder.ExpressCompanyAbb = shippingType.ExpressCompanyEn; Maticsoft.BLL.Shop.Supplier.SupplierInfo info4 = new Maticsoft.BLL.Shop.Supplier.SupplierInfo(); if (dicSuppOrderItems.Count > 1) { foreach (KeyValuePair<int, List<Maticsoft.Model.Shop.Order.OrderItems>> pair in dicSuppOrderItems) { OrderInfo subOrder; subOrder = new OrderInfo(mainOrder) { Weight = 0, FreightAdjusted = subOrder.FreightActual = subOrder.Freight = 0, OrderPoint = 0, ProductTotal = 0M, OrderCostPrice = 0, OrderOptionPrice = 0, OrderProfit = 0, Amount = 0M }; pair.Value.ForEach(delegate (Maticsoft.Model.Shop.Order.OrderItems info) { int? weight = subOrder.Weight; int num = info.Weight; subOrder.Weight = weight.HasValue ? new int?(weight.GetValueOrDefault() + num) : null; subOrder.OrderPoint += info.Points; subOrder.ProductTotal += info.SellPrice * info.Quantity; decimal? orderCostPrice = subOrder.OrderCostPrice; decimal num2 = info.CostPrice * info.Quantity; subOrder.OrderCostPrice = orderCostPrice.HasValue ? new decimal?(orderCostPrice.GetValueOrDefault() + num2) : null; subOrder.Amount += info.AdjustedPrice * info.Quantity; }); decimal? freightAdjusted = mainOrder.FreightAdjusted; decimal count = dicSuppOrderItems.Count; subOrder.FreightAdjusted = subOrder.FreightActual = subOrder.Freight = freightAdjusted.HasValue ? new decimal?(freightAdjusted.GetValueOrDefault() / count) : null; subOrder.OrderTotal = subOrder.ProductTotal + subOrder.Freight.Value; subOrder.Amount += subOrder.FreightAdjusted.Value; subOrder.OrderItems = pair.Value; subOrder.OrderType = 2; Maticsoft.Model.Shop.Supplier.SupplierInfo info5 = info4.GetModelByCache(pair.Key); if (info5 == null) { obj2.Accumulate("STATUS", "NOSUPPLIERINFO"); return obj2.ToString(); } subOrder.SupplierId = new int?(info5.SupplierId); subOrder.SupplierName = info5.Name; subOrder.CreatedDate = DateTime.Now; subOrder.OrderCode = subOrder.CreatedDate.ToString("yyyyMMddHHmmssfff"); mainOrder.SubOrders.Add(subOrder); } mainOrder.HasChildren = true; } else { mainOrder.SupplierId = info2.Items[0].SupplierId; mainOrder.SupplierName = info2.Items[0].SupplierName; mainOrder.HasChildren = false; } try { mainOrder.OrderId = OrderManage.CreateOrder(mainOrder); } catch (Exception exception) { LogHelp.AddErrorLog("订单创建失败: " + exception.Message, exception.StackTrace, context.Request); } obj2.Accumulate("DATA", new { OrderId = mainOrder.OrderId, OrderCode = mainOrder.OrderCode, Amount = mainOrder.Amount, PaymentTypeId = mainOrder.PaymentTypeId, PaymentTypeName = mainOrder.PaymentTypeName }); if (mainOrder.OrderId == -1L) { obj2.Accumulate("STATUS", "FAILED"); return obj2.ToString(); } if (!string.IsNullOrWhiteSpace(couponCode)) { this.couponBll.UseCoupon(couponCode, mainOrder.BuyerID, mainOrder.BuyerEmail); } if (shoppingCartHelper != null) { shoppingCartHelper.ClearShoppingCart(); } obj2.Accumulate("STATUS", "SUCCESS"); return obj2.ToString(); }
public bool UpdateShipped(OrderInfo orderModel) { return this.dal.UpdateShipped(orderModel); }
public bool Update(OrderInfo model) { return this.dal.Update(model); }
public long Add(OrderInfo model) { return this.dal.Add(model); }
public static long CreateOrder(OrderInfo orderInfo) { return service.CreateOrder(orderInfo); }
public OrderInfo DataRowToModel(DataRow row) { OrderInfo info = new OrderInfo(); if (row != null) { if ((row["OrderId"] != null) && (row["OrderId"].ToString() != "")) { info.OrderId = long.Parse(row["OrderId"].ToString()); } if (row["OrderCode"] != null) { info.OrderCode = row["OrderCode"].ToString(); } if ((row["ParentOrderId"] != null) && (row["ParentOrderId"].ToString() != "")) { info.ParentOrderId = long.Parse(row["ParentOrderId"].ToString()); } if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != "")) { info.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if ((row["UpdatedDate"] != null) && (row["UpdatedDate"].ToString() != "")) { info.UpdatedDate = new DateTime?(DateTime.Parse(row["UpdatedDate"].ToString())); } if ((row["BuyerID"] != null) && (row["BuyerID"].ToString() != "")) { info.BuyerID = int.Parse(row["BuyerID"].ToString()); } if (row["BuyerName"] != null) { info.BuyerName = row["BuyerName"].ToString(); } if (row["BuyerEmail"] != null) { info.BuyerEmail = row["BuyerEmail"].ToString(); } if (row["BuyerCellPhone"] != null) { info.BuyerCellPhone = row["BuyerCellPhone"].ToString(); } if ((row["RegionId"] != null) && (row["RegionId"].ToString() != "")) { info.RegionId = new int?(int.Parse(row["RegionId"].ToString())); } if (row["ShipRegion"] != null) { info.ShipRegion = row["ShipRegion"].ToString(); } if (row["ShipAddress"] != null) { info.ShipAddress = row["ShipAddress"].ToString(); } if (row["ShipZipCode"] != null) { info.ShipZipCode = row["ShipZipCode"].ToString(); } if (row["ShipName"] != null) { info.ShipName = row["ShipName"].ToString(); } if (row["ShipTelPhone"] != null) { info.ShipTelPhone = row["ShipTelPhone"].ToString(); } if (row["ShipCellPhone"] != null) { info.ShipCellPhone = row["ShipCellPhone"].ToString(); } if (row["ShipEmail"] != null) { info.ShipEmail = row["ShipEmail"].ToString(); } if ((row["ShippingModeId"] != null) && (row["ShippingModeId"].ToString() != "")) { info.ShippingModeId = new int?(int.Parse(row["ShippingModeId"].ToString())); } if (row["ShippingModeName"] != null) { info.ShippingModeName = row["ShippingModeName"].ToString(); } if ((row["RealShippingModeId"] != null) && (row["RealShippingModeId"].ToString() != "")) { info.RealShippingModeId = new int?(int.Parse(row["RealShippingModeId"].ToString())); } if (row["RealShippingModeName"] != null) { info.RealShippingModeName = row["RealShippingModeName"].ToString(); } if ((row["ShipperId"] != null) && (row["ShipperId"].ToString() != "")) { info.ShipperId = new int?(int.Parse(row["ShipperId"].ToString())); } if (row["ShipperName"] != null) { info.ShipperName = row["ShipperName"].ToString(); } if (row["ShipperAddress"] != null) { info.ShipperAddress = row["ShipperAddress"].ToString(); } if (row["ShipperCellPhone"] != null) { info.ShipperCellPhone = row["ShipperCellPhone"].ToString(); } if ((row["Freight"] != null) && (row["Freight"].ToString() != "")) { info.Freight = new decimal?(decimal.Parse(row["Freight"].ToString())); } if ((row["FreightAdjusted"] != null) && (row["FreightAdjusted"].ToString() != "")) { info.FreightAdjusted = new decimal?(decimal.Parse(row["FreightAdjusted"].ToString())); } if ((row["FreightActual"] != null) && (row["FreightActual"].ToString() != "")) { info.FreightActual = new decimal?(decimal.Parse(row["FreightActual"].ToString())); } if ((row["Weight"] != null) && (row["Weight"].ToString() != "")) { info.Weight = new int?(int.Parse(row["Weight"].ToString())); } if ((row["ShippingStatus"] != null) && (row["ShippingStatus"].ToString() != "")) { info.ShippingStatus = int.Parse(row["ShippingStatus"].ToString()); } if (row["ShipOrderNumber"] != null) { info.ShipOrderNumber = row["ShipOrderNumber"].ToString(); } if (row["ExpressCompanyName"] != null) { info.ExpressCompanyName = row["ExpressCompanyName"].ToString(); } if (row["ExpressCompanyAbb"] != null) { info.ExpressCompanyAbb = row["ExpressCompanyAbb"].ToString(); } if ((row["PaymentTypeId"] != null) && (row["PaymentTypeId"].ToString() != "")) { info.PaymentTypeId = int.Parse(row["PaymentTypeId"].ToString()); } if (row["PaymentTypeName"] != null) { info.PaymentTypeName = row["PaymentTypeName"].ToString(); } if (row["PaymentGateway"] != null) { info.PaymentGateway = row["PaymentGateway"].ToString(); } if ((row["PaymentStatus"] != null) && (row["PaymentStatus"].ToString() != "")) { info.PaymentStatus = int.Parse(row["PaymentStatus"].ToString()); } if ((row["RefundStatus"] != null) && (row["RefundStatus"].ToString() != "")) { info.RefundStatus = int.Parse(row["RefundStatus"].ToString()); } if (row["PayCurrencyCode"] != null) { info.PayCurrencyCode = row["PayCurrencyCode"].ToString(); } if (row["PayCurrencyName"] != null) { info.PayCurrencyName = row["PayCurrencyName"].ToString(); } if ((row["PaymentFee"] != null) && (row["PaymentFee"].ToString() != "")) { info.PaymentFee = new decimal?(decimal.Parse(row["PaymentFee"].ToString())); } if ((row["PaymentFeeAdjusted"] != null) && (row["PaymentFeeAdjusted"].ToString() != "")) { info.PaymentFeeAdjusted = new decimal?(decimal.Parse(row["PaymentFeeAdjusted"].ToString())); } if (row["GatewayOrderId"] != null) { info.GatewayOrderId = row["GatewayOrderId"].ToString(); } if ((row["OrderTotal"] != null) && (row["OrderTotal"].ToString() != "")) { info.OrderTotal = decimal.Parse(row["OrderTotal"].ToString()); } if ((row["OrderPoint"] != null) && (row["OrderPoint"].ToString() != "")) { info.OrderPoint = int.Parse(row["OrderPoint"].ToString()); } if ((row["OrderCostPrice"] != null) && (row["OrderCostPrice"].ToString() != "")) { info.OrderCostPrice = new decimal?(decimal.Parse(row["OrderCostPrice"].ToString())); } if ((row["OrderProfit"] != null) && (row["OrderProfit"].ToString() != "")) { info.OrderProfit = new decimal?(decimal.Parse(row["OrderProfit"].ToString())); } if ((row["OrderOtherCost"] != null) && (row["OrderOtherCost"].ToString() != "")) { info.OrderOtherCost = new decimal?(decimal.Parse(row["OrderOtherCost"].ToString())); } if ((row["OrderOptionPrice"] != null) && (row["OrderOptionPrice"].ToString() != "")) { info.OrderOptionPrice = new decimal?(decimal.Parse(row["OrderOptionPrice"].ToString())); } if (row["DiscountName"] != null) { info.DiscountName = row["DiscountName"].ToString(); } if ((row["DiscountAmount"] != null) && (row["DiscountAmount"].ToString() != "")) { info.DiscountAmount = new decimal?(decimal.Parse(row["DiscountAmount"].ToString())); } if ((row["DiscountAdjusted"] != null) && (row["DiscountAdjusted"].ToString() != "")) { info.DiscountAdjusted = new decimal?(decimal.Parse(row["DiscountAdjusted"].ToString())); } if ((row["DiscountValue"] != null) && (row["DiscountValue"].ToString() != "")) { info.DiscountValue = new decimal?(decimal.Parse(row["DiscountValue"].ToString())); } if ((row["DiscountValueType"] != null) && (row["DiscountValueType"].ToString() != "")) { info.DiscountValueType = new int?(int.Parse(row["DiscountValueType"].ToString())); } if (row["CouponCode"] != null) { info.CouponCode = row["CouponCode"].ToString(); } if (row["CouponName"] != null) { info.CouponName = row["CouponName"].ToString(); } if ((row["CouponAmount"] != null) && (row["CouponAmount"].ToString() != "")) { info.CouponAmount = new decimal?(decimal.Parse(row["CouponAmount"].ToString())); } if ((row["CouponValue"] != null) && (row["CouponValue"].ToString() != "")) { info.CouponValue = new decimal?(decimal.Parse(row["CouponValue"].ToString())); } if ((row["CouponValueType"] != null) && (row["CouponValueType"].ToString() != "")) { info.CouponValueType = new int?(int.Parse(row["CouponValueType"].ToString())); } if (row["ActivityName"] != null) { info.ActivityName = row["ActivityName"].ToString(); } if ((row["ActivityFreeAmount"] != null) && (row["ActivityFreeAmount"].ToString() != "")) { info.ActivityFreeAmount = new decimal?(decimal.Parse(row["ActivityFreeAmount"].ToString())); } if ((row["ActivityStatus"] != null) && (row["ActivityStatus"].ToString() != "")) { info.ActivityStatus = int.Parse(row["ActivityStatus"].ToString()); } if ((row["GroupBuyId"] != null) && (row["GroupBuyId"].ToString() != "")) { info.GroupBuyId = new int?(int.Parse(row["GroupBuyId"].ToString())); } if ((row["GroupBuyPrice"] != null) && (row["GroupBuyPrice"].ToString() != "")) { info.GroupBuyPrice = new decimal?(decimal.Parse(row["GroupBuyPrice"].ToString())); } if ((row["GroupBuyStatus"] != null) && (row["GroupBuyStatus"].ToString() != "")) { info.GroupBuyStatus = int.Parse(row["GroupBuyStatus"].ToString()); } if ((row["Amount"] != null) && (row["Amount"].ToString() != "")) { info.Amount = decimal.Parse(row["Amount"].ToString()); } if ((row["OrderType"] != null) && (row["OrderType"].ToString() != "")) { info.OrderType = int.Parse(row["OrderType"].ToString()); } if ((row["OrderStatus"] != null) && (row["OrderStatus"].ToString() != "")) { info.OrderStatus = int.Parse(row["OrderStatus"].ToString()); } if ((row["SellerID"] != null) && (row["SellerID"].ToString() != "")) { info.SellerID = new int?(int.Parse(row["SellerID"].ToString())); } if (row["SellerName"] != null) { info.SellerName = row["SellerName"].ToString(); } if (row["SellerEmail"] != null) { info.SellerEmail = row["SellerEmail"].ToString(); } if (row["SellerCellPhone"] != null) { info.SellerCellPhone = row["SellerCellPhone"].ToString(); } if ((row["CommentStatus"] != null) && (row["CommentStatus"].ToString() != "")) { info.CommentStatus = int.Parse(row["CommentStatus"].ToString()); } if ((row["SupplierId"] != null) && (row["SupplierId"].ToString() != "")) { info.SupplierId = new int?(int.Parse(row["SupplierId"].ToString())); } if (row["SupplierName"] != null) { info.SupplierName = row["SupplierName"].ToString(); } if (row["ReferID"] != null) { info.ReferID = row["ReferID"].ToString(); } if (row["ReferURL"] != null) { info.ReferURL = row["ReferURL"].ToString(); } if (row["OrderIP"] != null) { info.OrderIP = row["OrderIP"].ToString(); } if (row["Remark"] != null) { info.Remark = row["Remark"].ToString(); } if ((row["ProductTotal"] != null) && (row["ProductTotal"].ToString() != "")) { info.ProductTotal = decimal.Parse(row["ProductTotal"].ToString()); } if ((row["HasChildren"] != null) && (row["HasChildren"].ToString() != "")) { if ((row["HasChildren"].ToString() == "1") || (row["HasChildren"].ToString().ToLower() == "true")) { info.HasChildren = true; } else { info.HasChildren = false; } } if ((row["IsReviews"] != null) && (row["IsReviews"].ToString() != "")) { if ((row["IsReviews"].ToString() == "1") || (row["IsReviews"].ToString().ToLower() == "true")) { info.IsReviews = true; return info; } info.IsReviews = false; } } return info; }
private List<CommandInfo> CutSKUStock(OrderInfo orderInfo) { List<CommandInfo> list = new List<CommandInfo>(); foreach (Maticsoft.Model.Shop.Order.OrderItems items in orderInfo.OrderItems) { StringBuilder builder = new StringBuilder(); builder.Append("update Shop_SKUs set Stock=Stock-@Stock"); builder.Append(" where SKU=@SKU"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@SKU", SqlDbType.NVarChar, 50), new SqlParameter("@Stock", SqlDbType.Int, 4) }; para[0].Value = items.SKU; para[1].Value = items.Quantity; list.Add(new CommandInfo(builder.ToString(), para)); } return list; }
public long Add(OrderInfo model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Shop_Orders("); builder.Append("OrderCode,ParentOrderId,CreatedDate,UpdatedDate,BuyerID,BuyerName,BuyerEmail,BuyerCellPhone,RegionId,ShipRegion,ShipAddress,ShipZipCode,ShipName,ShipTelPhone,ShipCellPhone,ShipEmail,ShippingModeId,ShippingModeName,RealShippingModeId,RealShippingModeName,ShipperId,ShipperName,ShipperAddress,ShipperCellPhone,Freight,FreightAdjusted,FreightActual,Weight,ShippingStatus,ShipOrderNumber,ExpressCompanyName,ExpressCompanyAbb,PaymentTypeId,PaymentTypeName,PaymentGateway,PaymentStatus,RefundStatus,PayCurrencyCode,PayCurrencyName,PaymentFee,PaymentFeeAdjusted,GatewayOrderId,OrderTotal,OrderPoint,OrderCostPrice,OrderProfit,OrderOtherCost,OrderOptionPrice,DiscountName,DiscountAmount,DiscountAdjusted,DiscountValue,DiscountValueType,CouponCode,CouponName,CouponAmount,CouponValue,CouponValueType,ActivityName,ActivityFreeAmount,ActivityStatus,GroupBuyId,GroupBuyPrice,GroupBuyStatus,Amount,OrderType,OrderStatus,SellerID,SellerName,SellerEmail,SellerCellPhone,CommentStatus,SupplierId,SupplierName,ReferID,ReferURL,OrderIP,Remark,ProductTotal,HasChildren,IsReviews)"); builder.Append(" values ("); builder.Append("@OrderCode,@ParentOrderId,@CreatedDate,@UpdatedDate,@BuyerID,@BuyerName,@BuyerEmail,@BuyerCellPhone,@RegionId,@ShipRegion,@ShipAddress,@ShipZipCode,@ShipName,@ShipTelPhone,@ShipCellPhone,@ShipEmail,@ShippingModeId,@ShippingModeName,@RealShippingModeId,@RealShippingModeName,@ShipperId,@ShipperName,@ShipperAddress,@ShipperCellPhone,@Freight,@FreightAdjusted,@FreightActual,@Weight,@ShippingStatus,@ShipOrderNumber,@ExpressCompanyName,@ExpressCompanyAbb,@PaymentTypeId,@PaymentTypeName,@PaymentGateway,@PaymentStatus,@RefundStatus,@PayCurrencyCode,@PayCurrencyName,@PaymentFee,@PaymentFeeAdjusted,@GatewayOrderId,@OrderTotal,@OrderPoint,@OrderCostPrice,@OrderProfit,@OrderOtherCost,@OrderOptionPrice,@DiscountName,@DiscountAmount,@DiscountAdjusted,@DiscountValue,@DiscountValueType,@CouponCode,@CouponName,@CouponAmount,@CouponValue,@CouponValueType,@ActivityName,@ActivityFreeAmount,@ActivityStatus,@GroupBuyId,@GroupBuyPrice,@GroupBuyStatus,@Amount,@OrderType,@OrderStatus,@SellerID,@SellerName,@SellerEmail,@SellerCellPhone,@CommentStatus,@SupplierId,@SupplierName,@ReferID,@ReferURL,@OrderIP,@Remark,@ProductTotal,@HasChildren,@IsReviews)"); builder.Append(";select @@IDENTITY"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@ParentOrderId", SqlDbType.BigInt, 8), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@UpdatedDate", SqlDbType.DateTime), new SqlParameter("@BuyerID", SqlDbType.Int, 4), new SqlParameter("@BuyerName", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@ShipRegion", SqlDbType.NVarChar, 300), new SqlParameter("@ShipAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipZipCode", SqlDbType.NVarChar, 20), new SqlParameter("@ShipName", SqlDbType.NVarChar, 50), new SqlParameter("@ShipTelPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipEmail", SqlDbType.NVarChar, 100), new SqlParameter("@ShippingModeId", SqlDbType.Int, 4), new SqlParameter("@ShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@RealShippingModeId", SqlDbType.Int, 4), new SqlParameter("@RealShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperId", SqlDbType.Int, 4), new SqlParameter("@ShipperName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipperCellPhone", SqlDbType.NVarChar, 20), new SqlParameter("@Freight", SqlDbType.Money, 8), new SqlParameter("@FreightAdjusted", SqlDbType.Money, 8), new SqlParameter("@FreightActual", SqlDbType.Money, 8), new SqlParameter("@Weight", SqlDbType.Int, 4), new SqlParameter("@ShippingStatus", SqlDbType.SmallInt, 2), new SqlParameter("@ShipOrderNumber", SqlDbType.NVarChar, 50), new SqlParameter("@ExpressCompanyName", SqlDbType.NVarChar, 500), new SqlParameter("@ExpressCompanyAbb", SqlDbType.NVarChar, 500), new SqlParameter("@PaymentTypeId", SqlDbType.Int, 4), new SqlParameter("@PaymentTypeName", SqlDbType.NVarChar, 100), new SqlParameter("@PaymentGateway", SqlDbType.NVarChar, 50), new SqlParameter("@PaymentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@RefundStatus", SqlDbType.SmallInt, 2), new SqlParameter("@PayCurrencyCode", SqlDbType.NVarChar, 20), new SqlParameter("@PayCurrencyName", SqlDbType.NVarChar, 20), new SqlParameter("@PaymentFee", SqlDbType.Money, 8), new SqlParameter("@PaymentFeeAdjusted", SqlDbType.Money, 8), new SqlParameter("@GatewayOrderId", SqlDbType.NVarChar, 100), new SqlParameter("@OrderTotal", SqlDbType.Money, 8), new SqlParameter("@OrderPoint", SqlDbType.Int, 4), new SqlParameter("@OrderCostPrice", SqlDbType.Money, 8), new SqlParameter("@OrderProfit", SqlDbType.Money, 8), new SqlParameter("@OrderOtherCost", SqlDbType.Money, 8), new SqlParameter("@OrderOptionPrice", SqlDbType.Money, 8), new SqlParameter("@DiscountName", SqlDbType.NVarChar, 200), new SqlParameter("@DiscountAmount", SqlDbType.Money, 8), new SqlParameter("@DiscountAdjusted", SqlDbType.Money, 8), new SqlParameter("@DiscountValue", SqlDbType.Money, 8), new SqlParameter("@DiscountValueType", SqlDbType.SmallInt, 2), new SqlParameter("@CouponCode", SqlDbType.NVarChar, 50), new SqlParameter("@CouponName", SqlDbType.NVarChar, 100), new SqlParameter("@CouponAmount", SqlDbType.Money, 8), new SqlParameter("@CouponValue", SqlDbType.Money, 8), new SqlParameter("@CouponValueType", SqlDbType.SmallInt, 2), new SqlParameter("@ActivityName", SqlDbType.NVarChar, 200), new SqlParameter("@ActivityFreeAmount", SqlDbType.Money, 8), new SqlParameter("@ActivityStatus", SqlDbType.SmallInt, 2), new SqlParameter("@GroupBuyId", SqlDbType.Int, 4), new SqlParameter("@GroupBuyPrice", SqlDbType.Money, 8), new SqlParameter("@GroupBuyStatus", SqlDbType.SmallInt, 2), new SqlParameter("@Amount", SqlDbType.Money, 8), new SqlParameter("@OrderType", SqlDbType.SmallInt, 2), new SqlParameter("@OrderStatus", SqlDbType.SmallInt, 2), new SqlParameter("@SellerID", SqlDbType.Int, 4), new SqlParameter("@SellerName", SqlDbType.NVarChar, 100), new SqlParameter("@SellerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@SellerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@CommentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@SupplierId", SqlDbType.Int, 4), new SqlParameter("@SupplierName", SqlDbType.NVarChar, 100), new SqlParameter("@ReferID", SqlDbType.NVarChar, 50), new SqlParameter("@ReferURL", SqlDbType.NVarChar, 200), new SqlParameter("@OrderIP", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x7d0), new SqlParameter("@ProductTotal", SqlDbType.Money, 8), new SqlParameter("@HasChildren", SqlDbType.Bit, 1), new SqlParameter("@IsReviews", SqlDbType.Bit, 1) }; cmdParms[0].Value = model.OrderCode; cmdParms[1].Value = model.ParentOrderId; cmdParms[2].Value = model.CreatedDate; cmdParms[3].Value = model.UpdatedDate; cmdParms[4].Value = model.BuyerID; cmdParms[5].Value = model.BuyerName; cmdParms[6].Value = model.BuyerEmail; cmdParms[7].Value = model.BuyerCellPhone; cmdParms[8].Value = model.RegionId; cmdParms[9].Value = model.ShipRegion; cmdParms[10].Value = model.ShipAddress; cmdParms[11].Value = model.ShipZipCode; cmdParms[12].Value = model.ShipName; cmdParms[13].Value = model.ShipTelPhone; cmdParms[14].Value = model.ShipCellPhone; cmdParms[15].Value = model.ShipEmail; cmdParms[0x10].Value = model.ShippingModeId; cmdParms[0x11].Value = model.ShippingModeName; cmdParms[0x12].Value = model.RealShippingModeId; cmdParms[0x13].Value = model.RealShippingModeName; cmdParms[20].Value = model.ShipperId; cmdParms[0x15].Value = model.ShipperName; cmdParms[0x16].Value = model.ShipperAddress; cmdParms[0x17].Value = model.ShipperCellPhone; cmdParms[0x18].Value = model.Freight; cmdParms[0x19].Value = model.FreightAdjusted; cmdParms[0x1a].Value = model.FreightActual; cmdParms[0x1b].Value = model.Weight; cmdParms[0x1c].Value = model.ShippingStatus; cmdParms[0x1d].Value = model.ShipOrderNumber; cmdParms[30].Value = model.ExpressCompanyName; cmdParms[0x1f].Value = model.ExpressCompanyAbb; cmdParms[0x20].Value = model.PaymentTypeId; cmdParms[0x21].Value = model.PaymentTypeName; cmdParms[0x22].Value = model.PaymentGateway; cmdParms[0x23].Value = model.PaymentStatus; cmdParms[0x24].Value = model.RefundStatus; cmdParms[0x25].Value = model.PayCurrencyCode; cmdParms[0x26].Value = model.PayCurrencyName; cmdParms[0x27].Value = model.PaymentFee; cmdParms[40].Value = model.PaymentFeeAdjusted; cmdParms[0x29].Value = model.GatewayOrderId; cmdParms[0x2a].Value = model.OrderTotal; cmdParms[0x2b].Value = model.OrderPoint; cmdParms[0x2c].Value = model.OrderCostPrice; cmdParms[0x2d].Value = model.OrderProfit; cmdParms[0x2e].Value = model.OrderOtherCost; cmdParms[0x2f].Value = model.OrderOptionPrice; cmdParms[0x30].Value = model.DiscountName; cmdParms[0x31].Value = model.DiscountAmount; cmdParms[50].Value = model.DiscountAdjusted; cmdParms[0x33].Value = model.DiscountValue; cmdParms[0x34].Value = model.DiscountValueType; cmdParms[0x35].Value = model.CouponCode; cmdParms[0x36].Value = model.CouponName; cmdParms[0x37].Value = model.CouponAmount; cmdParms[0x38].Value = model.CouponValue; cmdParms[0x39].Value = model.CouponValueType; cmdParms[0x3a].Value = model.ActivityName; cmdParms[0x3b].Value = model.ActivityFreeAmount; cmdParms[60].Value = model.ActivityStatus; cmdParms[0x3d].Value = model.GroupBuyId; cmdParms[0x3e].Value = model.GroupBuyPrice; cmdParms[0x3f].Value = model.GroupBuyStatus; cmdParms[0x40].Value = model.Amount; cmdParms[0x41].Value = model.OrderType; cmdParms[0x42].Value = model.OrderStatus; cmdParms[0x43].Value = model.SellerID; cmdParms[0x44].Value = model.SellerName; cmdParms[0x45].Value = model.SellerEmail; cmdParms[70].Value = model.SellerCellPhone; cmdParms[0x47].Value = model.CommentStatus; cmdParms[0x48].Value = model.SupplierId; cmdParms[0x49].Value = model.SupplierName; cmdParms[0x4a].Value = model.ReferID; cmdParms[0x4b].Value = model.ReferURL; cmdParms[0x4c].Value = model.OrderIP; cmdParms[0x4d].Value = model.Remark; cmdParms[0x4e].Value = model.ProductTotal; cmdParms[0x4f].Value = model.HasChildren; cmdParms[80].Value = model.IsReviews; object single = DbHelperSQL.GetSingle(builder.ToString(), cmdParms); if (single == null) { return 0L; } return Convert.ToInt64(single); }
private List<CommandInfo> GenerateOrderAction(OrderInfo orderInfo) { StringBuilder builder = new StringBuilder(); builder.Append("insert into Shop_OrderAction("); builder.Append("OrderId,OrderCode,UserId,Username,ActionCode,ActionDate,Remark)"); builder.Append(" values ("); builder.Append("@OrderId,@OrderCode,@UserId,@Username,@ActionCode,@ActionDate,@Remark)"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8), new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@Username", SqlDbType.NVarChar, 200), new SqlParameter("@ActionCode", SqlDbType.NVarChar, 100), new SqlParameter("@ActionDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x3e8) }; para[0].Value = orderInfo.OrderId; para[1].Value = orderInfo.OrderCode; para[4].Value = 100; para[5].Value = DateTime.Now; para[2].Value = orderInfo.BuyerID; para[3].Value = orderInfo.BuyerName; para[6].Value = "创建订单"; return new List<CommandInfo> { new CommandInfo(builder.ToString(), para, 3) }; }
public bool UpdateShipped(OrderInfo model) { List<CommandInfo> cmdList = new List<CommandInfo>(); StringBuilder builder = new StringBuilder(); builder.Append("update Shop_Orders set "); builder.Append("OrderCode=@OrderCode,"); builder.Append("ParentOrderId=@ParentOrderId,"); builder.Append("CreatedDate=@CreatedDate,"); builder.Append("UpdatedDate=@UpdatedDate,"); builder.Append("BuyerID=@BuyerID,"); builder.Append("BuyerName=@BuyerName,"); builder.Append("BuyerEmail=@BuyerEmail,"); builder.Append("BuyerCellPhone=@BuyerCellPhone,"); builder.Append("RegionId=@RegionId,"); builder.Append("ShipRegion=@ShipRegion,"); builder.Append("ShipAddress=@ShipAddress,"); builder.Append("ShipZipCode=@ShipZipCode,"); builder.Append("ShipName=@ShipName,"); builder.Append("ShipTelPhone=@ShipTelPhone,"); builder.Append("ShipCellPhone=@ShipCellPhone,"); builder.Append("ShipEmail=@ShipEmail,"); builder.Append("ShippingModeId=@ShippingModeId,"); builder.Append("ShippingModeName=@ShippingModeName,"); builder.Append("RealShippingModeId=@RealShippingModeId,"); builder.Append("RealShippingModeName=@RealShippingModeName,"); builder.Append("ShipperId=@ShipperId,"); builder.Append("ShipperName=@ShipperName,"); builder.Append("ShipperAddress=@ShipperAddress,"); builder.Append("ShipperCellPhone=@ShipperCellPhone,"); builder.Append("Freight=@Freight,"); builder.Append("FreightAdjusted=@FreightAdjusted,"); builder.Append("FreightActual=@FreightActual,"); builder.Append("Weight=@Weight,"); builder.Append("ShippingStatus=@ShippingStatus,"); builder.Append("ShipOrderNumber=@ShipOrderNumber,"); builder.Append("ExpressCompanyName=@ExpressCompanyName,"); builder.Append("ExpressCompanyAbb=@ExpressCompanyAbb,"); builder.Append("PaymentTypeId=@PaymentTypeId,"); builder.Append("PaymentTypeName=@PaymentTypeName,"); builder.Append("PaymentGateway=@PaymentGateway,"); builder.Append("PaymentStatus=@PaymentStatus,"); builder.Append("RefundStatus=@RefundStatus,"); builder.Append("PayCurrencyCode=@PayCurrencyCode,"); builder.Append("PayCurrencyName=@PayCurrencyName,"); builder.Append("PaymentFee=@PaymentFee,"); builder.Append("PaymentFeeAdjusted=@PaymentFeeAdjusted,"); builder.Append("GatewayOrderId=@GatewayOrderId,"); builder.Append("OrderTotal=@OrderTotal,"); builder.Append("OrderPoint=@OrderPoint,"); builder.Append("OrderCostPrice=@OrderCostPrice,"); builder.Append("OrderProfit=@OrderProfit,"); builder.Append("OrderOtherCost=@OrderOtherCost,"); builder.Append("OrderOptionPrice=@OrderOptionPrice,"); builder.Append("DiscountName=@DiscountName,"); builder.Append("DiscountAmount=@DiscountAmount,"); builder.Append("DiscountAdjusted=@DiscountAdjusted,"); builder.Append("DiscountValue=@DiscountValue,"); builder.Append("DiscountValueType=@DiscountValueType,"); builder.Append("CouponCode=@CouponCode,"); builder.Append("CouponName=@CouponName,"); builder.Append("CouponAmount=@CouponAmount,"); builder.Append("CouponValue=@CouponValue,"); builder.Append("CouponValueType=@CouponValueType,"); builder.Append("ActivityName=@ActivityName,"); builder.Append("ActivityFreeAmount=@ActivityFreeAmount,"); builder.Append("ActivityStatus=@ActivityStatus,"); builder.Append("GroupBuyId=@GroupBuyId,"); builder.Append("GroupBuyPrice=@GroupBuyPrice,"); builder.Append("GroupBuyStatus=@GroupBuyStatus,"); builder.Append("Amount=@Amount,"); builder.Append("OrderType=@OrderType,"); builder.Append("OrderStatus=@OrderStatus,"); builder.Append("SellerID=@SellerID,"); builder.Append("SellerName=@SellerName,"); builder.Append("SellerEmail=@SellerEmail,"); builder.Append("SellerCellPhone=@SellerCellPhone,"); builder.Append("SupplierId=@SupplierId,"); builder.Append("SupplierName=@SupplierName,"); builder.Append("ReferID=@ReferID,"); builder.Append("ReferURL=@ReferURL,"); builder.Append("OrderIP=@OrderIP,"); builder.Append("Remark=@Remark,"); builder.Append("CommentStatus=@CommentStatus"); builder.Append(" where OrderId=@OrderId"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@OrderCode", SqlDbType.NVarChar, 50), new SqlParameter("@ParentOrderId", SqlDbType.BigInt, 8), new SqlParameter("@CreatedDate", SqlDbType.DateTime), new SqlParameter("@UpdatedDate", SqlDbType.DateTime), new SqlParameter("@BuyerID", SqlDbType.Int, 4), new SqlParameter("@BuyerName", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@BuyerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@RegionId", SqlDbType.Int, 4), new SqlParameter("@ShipRegion", SqlDbType.NVarChar, 300), new SqlParameter("@ShipAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipZipCode", SqlDbType.NVarChar, 20), new SqlParameter("@ShipName", SqlDbType.NVarChar, 50), new SqlParameter("@ShipTelPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@ShipEmail", SqlDbType.NVarChar, 100), new SqlParameter("@ShippingModeId", SqlDbType.Int, 4), new SqlParameter("@ShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@RealShippingModeId", SqlDbType.Int, 4), new SqlParameter("@RealShippingModeName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperId", SqlDbType.Int, 4), new SqlParameter("@ShipperName", SqlDbType.NVarChar, 100), new SqlParameter("@ShipperAddress", SqlDbType.NVarChar, 300), new SqlParameter("@ShipperCellPhone", SqlDbType.NVarChar, 20), new SqlParameter("@Freight", SqlDbType.Money, 8), new SqlParameter("@FreightAdjusted", SqlDbType.Money, 8), new SqlParameter("@FreightActual", SqlDbType.Money, 8), new SqlParameter("@Weight", SqlDbType.Int, 4), new SqlParameter("@ShippingStatus", SqlDbType.SmallInt, 2), new SqlParameter("@ShipOrderNumber", SqlDbType.NVarChar, 50), new SqlParameter("@ExpressCompanyName", SqlDbType.NVarChar, 500), new SqlParameter("@ExpressCompanyAbb", SqlDbType.NVarChar, 500), new SqlParameter("@PaymentTypeId", SqlDbType.Int, 4), new SqlParameter("@PaymentTypeName", SqlDbType.NVarChar, 100), new SqlParameter("@PaymentGateway", SqlDbType.NVarChar, 50), new SqlParameter("@PaymentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@RefundStatus", SqlDbType.SmallInt, 2), new SqlParameter("@PayCurrencyCode", SqlDbType.NVarChar, 20), new SqlParameter("@PayCurrencyName", SqlDbType.NVarChar, 20), new SqlParameter("@PaymentFee", SqlDbType.Money, 8), new SqlParameter("@PaymentFeeAdjusted", SqlDbType.Money, 8), new SqlParameter("@GatewayOrderId", SqlDbType.NVarChar, 100), new SqlParameter("@OrderTotal", SqlDbType.Money, 8), new SqlParameter("@OrderPoint", SqlDbType.Int, 4), new SqlParameter("@OrderCostPrice", SqlDbType.Money, 8), new SqlParameter("@OrderProfit", SqlDbType.Money, 8), new SqlParameter("@OrderOtherCost", SqlDbType.Money, 8), new SqlParameter("@OrderOptionPrice", SqlDbType.Money, 8), new SqlParameter("@DiscountName", SqlDbType.NVarChar, 200), new SqlParameter("@DiscountAmount", SqlDbType.Money, 8), new SqlParameter("@DiscountAdjusted", SqlDbType.Money, 8), new SqlParameter("@DiscountValue", SqlDbType.Money, 8), new SqlParameter("@DiscountValueType", SqlDbType.SmallInt, 2), new SqlParameter("@CouponCode", SqlDbType.NVarChar, 50), new SqlParameter("@CouponName", SqlDbType.NVarChar, 100), new SqlParameter("@CouponAmount", SqlDbType.Money, 8), new SqlParameter("@CouponValue", SqlDbType.Money, 8), new SqlParameter("@CouponValueType", SqlDbType.SmallInt, 2), new SqlParameter("@ActivityName", SqlDbType.NVarChar, 200), new SqlParameter("@ActivityFreeAmount", SqlDbType.Money, 8), new SqlParameter("@ActivityStatus", SqlDbType.SmallInt, 2), new SqlParameter("@GroupBuyId", SqlDbType.Int, 4), new SqlParameter("@GroupBuyPrice", SqlDbType.Money, 8), new SqlParameter("@GroupBuyStatus", SqlDbType.SmallInt, 2), new SqlParameter("@Amount", SqlDbType.Money, 8), new SqlParameter("@OrderType", SqlDbType.SmallInt, 2), new SqlParameter("@OrderStatus", SqlDbType.SmallInt, 2), new SqlParameter("@SellerID", SqlDbType.Int, 4), new SqlParameter("@SellerName", SqlDbType.NVarChar, 100), new SqlParameter("@SellerEmail", SqlDbType.NVarChar, 100), new SqlParameter("@SellerCellPhone", SqlDbType.NVarChar, 50), new SqlParameter("@SupplierId", SqlDbType.Int, 4), new SqlParameter("@SupplierName", SqlDbType.NVarChar, 100), new SqlParameter("@ReferID", SqlDbType.NVarChar, 50), new SqlParameter("@ReferURL", SqlDbType.NVarChar, 200), new SqlParameter("@OrderIP", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 0x7d0), new SqlParameter("@CommentStatus", SqlDbType.SmallInt, 2), new SqlParameter("@OrderId", SqlDbType.BigInt, 8) }; para[0].Value = model.OrderCode; para[1].Value = model.ParentOrderId; para[2].Value = model.CreatedDate; para[3].Value = model.UpdatedDate; para[4].Value = model.BuyerID; para[5].Value = model.BuyerName; para[6].Value = model.BuyerEmail; para[7].Value = model.BuyerCellPhone; para[8].Value = model.RegionId; para[9].Value = model.ShipRegion; para[10].Value = model.ShipAddress; para[11].Value = model.ShipZipCode; para[12].Value = model.ShipName; para[13].Value = model.ShipTelPhone; para[14].Value = model.ShipCellPhone; para[15].Value = model.ShipEmail; para[0x10].Value = model.ShippingModeId; para[0x11].Value = model.ShippingModeName; para[0x12].Value = model.RealShippingModeId; para[0x13].Value = model.RealShippingModeName; para[20].Value = model.ShipperId; para[0x15].Value = model.ShipperName; para[0x16].Value = model.ShipperAddress; para[0x17].Value = model.ShipperCellPhone; para[0x18].Value = model.Freight; para[0x19].Value = model.FreightAdjusted; para[0x1a].Value = model.FreightActual; para[0x1b].Value = model.Weight; para[0x1c].Value = model.ShippingStatus; para[0x1d].Value = model.ShipOrderNumber; para[30].Value = model.ExpressCompanyName; para[0x1f].Value = model.ExpressCompanyAbb; para[0x20].Value = model.PaymentTypeId; para[0x21].Value = model.PaymentTypeName; para[0x22].Value = model.PaymentGateway; para[0x23].Value = model.PaymentStatus; para[0x24].Value = model.RefundStatus; para[0x25].Value = model.PayCurrencyCode; para[0x26].Value = model.PayCurrencyName; para[0x27].Value = model.PaymentFee; para[40].Value = model.PaymentFeeAdjusted; para[0x29].Value = model.GatewayOrderId; para[0x2a].Value = model.OrderTotal; para[0x2b].Value = model.OrderPoint; para[0x2c].Value = model.OrderCostPrice; para[0x2d].Value = model.OrderProfit; para[0x2e].Value = model.OrderOtherCost; para[0x2f].Value = model.OrderOptionPrice; para[0x30].Value = model.DiscountName; para[0x31].Value = model.DiscountAmount; para[50].Value = model.DiscountAdjusted; para[0x33].Value = model.DiscountValue; para[0x34].Value = model.DiscountValueType; para[0x35].Value = model.CouponCode; para[0x36].Value = model.CouponName; para[0x37].Value = model.CouponAmount; para[0x38].Value = model.CouponValue; para[0x39].Value = model.CouponValueType; para[0x3a].Value = model.ActivityName; para[0x3b].Value = model.ActivityFreeAmount; para[60].Value = model.ActivityStatus; para[0x3d].Value = model.GroupBuyId; para[0x3e].Value = model.GroupBuyPrice; para[0x3f].Value = model.GroupBuyStatus; para[0x40].Value = model.Amount; para[0x41].Value = model.OrderType; para[0x42].Value = model.OrderStatus; para[0x43].Value = model.SellerID; para[0x44].Value = model.SellerName; para[0x45].Value = model.SellerEmail; para[70].Value = model.SellerCellPhone; para[0x47].Value = model.SupplierId; para[0x48].Value = model.SupplierName; para[0x49].Value = model.ReferID; para[0x4a].Value = model.ReferURL; para[0x4b].Value = model.OrderIP; para[0x4c].Value = model.Remark; para[0x4d].Value = model.CommentStatus; para[0x4e].Value = model.OrderId; CommandInfo item = new CommandInfo(builder.ToString(), para); cmdList.Add(item); StringBuilder builder2 = new StringBuilder(); builder2.Append("UPDATE Shop_OrderItems SET ShipmentQuantity=Quantity WHERE OrderId =@OrderId "); SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.BigInt, 8) }; parameterArray2[0].Value = model.OrderId; item = new CommandInfo(builder2.ToString(), parameterArray2); cmdList.Add(item); return (DbHelperSQL.ExecuteSqlTran(cmdList) > 0); }
public OrderInfo(OrderInfo orderInfo) { this._parentorderid = -1L; this._ordertype = 1; this._supplierid = -1; this._orderItems = new List<Maticsoft.Model.Shop.Order.OrderItems>(); this._subOrders = new List<OrderInfo>(); this._orderid = orderInfo.OrderId; this._ordercode = orderInfo.OrderCode; this._parentorderid = orderInfo.ParentOrderId; this._createddate = orderInfo.CreatedDate; this._updateddate = orderInfo.UpdatedDate; this._buyerid = orderInfo.BuyerID; this._buyername = orderInfo.BuyerName; this._buyeremail = orderInfo.BuyerEmail; this._buyercellphone = orderInfo.BuyerCellPhone; this._regionid = orderInfo.RegionId; this._shipregion = orderInfo.ShipRegion; this._shipaddress = orderInfo.ShipAddress; this._shipzipcode = orderInfo.ShipZipCode; this._shipname = orderInfo.ShipName; this._shiptelphone = orderInfo.ShipTelPhone; this._shipcellphone = orderInfo.ShipCellPhone; this._shipemail = orderInfo.ShipEmail; this._shippingmodeid = orderInfo.ShippingModeId; this._shippingmodename = orderInfo.ShippingModeName; this._realshippingmodeid = orderInfo.RealShippingModeId; this._realshippingmodename = orderInfo.RealShippingModeName; this._shipperid = orderInfo.ShipperId; this._shippername = orderInfo.ShipperName; this._shipperaddress = orderInfo.ShipperAddress; this._shippercellphone = orderInfo.ShipperCellPhone; this._freight = orderInfo.Freight; this._freightadjusted = orderInfo.FreightAdjusted; this._freightactual = orderInfo.FreightActual; this._weight = orderInfo.Weight; this._shippingstatus = orderInfo.ShippingStatus; this._shipordernumber = orderInfo.ShipOrderNumber; this._expresscompanyname = orderInfo.ExpressCompanyName; this._expresscompanyabb = orderInfo.ExpressCompanyAbb; this._paymenttypeid = orderInfo.PaymentTypeId; this._paymenttypename = orderInfo.PaymentTypeName; this._paymentgateway = orderInfo.PaymentGateway; this._paymentstatus = orderInfo.PaymentStatus; this._refundstatus = orderInfo.RefundStatus; this._paycurrencycode = orderInfo.PayCurrencyCode; this._paycurrencyname = orderInfo.PayCurrencyName; this._paymentfee = orderInfo.PaymentFee; this._paymentfeeadjusted = orderInfo.PaymentFeeAdjusted; this._gatewayorderid = orderInfo.GatewayOrderId; this._ordertotal = orderInfo.OrderTotal; this._orderpoint = orderInfo.OrderPoint; this._ordercostprice = orderInfo.OrderCostPrice; this._orderprofit = orderInfo.OrderProfit; this._orderothercost = orderInfo.OrderOtherCost; this._orderoptionprice = orderInfo.OrderOptionPrice; this._discountname = orderInfo.DiscountName; this._discountamount = orderInfo.DiscountAmount; this._discountadjusted = orderInfo.DiscountAdjusted; this._discountvalue = orderInfo.DiscountValue; this._discountvaluetype = orderInfo.DiscountValueType; this._couponcode = orderInfo.CouponCode; this._couponname = orderInfo.CouponName; this._couponamount = orderInfo.CouponAmount; this._couponvalue = orderInfo.CouponValue; this._couponvaluetype = orderInfo.CouponValueType; this._activityname = orderInfo.ActivityName; this._activityfreeamount = orderInfo.ActivityFreeAmount; this._activitystatus = orderInfo.ActivityStatus; this._groupbuyid = orderInfo.GroupBuyId; this._groupbuyprice = orderInfo.GroupBuyPrice; this._groupbuystatus = orderInfo.GroupBuyStatus; this._amount = orderInfo.Amount; this._ordertype = orderInfo.OrderType; this._orderstatus = orderInfo.OrderStatus; this._sellerid = orderInfo.SellerID; this._sellername = orderInfo.SellerName; this._selleremail = orderInfo.SellerEmail; this._sellercellphone = orderInfo.SellerCellPhone; this._commentstatus = orderInfo.CommentStatus; this._supplierid = orderInfo.SupplierId; this._suppliername = orderInfo.SupplierName; this._referid = orderInfo.ReferID; this._referurl = orderInfo.ReferURL; this._orderip = orderInfo.OrderIP; this._remark = orderInfo.Remark; this._producttotal = orderInfo.ProductTotal; this._haschildren = orderInfo.HasChildren; this._isreviews = orderInfo.IsReviews; }