Beispiel #1
0
 private void FilterBranchesWithOngoingPromotions()
 {
     if (SelectedItemComboBox?.Equals("UNFILTERED") != false)
     {
         if (SearchTerm?.Equals("") != false)
         {
             SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredBranches = SimpleIoc.Default.GetInstance <BranchesViewModel>().Branches.Where(b => b.hasOngoingPromotions()).ToList();
         }
         else
         {
             SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredBranches = SimpleIoc.Default.GetInstance <BranchesViewModel>().Branches.Where(b => b.Name.Contains(SearchTerm, StringComparison.OrdinalIgnoreCase) && b.hasOngoingPromotions()).ToList();
         }
     }
     else if (SearchTerm?.Equals("") != false)
     {
         SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredBranches = SimpleIoc.Default.GetInstance <BranchesViewModel>().Branches.Where(b => b.Type.ToString().Equals(SelectedItemComboBox) && b.hasOngoingPromotions()).ToList();
     }
     else
     {
         SimpleIoc.Default.GetInstance <BranchesViewModel>().FilteredBranches = SimpleIoc.Default.GetInstance <BranchesViewModel>().Branches.Where(b => b.Name.Contains(SearchTerm, StringComparison.OrdinalIgnoreCase) && b.Type.ToString().Equals(SelectedItemComboBox) && b.hasOngoingPromotions()).ToList();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Returns true if IngredientObjectItems instances are equal
        /// </summary>
        /// <param name="other">Instance of IngredientObjectItems to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IngredientObjectItems other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Categories == other.Categories ||
                     Categories != null &&
                     Categories.SequenceEqual(other.Categories)
                 ) &&
                 (
                     Nutrients == other.Nutrients ||
                     Nutrients != null &&
                     Nutrients.SequenceEqual(other.Nutrients)
                 ) &&
                 (
                     CalorieConversionFactor == other.CalorieConversionFactor ||
                     CalorieConversionFactor != null &&
                     CalorieConversionFactor.Equals(other.CalorieConversionFactor)
                 ) &&
                 (
                     ProteinConversionFactor == other.ProteinConversionFactor ||
                     ProteinConversionFactor != null &&
                     ProteinConversionFactor.Equals(other.ProteinConversionFactor)
                 ) &&
                 (
                     Components == other.Components ||
                     Components != null &&
                     Components.SequenceEqual(other.Components)
                 ) &&
                 (
                     Portions == other.Portions ||
                     Portions != null &&
                     Portions.SequenceEqual(other.Portions)
                 ) &&
                 (
                     CommonName == other.CommonName ||
                     CommonName != null &&
                     CommonName.Equals(other.CommonName)
                 ) &&
                 (
                     Footnote == other.Footnote ||
                     Footnote != null &&
                     Footnote.Equals(other.Footnote)
                 ) &&
                 (
                     SearchTerm == other.SearchTerm ||
                     SearchTerm != null &&
                     SearchTerm.Equals(other.SearchTerm)
                 ) &&
                 (
                     Score == other.Score ||
                     Score != null &&
                     Score.Equals(other.Score)
                 ));
        }