Exemplo n.º 1
0
        private void Details(product[] list, WebServices3pl pkg, ISyncWSParameter dataParameter, productSearchParameters productSearchParameters)
        {
            if (dataParameter.GetReturnDetails())
            {
                foreach (product item in list)
                {
                    productSearchParameters subParams = new productSearchParameters();
                    subParams.firstResult = null;
                    subParams.maxResult   = null;

                    item.barcodes = pkg.Findbarcodebyproduct(subParams, productSearchParameters.clientId, item.partNo);

                    vendorPartNos[] vendorPartNo = pkg.Getvendorpartno(subParams, productSearchParameters.clientId, item.partNo);

                    // build vendor part no string
                    item.vendPartNo = "";

                    foreach (vendorPartNos vpn in vendorPartNo)
                    {
                        if (!String.IsNullOrEmpty(vpn.vendorPartNo))
                        {
                            if (item.vendPartNo != "")
                            {
                                item.vendPartNo += ", ";
                            }

                            item.vendPartNo += vpn.vendorPartNo;
                        }
                    }

                    if (String.IsNullOrEmpty(item.vendPartNo))
                    {
                        item.vendPartNo = null;
                    }

                    // build product availability
                    if (!String.IsNullOrEmpty(productSearchParameters.stockNo))
                    {
                        productAvails[] productAvail = pkg.Getproductavail(subParams, productSearchParameters.clientId, productSearchParameters.stockNo, item.partNo);
                        int             qty          = 0;
                        foreach (productAvails pa in productAvail)
                        {
                            if (pa.productAvail != null)
                            {
                                qty += (int)pa.productAvail;
                            }
                        }
                        item.availability = qty;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public ISyncWSResult findCustomerById(Database database, ISyncWSParameter dataParameter)
        {
            customerSearchParameters customerSearchParameters = (customerSearchParameters)dataParameter;

            WebServices3pl pkg = new WebServices3pl(database);

            customerSearchResult res = pkg.findCustomerById(dataParameter, customerSearchParameters.clientId, customerSearchParameters.customerId);

            if (dataParameter.GetReturnDetails())
            {
                foreach (customer item in res.list)
                {
                    customerSearchParameters subParams = new customerSearchParameters();
                    subParams.firstResult = null;
                    subParams.maxResult   = null;

                    addressSearchResult addressResult;

                    if (customerSearchParameters.customerId != null)
                    {
                        addressResult = pkg.getAddresses(subParams, customerSearchParameters.clientId, item.id);
                    }
                    else
                    {
                        addressResult = pkg.getAddresses(subParams, customerSearchParameters.clientId, null);
                    }

                    int i = 0;
                    foreach (address address in addressResult.list)
                    {
                        item.shippingAddress            = new shippingAddress();
                        item.shippingAddress.shipCustNo = item.id;
                        item.shippingAddress.shiptoNo   = Convert.ToString(i);
                        item.shippingAddress.address    = address;
                    }
                }
            }

            return((searchResult)res);
        }
Exemplo n.º 3
0
        public ISyncWSResult findPartyById(Database database, ISyncWSParameter dataParameter)
        {
            partySearchParameters partySearchParameters = (partySearchParameters)dataParameter;

            WebServices3pl pkg = new WebServices3pl(database);

            partySearchResult res = pkg.findPartyById(
                dataParameter,
                partySearchParameters.clientId,
                partySearchParameters.partyId,
                partySearchParameters.partyType);

            if (dataParameter.GetReturnDetails())
            {
                foreach (customer item in res.list)
                {
                    partySearchParameters subParams = new partySearchParameters();
                    subParams.firstResult = null;
                    subParams.maxResult   = null;

                    addressSearchResult addressResult;

                    addressResult = pkg.getPartyAddress(subParams, partySearchParameters.clientId, item.id, partySearchParameters.partyType);

                    int i = 0;
                    foreach (address address in addressResult.list)
                    {
                        item.shippingAddress            = new shippingAddress();
                        item.shippingAddress.shipCustNo = item.id;
                        item.shippingAddress.shiptoNo   = Convert.ToString(i);
                        item.shippingAddress.address    = address;
                    }
                }
            }

            return((searchResult)res);
        }
Exemplo n.º 4
0
        private void Details(ISyncWSParameter dataParameter, orderSearchParameters orderSearchParameters, orderSearchResult res, WebServices3pl pkg)
        {
            if (dataParameter.GetReturnDetails())
            {
                foreach (order item in res.list)
                {
                    orderSearchParameters subParams = new orderSearchParameters();
                    subParams.firstResult = null;
                    subParams.maxResult   = null;

                    switch (orderSearchParameters.orderType)
                    {
                    case orderType.CO:
                        throw new Exception("ordertype CO not supported");

                    case orderType.CO3PL:

                        if (!String.IsNullOrEmpty(item.customer))
                        {
                            address[] address = pkg.getAddresses(
                                subParams,
                                orderSearchParameters.clientId,
                                item.customer);

                            if (address.GetLength(0) == 1)
                            {
                                item.shippingAddress            = new shippingAddress();
                                item.shippingAddress.shipCustNo = item.customer;
                                item.shippingAddress.shiptoNo   = "0";
                                item.shippingAddress.address    = address[0];
                            }
                        }

                        break;

                    case orderType.PO:
                    {
                        address[] address = pkg.Getpartyaddress(
                            subParams,
                            item.shipFromPartyid,
                            item.shipFromPartyQualifier,
                            orderSearchParameters.clientId);

                        if (address.GetLength(0) == 1)
                        {
                            item.orderShipFrom = new orderShipFrom();
                            item.orderShipFrom.shipFromPartyid                 = item.shipFromPartyid;
                            item.orderShipFrom.shipFromPartyQualifier          = ConvertPartyType(item.shipFromPartyQualifier);
                            item.orderShipFrom.shipFromPartyQualifierSpecified = true;
                            item.orderShipFrom.address = address[0];
                        }
                    }
                    break;

                    default:
                        throw new Exception("unknown ordertype");
                    }

                    item.orderLines = pkg.GetOrderLines(subParams,
                                                        orderSearchParameters.orderType,
                                                        orderSearchParameters.clientId,
                                                        item.coNo,
                                                        item.poid,
                                                        item.poSeq,
                                                        boolToYesNo(orderSearchParameters.ordersFromHistory),
                                                        boolToYesNo(orderSearchParameters.ordersFromProduction));
                }
            }
        }