Example #1
0
        private bool Authorized(getOrderStatusDetailsRequest1 request, ref string errorMessage)
        {
            using (var context = new Landau_PromoStandardsEntities())
            {
                var authQuery = context.Authentications.Where(x => x.UserId == request.GetOrderStatusDetailsRequest.id).FirstOrDefault();

                if (!string.IsNullOrEmpty(authQuery.UserId))
                {
                    if (authQuery.Password.Equals(request.GetOrderStatusDetailsRequest.password))
                    {
                        return(true);
                    }
                    else
                    {
                        errorMessage += "105: Authentication Credentials failed";
                        return(false);
                    }
                }
                else
                {
                    errorMessage += "100: ID (customerID) not found";
                    return(false);
                }
            }
        }
Example #2
0
        private bool Valid(getOrderStatusDetailsRequest1 request, ref string errorMessage)
        {
            bool isValidRequest = true;

            if (request.GetOrderStatusDetailsRequest is null)
            {
                isValidRequest = false;
                errorMessage  += "999: General Error – Contact the System Service Provider";
            }
            else
            {
                if (request.GetOrderStatusDetailsRequest.wsVersion != "1.0.0")
                {
                    isValidRequest = false;
                    errorMessage  += "115: wsVersion not found";
                }
                if (string.IsNullOrEmpty(request.GetOrderStatusDetailsRequest.id))
                {
                    isValidRequest = false;
                    errorMessage  += "110: Authentication Credentials required";
                }
                if (string.IsNullOrEmpty(request.GetOrderStatusDetailsRequest.password))
                {
                    isValidRequest = false;
                    errorMessage  += "110: Authentication Credentials required";
                }
            }

            return(isValidRequest);
        }
Example #3
0
    public GetOrderStatusDetailsResponse getOrderStatusDetails(GetOrderStatusDetailsRequest GetOrderStatusDetailsRequest)
    {
        getOrderStatusDetailsRequest1 inValue = new getOrderStatusDetailsRequest1();

        inValue.GetOrderStatusDetailsRequest = GetOrderStatusDetailsRequest;
        getOrderStatusDetailsResponse1 retVal = ((OrderStatusService)(this)).getOrderStatusDetails(inValue);

        return(retVal.GetOrderStatusDetailsResponse);
    }
Example #4
0
 getOrderStatusDetailsResponse1 OrderStatusService.getOrderStatusDetails(getOrderStatusDetailsRequest1 request)
 {
     return(base.Channel.getOrderStatusDetails(request));
 }
