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 override bool UpdateOrderAmount(OrderInfo order, DbTransaction dbTran) { DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE Hishop_Orders SET OrderTotal = @OrderTotal, OrderProfit=@OrderProfit, AdjustedFreight = @AdjustedFreight, AdjustedPayCharge = @AdjustedPayCharge, AdjustedDiscount=@AdjustedDiscount, OrderPoint=@OrderPoint, Amount=@Amount,OrderCostPrice=@OrderCostPrice WHERE OrderId = @OrderId"); database.AddInParameter(sqlStringCommand, "OrderTotal", DbType.Currency, order.GetTotal()); database.AddInParameter(sqlStringCommand, "AdjustedFreight", DbType.Currency, order.AdjustedFreight); database.AddInParameter(sqlStringCommand, "AdjustedPayCharge", DbType.Currency, order.AdjustedPayCharge); database.AddInParameter(sqlStringCommand, "OrderCostPrice", DbType.Currency, order.GetCostPrice()); database.AddInParameter(sqlStringCommand, "AdjustedDiscount", DbType.Currency, order.AdjustedDiscount); database.AddInParameter(sqlStringCommand, "OrderPoint", DbType.Int32, order.GetTotalPoints()); database.AddInParameter(sqlStringCommand, "OrderProfit", DbType.Currency, order.GetProfit()); database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, order.OrderId); database.AddInParameter(sqlStringCommand, "Amount", DbType.Currency, order.GetAmount()); if (dbTran != null) { return (database.ExecuteNonQuery(sqlStringCommand, dbTran) == 1); } return (database.ExecuteNonQuery(sqlStringCommand) == 1); }