示例#1
0
        public getFilterValuesResponse getFilterValues(getFilterValuesRequest1 request)
        {
            string errorMessage = string.Empty;
            var    response     = new getFilterValuesResponse();

            if (Valid(request, ref errorMessage))
            {
                if (Authenticated(request, ref errorMessage))
                {
                    List <string> sizes      = new List <string>();
                    List <string> colors     = new List <string>();
                    List <string> selections = new List <string>();

                    using (var context = new LAN_AX2012_PRODEntities())
                    {
                        var products = context.LAN_VW_GETAVAILABLETOSHIP
                                       .Where(x => x.ITEMID == request.GetFilterValuesRequest.productID);

                        if (products.Count() == 0)
                        {
                            errorMessage += "200: ProductID not found";

                            response = new getFilterValuesResponse();
                            response.GetFilterValuesReply = new GetFilterValuesReply();
                            response.GetFilterValuesReply.errorMessage = errorMessage;

                            return(response);
                        }

                        colors = products.GroupBy(x => x.INVENTCOLORID).Select(y => y.Key).ToList();
                        sizes  = products.GroupBy(x => x.INVENTSIZEID).Select(y => y.Key).ToList();
                    }



                    response.GetFilterValuesReply                      = new GetFilterValuesReply();
                    response.GetFilterValuesReply.productID            = request.GetFilterValuesRequest.productID;
                    response.GetFilterValuesReply.FilterSizeArray      = sizes.ToArray();
                    response.GetFilterValuesReply.FilterColorArray     = colors.ToArray();
                    response.GetFilterValuesReply.FilterSelectionArray = selections.ToArray();
                }
                else
                {
                    response = new getFilterValuesResponse();
                    response.GetFilterValuesReply = new GetFilterValuesReply();
                    response.GetFilterValuesReply.errorMessage = errorMessage;
                }
            }
            else
            {
                response = new getFilterValuesResponse();
                response.GetFilterValuesReply = new GetFilterValuesReply();
                response.GetFilterValuesReply.errorMessage = errorMessage;
            }



            return(response);
        }
    public GetFilterValuesReply getFilterValues(GetFilterValuesRequest GetFilterValuesRequest)
    {
        getFilterValuesRequest1 inValue = new getFilterValuesRequest1();

        inValue.GetFilterValuesRequest = GetFilterValuesRequest;
        getFilterValuesResponse retVal = ((InventoryService)(this)).getFilterValues(inValue);

        return(retVal.GetFilterValuesReply);
    }