public orderSearchResult getOpenOrders(ISyncWSParameter dataParam,
                                               System.Nullable <orderType> ot,
                                               string clientId,
                                               string orderNo,
                                               string yourCono,
                                               System.Nullable <System.DateTime> from,
                                               System.Nullable <System.DateTime> to,
                                               string mark,
                                               string ordersFromHistory,
                                               string ordersFromProduction)
        {
            IDataReader       reader = null;
            int               totalRows;
            orderSearchResult res = new orderSearchResult();

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

            case orderType.CO3PL:
                Getco(
                    clientId,
                    orderNo,
                    yourCono,
                    from,
                    to,
                    mark,
                    ordersFromHistory,
                    ordersFromProduction,
                    out reader);
                break;

            case orderType.PO:
                Getpo(
                    clientId,
                    orderNo,
                    from,
                    to,
                    ordersFromHistory,
                    ordersFromProduction,
                    out reader);
                break;

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

            ArrayList list = ReaderHelper.Read(
                reader,
                new order(),
                dataParam.GetSkipNoFirstRows(),
                dataParam.GetMaxRows(),
                out totalRows);

            res.list = list.ToArray(typeof(order)) as order[];
            res.SetTotalRows(totalRows);

            return(res);
        }
        public order saveOrder(orderSaveParameters orderSaveParameters)
        {
            Order           p = new Order();
            orderSaveResult orderSaveResult = (orderSaveResult)PackageHelper.GetResult(orderSaveParameters, p.saveOrder, p.find);

            switch (orderSaveParameters.order.orderType)
            {
            case orderType.CO:
                throw new Exception("Order type CO not supported");

            case orderType.CO3PL:
                orderSaveResult orderSignalResult = (orderSaveResult)PackageHelper.GetResult(orderSaveParameters, p.SignalProcess, p.find);
                break;

            case orderType.PO:
                break;

            default:
                throw new Exception("Unknown order type");
            }

            // reload it
            orderSearchParameters orderSearchParameters = new orderSearchParameters();

            orderSearchParameters.clientId      = orderSaveParameters.clientId;
            orderSearchParameters.returnDetails = true;
            orderSearchParameters.orderType     = orderSaveParameters.order.orderType;

            switch (orderSaveParameters.order.orderType)
            {
            case orderType.CO:
                throw new Exception("Order type CO not supported");

            case orderType.CO3PL:
                orderSearchParameters.orderNo = orderSaveParameters.order.coNo;
                break;

            case orderType.PO:
                orderSearchParameters.orderNo = orderSaveParameters.order.poid;
                break;

            default:
                throw new Exception("Unknown order type");
            }

            orderSearchResult orderSearchResult = (orderSearchResult)PackageHelper.GetResult(orderSearchParameters, p.getOrderDetails, p.find);

            if (orderSearchResult.list.GetLength(0) != 1)
            {
                return(null);
            }
            else
            {
                return(orderSearchResult.list[0]);
            }
        }
        public order getOrderDetails(orderSearchParameters orderSearchParameters)
        {
            Order             p = new Order();
            orderSearchResult orderSearchResult = (orderSearchResult)PackageHelper.GetResult(orderSearchParameters, p.getOrderDetails, p.find);

            if (orderSearchResult.list.GetLength(0) != 1)
            {
                return(null);
            }
            else
            {
                return(orderSearchResult.list[0]);
            }
        }
示例#4
0
        public ISyncWSResult getOrderDetails(Database database, ISyncWSParameter dataParameter)
        {
            orderSearchParameters orderSearchParameters = (orderSearchParameters)dataParameter;

            WebServices3pl pkg = new WebServices3pl(database);

            orderSearchResult res = pkg.getOrderDetails(dataParameter,
                                                        orderSearchParameters.orderType,
                                                        orderSearchParameters.clientId,
                                                        orderSearchParameters.orderNo,
                                                        boolToYesNo(orderSearchParameters.ordersFromHistory),
                                                        boolToYesNo(orderSearchParameters.ordersFromProduction));

            Details(dataParameter, orderSearchParameters, res, pkg);

            return((searchResult)res);
        }
示例#5
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));
                }
            }
        }