Esempio n. 1
0
        public async Task <bool> writeOrder(string logisticPostalAddressID, string AXCustomerAccountNum, List <complexTypeProductLineItem> productLineItem, List <complexTypeShippingLineItem> listServiceLineitem,
                                            List <complexTypeAddress> listShippingAddress, List <complexTypeAddress> listBillingAddress, complexTypeOrder order, List <TenderLine> payments)
        {
            try
            {
                var sql    = _resourceLoader.GetContentResource(Query.WriteOrderSQL);
                var result = await WithConnection(async c => await c.QueryAsync(sql: sql,
                                                                                param: new
                {
                    logisticPostalAddressID,
                    AXCustomerAccountNum,
                    order.orderno,
                    order.customer.customeremail,
                    order.customer.customerno,
                    order.customer.customername,
                    order.currency,
                    order.orderdate,
                    Payments         = payments.AsTableValuedParameter(TableTypes.PaymentTvp, new[] { "amount", "CardType", "CardNumber", "currency", "authorizationId", "lineNum", "PaymentAuthorization", "lineConfirmationId" }),
                    ProductLineItems = productLineItem.AsTableValuedParameter(TableTypes.ProductLineTvp, new[] { "productid", "netprice", "tax", "grossprice", "AFMLineConfirmationID", "DLVMode", "Quantity", "Unit", "Linenum", "FulfillerName", "BestDate", "BeginDateRange", "EndDateRange", "AFMMessage", "AFMVendorID", "AFMKitItemID", "AFMKitSequenceNumber", "AFMKitItemQuantity" }),
                    ServiceLineItem  = listServiceLineitem.AsTableValuedParameter(TableTypes.ServiceLineItmesTvp, new[] { "itemid", "netprice", "tax", "grossprice", "AFMLineConfirmationID", "DLVMode", "Quantity", "Unit", "Linenum", "AFMVendorID" }),
                    ShippingAddress  = listShippingAddress.AsTableValuedParameter(TableTypes.ShippingAddressTvp, new[] { "firstname", "lastname", "address1", "city", "postalcode", "statecode", "countrycode", "phone" }),
                    BillingAddress   = listBillingAddress.AsTableValuedParameter(TableTypes.BillingAddressTvp, new[] { "firstname", "lastname", "address1", "city", "postalcode", "statecode", "countrycode", "phone" }),
                    Res = "true"
                },     // result value on success of insert
                                                                                commandType: CommandType.Text));

                return(true);
            }
            catch (Exception exe)
            {
                /// [TODO] this acknowledgement will be implemented with post implementation of Listner module from different console Application.
                return(false);
            }
        }