예제 #1
0
        public JsonResult GetProductRangeList(string QRFId, string ProductId, string CategoryId, string AdditionalYN)
        {
            SalesQuoteLibrary  quoteLibrary    = new SalesQuoteLibrary(_configuration);
            ProductRangeGetRes prodRangeGetRes = quoteLibrary.GetProductRangeList(ProductId, CategoryId, AdditionalYN, token, string.IsNullOrEmpty(QRFId) ? "" : QRFId);

            List <AutoCompleteTextBox> prodRangeList    = new List <AutoCompleteTextBox>();
            List <AutoCompleteTextBox> defProdRangeList = new List <AutoCompleteTextBox>();

            if (prodRangeGetRes.ResponseStatus.Status.ToLower() == "success" && prodRangeGetRes.ProductRangeDetails.Count > 0)
            {
                prodRangeList = prodRangeGetRes.ProductRangeDetails.Select(a => new AutoCompleteTextBox {
                    value = a.VoyagerProductRange_Id, label = a.ProductRangeCode + " (" + a.PersonType + (a.AgeRange == null ? "" : " | " + a.AgeRange) + ")", type = a.AdditionalYN.ToString()
                }).OrderBy(a => a.type).ThenBy(a => a.label).ToList();
                if (prodRangeGetRes.DefProdRangelist != null && prodRangeGetRes.DefProdRangelist.Count > 0)
                {
                    defProdRangeList = prodRangeGetRes.DefProdRangelist.Select(a => new AutoCompleteTextBox {
                        value = a.VoyagerProductRange_Id, label = a.ProductRangeCode + " (" + a.PersonType + (a.AgeRange == null ? "" : " | " + a.AgeRange) + ")", type = a.AdditionalYN.ToString()
                    }).OrderBy(a => a.type).ThenBy(a => a.label).ToList();
                }
                return(Json(new { prodRangeGetRes.SupplierId, prodRangeGetRes.SupplierName, prodRangeList, defProdRangeList }));
            }
            else
            {
                return(Json(""));
            }
        }
예제 #2
0
        public JsonResult GetProductRange(string ProductId, string CategoryId, string AdditionalYN, string positionname = "")
        {
            SalesQuoteLibrary  quoteLibrary    = new SalesQuoteLibrary(_configuration);
            ProductRangeGetRes prodRangeGetRes = quoteLibrary.GetProductRangeList(ProductId, CategoryId, AdditionalYN, token);

            List <AutoCompleteTextBox> prodRangeList = new List <AutoCompleteTextBox>();

            if (prodRangeGetRes.ResponseStatus.Status.ToLower() == "success" && prodRangeGetRes.ProductRangeDetails.Count > 0)
            {
                if (positionname == "cruise")
                {
                    var roomsuppliment = new List <AutoCompleteTextBox>();
                    var roomservice    = new List <AutoCompleteTextBox>();

                    roomservice = prodRangeGetRes.ProductRangeDetails.Where(a => a.AdditionalYN == false).ToList().
                                  Select(a => new AutoCompleteTextBox {
                        value = a.VoyagerProductRange_Id, label = a.ProductRangeCode + " (" + a.PersonType + (a.AgeRange == null ? "" : " | " + a.AgeRange) + ") ", type = a.AdditionalYN.ToString()
                    }).
                                  OrderBy(a => a.label.Contains("SINGLE") ? "A" : a.label.Contains("DOUBLE") ? "B" : a.label.Contains("TWIN") ? "C" : a.label.Contains("TRIPLE") ? "D" :
                                          a.label.Contains("QUAD") ? "E" : a.label.Contains("TSU") ? "F" :
                                          a.label.ToLower().Contains("child + bed") ? "G" : a.label.ToLower().Contains("child - bed") ? "H" :
                                          a.label.ToLower().Contains("infant") ? "I" : "J").ThenBy(a => a.label).ToList();

                    roomsuppliment = prodRangeGetRes.ProductRangeDetails.Where(a => a.AdditionalYN == true).
                                     Select(a => new AutoCompleteTextBox {
                        value = a.VoyagerProductRange_Id, label = a.ProductRangeCode + " (" + a.PersonType + (a.AgeRange == null ? "" : " | " + a.AgeRange) + ") ", type = a.AdditionalYN.ToString()
                    }).
                                     OrderBy(a => a.type).ThenBy(a => a.label).ToList();

                    roomservice.AddRange(roomsuppliment);
                    prodRangeList = roomservice;
                }
                else
                {
                    prodRangeList = prodRangeGetRes.ProductRangeDetails.Select(a => new AutoCompleteTextBox {
                        value = a.VoyagerProductRange_Id, label = a.ProductRangeCode + " (" + a.PersonType + (a.AgeRange == null ? "" : " | " + a.AgeRange) + ") ", type = a.AdditionalYN.ToString()
                    }).OrderBy(a => a.type).ThenBy(a => a.label).ToList();
                }

                return(Json(new { prodRangeGetRes.SupplierId, prodRangeGetRes.SupplierName, prodRangeList }));
            }
            else
            {
                return(Json(""));
            }
        }