コード例 #1
0
 public ProductItemDesignModel()
 {
     Grade      = "J26";
     GuidePath  = ProductGuideLogic.GetPath(Grade);
     GuideTitle = ProductGuideLogic.GetTitle(GuidePath);
     SearchTerm = "J26RB012AM23";
 }
コード例 #2
0
        /// <summary>
        /// Begin the search - button call.
        /// </summary>
        public void ActivateGradeSearch()
        {
            Product CurrentProduct = new Product();

            // save whats been entered
            CurrentProduct.SearchTerm = SaveProductEntry();

            // format check
            if (CurrentInput.GradeSearched.Length < 3)
            {
                ProductGuideLogic.ErrorTooShort();
                return;
            }


            // determine if it's a full product or a grade
            bool isGrade = IsGrade(CurrentInput.GradeSearched);

            // isolate the grade and save it
            if (!isGrade)
            {
                CurrentProduct.Grade = ProductGuideLogic.ExtractGrade(CurrentInput.GradeSearched);
            }
            else
            {
                CurrentProduct.Grade = CurrentInput.GradeSearched;
            }

            // save secondary grade if exists
            if (CurrentProduct.Grade.Length == 4)
            {
                CurrentProduct.SecondGrade = CurrentProduct.Grade.Substring(1, 3);
            }

            // search on network for matching guide
            string primaryPath = ProductGuideLogic.GetPath(CurrentProduct.Grade);

            // if none found
            if (primaryPath == string.Empty)
            {
                ProductGuideLogic.ErrorNoneFound();
                return;
            }

            CurrentProduct.ProductGuide = primaryPath;

            // get second guide path
            if (CurrentProduct.SecondGrade != null)
            {
                string secondaryPath = ProductGuideLogic.GetPath(CurrentProduct.SecondGrade);

                if (secondaryPath == string.Empty)
                {
                    CurrentProduct.SecondGrade = string.Empty;
                }

                CurrentProduct.SecondGuide = secondaryPath;
            }

            // add to list
            productList.Add(CurrentProduct);
            PropertyChanged(this, new PropertyChangedEventArgs(nameof(ProductList)));

            // return PDF link and associate with button


            // parse through PDF
            // return text to fields
            // if 4 letter grade, find secondary pdf
            // save in combo box
        }