Example #5
0
        public getOrderStatusDetailsResponse1 getOrderStatusDetails(getOrderStatusDetailsRequest1 request)
        {
            string errorMessage = string.Empty;
            var    response     = new getOrderStatusDetailsResponse1();

            if (Valid(request, ref errorMessage))
            {
                if (Authorized(request, ref errorMessage))
                {
                    List <GetOrderStatusDetailsResponseOrderStatus> listOrderStatus = new List <GetOrderStatusDetailsResponseOrderStatus>();


                    switch (request.GetOrderStatusDetailsRequest.queryType)
                    {
                    case 1:
                        //PO Search
                        using (var context = new LAN_AX2012_PRODEntities1())
                        {
                            var orders = context.LAN_SP_B2B_SUBMITTEDORDERBYPONUMBER(request.GetOrderStatusDetailsRequest.referenceNumber).ToList();

                            foreach (var order in orders)
                            {
                                var details = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail()
                                {
                                    factoryOrderNumber        = order.OrderNumber,
                                    expectedShipDate          = order.RequestedShipDate,
                                    expectedShipDateSpecified = true,
                                    validTimestamp            = DateTime.UtcNow
                                };

                                switch (order.SALESSTATUS)
                                {
                                case 0:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.None;
                                    details.statusName = "None";
                                    break;

                                case 1:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.OpenOrder;
                                    details.statusName = "Open Order";
                                    break;

                                case 2:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Delivered;
                                    details.statusName = "Delivered";
                                    break;

                                case 3:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Invoiced;
                                    details.statusName = "Invoiced";
                                    break;

                                case 4:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Canceled;
                                    details.statusName = "Canceled";
                                    break;

                                default:
                                    break;
                                }

                                GetOrderStatusDetailsResponseOrderStatus ordersdetails = new GetOrderStatusDetailsResponseOrderStatus()
                                {
                                    purchaseOrderNumber    = order.PONumber,
                                    OrderStatusDetailArray = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail[] { details }
                                };

                                listOrderStatus.Add(ordersdetails);
                            }

                            response.GetOrderStatusDetailsResponse = new GetOrderStatusDetailsResponse();
                            response.GetOrderStatusDetailsResponse.OrderStatusArray = listOrderStatus.ToArray();
                        }
                        break;

                    case 2:
                        //SO Search
                        using (var context = new LAN_AX2012_PRODEntities1())
                        {
                            var orders = context.LAN_SP_B2B_SUBMITTEDORDERBYORDERIDWITHSTATUS(request.GetOrderStatusDetailsRequest.referenceNumber).ToList();

                            foreach (var order in orders)
                            {
                                var details = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail()
                                {
                                    factoryOrderNumber        = order.OrderNumber,
                                    expectedShipDate          = order.RequestedShipDate,
                                    expectedShipDateSpecified = true,
                                    validTimestamp            = DateTime.UtcNow
                                };

                                switch (order.SALESSTATUS)
                                {
                                case 0:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.None;
                                    details.statusName = "None";
                                    break;

                                case 1:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.OpenOrder;
                                    details.statusName = "Open Order";
                                    break;

                                case 2:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Delivered;
                                    details.statusName = "Delivered";
                                    break;

                                case 3:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Invoiced;
                                    details.statusName = "Invoiced";
                                    break;

                                case 4:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Canceled;
                                    details.statusName = "Canceled";
                                    break;

                                default:
                                    break;
                                }

                                GetOrderStatusDetailsResponseOrderStatus ordersdetails = new GetOrderStatusDetailsResponseOrderStatus()
                                {
                                    purchaseOrderNumber    = order.PONumber,
                                    OrderStatusDetailArray = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail[] { details }
                                };

                                listOrderStatus.Add(ordersdetails);
                            }

                            response.GetOrderStatusDetailsResponse = new GetOrderStatusDetailsResponse();
                            response.GetOrderStatusDetailsResponse.OrderStatusArray = listOrderStatus.ToArray();
                        }
                        break;

                    case 3:
                        //Last Update Search
                        using (var context = new LAN_AX2012_PRODEntities1())
                        {
                            var orders = context.LAN_SP_B2B_SUBMITTEDORDERSBYACCOUNTWITHSTATUS(request.GetOrderStatusDetailsRequest.id)
                                         .Where(x => x.MODIFIEDDATETIME.ToUniversalTime() > request.GetOrderStatusDetailsRequest.statusTimeStamp).ToList();

                            foreach (var order in orders)
                            {
                                var details = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail()
                                {
                                    factoryOrderNumber        = order.OrderNumber,
                                    expectedShipDate          = order.RequestedShipDate,
                                    expectedShipDateSpecified = true,
                                    validTimestamp            = DateTime.UtcNow
                                };

                                switch (order.SALESSTATUS)
                                {
                                case 0:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.None;
                                    details.statusName = "None";
                                    break;

                                case 1:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.OpenOrder;
                                    details.statusName = "Open Order";
                                    break;

                                case 2:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Delivered;
                                    details.statusName = "Delivered";
                                    break;

                                case 3:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Invoiced;
                                    details.statusName = "Invoiced";
                                    break;

                                case 4:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Canceled;
                                    details.statusName = "Canceled";
                                    break;

                                default:
                                    break;
                                }

                                GetOrderStatusDetailsResponseOrderStatus ordersdetails = new GetOrderStatusDetailsResponseOrderStatus()
                                {
                                    purchaseOrderNumber    = order.PONumber,
                                    OrderStatusDetailArray = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail[] { details }
                                };

                                listOrderStatus.Add(ordersdetails);
                            }

                            response.GetOrderStatusDetailsResponse = new GetOrderStatusDetailsResponse();
                            response.GetOrderStatusDetailsResponse.OrderStatusArray = listOrderStatus.ToArray();
                        }
                        break;

                    case 4:
                        //All Open Search
                        using (var context = new LAN_AX2012_PRODEntities1())
                        {
                            var orders = context.LAN_SP_B2B_SUBMITTEDORDERSBYACCOUNTWITHSTATUS(request.GetOrderStatusDetailsRequest.id)
                                         .Where(x => x.SALESSTATUS == 1).ToList();

                            foreach (var order in orders)
                            {
                                var details = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail()
                                {
                                    factoryOrderNumber        = order.OrderNumber,
                                    expectedShipDate          = order.RequestedShipDate,
                                    expectedShipDateSpecified = true,
                                    validTimestamp            = DateTime.UtcNow
                                };

                                switch (order.SALESSTATUS)
                                {
                                case 0:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.None;
                                    details.statusName = "None";
                                    break;

                                case 1:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.OpenOrder;
                                    details.statusName = "Open Order";
                                    break;

                                case 2:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Delivered;
                                    details.statusName = "Delivered";
                                    break;

                                case 3:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Invoiced;
                                    details.statusName = "Invoiced";
                                    break;

                                case 4:
                                    details.statusID   = GetOrderStatusDetailsResponseOrderStatusOrderStatusDetailStatusID.Canceled;
                                    details.statusName = "Canceled";
                                    break;

                                default:
                                    break;
                                }

                                GetOrderStatusDetailsResponseOrderStatus ordersdetails = new GetOrderStatusDetailsResponseOrderStatus()
                                {
                                    purchaseOrderNumber    = order.PONumber,
                                    OrderStatusDetailArray = new GetOrderStatusDetailsResponseOrderStatusOrderStatusDetail[] { details }
                                };

                                listOrderStatus.Add(ordersdetails);
                            }

                            response.GetOrderStatusDetailsResponse = new GetOrderStatusDetailsResponse();
                            response.GetOrderStatusDetailsResponse.OrderStatusArray = listOrderStatus.ToArray();
                        }
                        break;

                    default:
                        errorMessage += "Unknown Query Type.";
                        response.GetOrderStatusDetailsResponse.errorMessage = errorMessage;
                        break;
                    }
                }
            }
            else
            {
                response.GetOrderStatusDetailsResponse = new GetOrderStatusDetailsResponse();
                response.GetOrderStatusDetailsResponse.errorMessage = errorMessage;
            }

            return(response);
        }