Hidistro.SqlDal/Orders/LineItemDao.cs

(开头部分) 12KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hidistro.SqlDal.Orders
{
    using Hidistro.Core;
    using Hidistro.Entities;
    using Hidistro.Entities.Orders;
    using Microsoft.Practices.EnterpriseLibrary.Data;
    using System;
    using System.Collections;
    using System.Data;
    using System.Data.Common;
    using System.Runtime.InteropServices;
    using System.Text;

    public class LineItemDao
    {
        private Database database = DatabaseFactory.CreateDatabase();

        public bool AddOrderLineItems(string orderId, ICollection lineItems, DbTransaction dbTran)
        {
            if ((lineItems == null) || (lineItems.Count == 0))
            {
                return false;
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" ");
            this.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, orderId);
            int num = 0;
            StringBuilder builder = new StringBuilder();
            foreach (LineItemInfo info in lineItems)
            {
                string str = num.ToString();
                builder.Append("INSERT INTO Hishop_OrderItems(OrderId, SkuId, ProductId, SKU, Quantity, ShipmentQuantity, CostPrice").Append(",ItemListPrice, ItemAdjustedPrice, ItemDescription, ThumbnailsUrl, Weight, SKUContent, PromotionId, PromotionName,OrderItemsStatus,ItemsCommission,SecondItemsCommission,ThirdItemsCommission,PointNumber,Type,DiscountAverage) VALUES(@OrderId").Append(",@SkuId").Append(str).Append(",@ProductId").Append(str).Append(",@SKU").Append(str).Append(",@Quantity").Append(str).Append(",@ShipmentQuantity").Append(str).Append(",@CostPrice").Append(str).Append(",@ItemListPrice").Append(str).Append(",@ItemAdjustedPrice").Append(str).Append(",@ItemDescription").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Weight").Append(str).Append(",@SKUContent").Append(str).Append(",@PromotionId").Append(str).Append(",@PromotionName").Append(str).Append(",@OrderItemsStatus").Append(str).Append(",@ItemsCommission").Append(str).Append(",@SecondItemsCommission").Append(str).Append(",@ThirdItemsCommission").Append(str).Append(",@PointNumber").Append(str).Append(",@Type").Append(str).Append(",@DiscountAverage").Append(str).Append(");");
                this.database.AddInParameter(sqlStringCommand, "SkuId" + str, DbType.String, info.SkuId);
                this.database.AddInParameter(sqlStringCommand, "ProductId" + str, DbType.Int32, info.ProductId);
                this.database.AddInParameter(sqlStringCommand, "SKU" + str, DbType.String, info.SKU);
                this.database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info.Quantity);
                this.database.AddInParameter(sqlStringCommand, "ShipmentQuantity" + str, DbType.Int32, info.ShipmentQuantity);
                this.database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info.ItemCostPrice);
                this.database.AddInParameter(sqlStringCommand, "ItemListPrice" + str, DbType.Currency, info.ItemListPrice);
                this.database.AddInParameter(sqlStringCommand, "ItemAdjustedPrice" + str, DbType.Currency, info.ItemAdjustedPrice);
                this.database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info.ItemDescription);
                this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info.ThumbnailsUrl);
                this.database.AddInParameter(sqlStringCommand, "Weight" + str, DbType.Int32, info.ItemWeight);
                this.database.AddInParameter(sqlStringCommand, "SKUContent" + str, DbType.String, info.SKUContent);
                this.database.AddInParameter(sqlStringCommand, "PromotionId" + str, DbType.Int32, info.PromotionId);
                this.database.AddInParameter(sqlStringCommand, "PromotionName" + str, DbType.String, info.PromotionName);
                this.database.AddInParameter(sqlStringCommand, "OrderItemsStatus" + str, DbType.Int32, (int) info.OrderItemsStatus);
                this.database.AddInParameter(sqlStringCommand, "ItemsCommission" + str, DbType.Decimal, info.ItemsCommission);
                this.database.AddInParameter(sqlStringCommand, "SecondItemsCommission" + str, DbType.Decimal, info.SecondItemsCommission);
                this.database.AddInParameter(sqlStringCommand, "ThirdItemsCommission" + str, DbType.Decimal, info.ThirdItemsCommission);
                this.database.AddInParameter(sqlStringCommand, "PointNumber" + str, DbType.Int32, info.PointNumber);
                this.database.AddInParameter(sqlStringCommand, "Type" + str, DbType.Int32, info.Type);
                this.database.AddInParameter(sqlStringCommand, "DiscountAverage" + str, DbType.Decimal, info.DiscountAverage);
                num++;
                if (num == 50)
                {
                    int num2;
                    sqlStringCommand.CommandText = builder.ToString();
                    if (dbTran != null)
                    {
                        num2 = this.database.ExecuteNonQuery(sqlStringCommand, dbTran);
后面还有 126 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。