Beispiel #1
0
        public int SaveOrder(BizOrder bizOrder)
        {
            Func <SqlConnection, int> action = (connection) => DalProductInfomation.SaveOrder(connection, bizOrder);

            return(dbManager.Execute(action));
        }
Beispiel #2
0
        public static int SaveOrder(SqlConnection connection, BizOrder bizOrder)
        {
            var sqlParamters = new[]
            {
                new SqlParameter("@UserId", bizOrder.UserId),
                new SqlParameter("@UserName", bizOrder.UserName ?? string.Empty),
                new SqlParameter("@UserTel", bizOrder.UserTel ?? string.Empty),
                new SqlParameter("@Status", bizOrder.Status ?? string.Empty),
                new SqlParameter("@OrderDatetime", bizOrder.OrderDatetime),
                new SqlParameter("@Owner", bizOrder.Owner ?? string.Empty),
                new SqlParameter("@Submitor", bizOrder.Submitor ?? string.Empty),
                new SqlParameter("@PurchaseStatus", bizOrder.PurchaseStatus),
                new SqlParameter("@PayStatus", bizOrder.PayStatus ?? string.Empty),
                new SqlParameter("@DeliveryStatus", bizOrder.DeliveryStatus ?? string.Empty),
                new SqlParameter("@OrderType", bizOrder.OrderType ?? string.Empty),
                new SqlParameter("@OrderChannel", bizOrder.OrderChannel ?? string.Empty),
                new SqlParameter("@CarID", Guid.Parse(bizOrder.CarID ?? Guid.NewGuid().ToString())),
                new SqlParameter("@CarPlate", bizOrder.CarPlate ?? string.Empty),
                new SqlParameter("@Refno", bizOrder.Refno ?? string.Empty),
                new SqlParameter("@DeliveryType", bizOrder.DeliveryType ?? string.Empty),
                new SqlParameter("@PayMothed", bizOrder.PayMothed ?? string.Empty),
                new SqlParameter("@InvoiceType", bizOrder.InvoiceType ?? string.Empty),
                new SqlParameter("@InvoiceTitle", bizOrder.InvoiceTitle ?? string.Empty),
                new SqlParameter("@InvTaxNum", bizOrder.InvTaxNum),
                new SqlParameter("@InvBank", bizOrder.InvBank ?? string.Empty),
                new SqlParameter("@InvBankAccount", bizOrder.InvBankAccount ?? string.Empty),
                new SqlParameter("@InvAmont", bizOrder.InvAmont),
                new SqlParameter("@InvAddress", bizOrder.InvAddress ?? string.Empty),
                new SqlParameter("@ShippingMoney", bizOrder.ShippingMoney),
                new SqlParameter("@InstallMoney", bizOrder.InstallMoney),
                new SqlParameter("@InvoiceAddTax", bizOrder.InvoiceAddTax),
                new SqlParameter("@InstallType", bizOrder.InstallType ?? string.Empty),
                new SqlParameter("@InstallShopName", bizOrder.InstallShopName ?? string.Empty),
                new SqlParameter("@InstallShopID", bizOrder.InstallShopID),
                new SqlParameter("@BookDatetime", bizOrder.BookDatetime),
                new SqlParameter("@BookPeriod", bizOrder.BookPeriod ?? string.Empty),
                new SqlParameter("@RegionId", bizOrder.RegionId ?? 0),
                new SqlParameter("@WareHouseId", bizOrder.WareHouseId),
                new SqlParameter("@WareHouseName", bizOrder.WareHouseName ?? string.Empty),
                new SqlParameter("@DeliveryCompany", bizOrder.DeliveryCompany ?? string.Empty),
                new SqlParameter("@DeliveryAddressID",
                                 Guid.Parse(bizOrder.DeliveryAddressID ?? Guid.NewGuid().ToString())),
                new SqlParameter("@Remark", bizOrder.Remark == null ? "" : bizOrder.Remark)
            };

            return(int.Parse(SqlHelper.ExecuteScalar(connection, CommandType.Text, @"insert into 
tbl_Order(UserID,UserName,UserTel,Status,OrderDatetime,Owner,Submitor,PurchaseStatus,PayStatus,DeliveryStatus,OrderType,OrderChannel,
CarID,CarPlate,Refno,DeliveryType,PayMothed,InvoiceType,InvoiceTitle,InvTaxNum,InvBank,InvBankAccount
,InvAmont,InvAddress,ShippingMoney,InstallMoney,InvoiceAddTax,InstallType,InstallShop,InstallShopID,BookDatetime,BookPeriod

,RegionId,WareHouseId,WareHouseName,DeliveryCompany," + (bizOrder.DeliveryAddressID == null ? "" : "DeliveryAddressID,") +
                                                     @"Remark) 
VALUES(@UserID,@UserName,@UserTel,@Status,@OrderDatetime,@Owner,@Submitor,@PurchaseStatus,@PayStatus,@DeliveryStatus,@OrderType,@OrderChannel
,@CarID,@CarPlate,@Refno,@DeliveryType,@PayMothed,@InvoiceType,@InvoiceTitle,@InvTaxNum,@InvBank,@InvBankAccount
,@InvAmont,@InvAddress,@ShippingMoney,@InstallMoney,@InvoiceAddTax,@InstallType,@InstallShopName,@InstallShopID,@BookDatetime,@BookPeriod

,@RegionId,@WareHouseId,@WareHouseName,@DeliveryCompany," +
                                                     (bizOrder.DeliveryAddressID == null
                                                                                       ? ""
                                                                                       : "@DeliveryAddressID,") +
                                                     @"@Remark)
SELECT @@IDENTITY", sqlParamters).ToString()));
        }
Beispiel #3
0
 public int SaveOrder(BizOrder bizOrder)
 {
     return(handler.SaveOrder(bizOrder));
 }