public EstimateResult EstimateScore(TasteValue model, List <VegetableDosing> VegModel) { EstimateResult Result = new EstimateResult(); List <string> DescriptionList = new List <string>(); List <string> VegCatagories = new List <string>(); foreach (var item in VegModel) { VegCatagories.Add(item.VegValue.Name); } var response = new SQL().GetVegetableFlavour(VegCatagories); int number = response.Where(x => x.FlavourName != null || x.FlavourName != "").Count(); int saltyScore, sweetScore, sourScore, spicyScore, bitterScore, oilScore, FlavourScore; DescriptionList.Add(FlavourEstimate(number, out FlavourScore)); DescriptionList.Add(SaltyEstimate(model.Salty, out saltyScore)); DescriptionList.Add(SweetEstimate(model.Sweet, out sweetScore)); DescriptionList.Add(SourEstimate(model.Sour, out sourScore)); DescriptionList.Add(SpicyEstimate(model.Spicy, out spicyScore)); DescriptionList.Add(BitterEstimate(model.Bitter, out bitterScore)); DescriptionList.Add(OilEstimate(model.Oil, out oilScore)); Result.Description = string.Join(", ", DescriptionList.ToArray()); Result.Score = 95 - saltyScore - sweetScore - sourScore - spicyScore - bitterScore - oilScore; return(Result); }
public TasteValue EggCalculate(List <EggDosing> eggList) { TasteValue EggValue = new TasteValue(); foreach (EggDosing item in eggList) { EggValue.Weight = item.Number * 50; } return(EggValue); }
/// <summary> /// Get the salty and oil value from meat /// </summary> /// <param name="veglist"></param> /// <returns></returns> public TasteValue MeatCalculate(List <MeatDosing> MeatList) { TasteValue MeatValue = new TasteValue(); foreach (MeatDosing item in MeatList) { MeatValue.Salty += item.MeatValue.Salty * item.Weight; MeatValue.Oil += item.MeatValue.Fat * item.Weight; MeatValue.Weight += item.Weight; } return(MeatValue); }
/// <summary> /// Get taste value from vegetable /// </summary> /// <param name="veglist"></param> /// <returns></returns> public TasteValue VegtableCalculate(List <VegetableDosing> veglist) { TasteValue VegValue = new TasteValue(); foreach (VegetableDosing item in veglist) { VegValue.Salty += item.VegValue.Salty * item.Weight; VegValue.Spicy += item.VegValue.Spicy * item.Weight; VegValue.Sour += item.VegValue.Sour * item.Weight; VegValue.Bitter += item.VegValue.Bitter * item.Weight; VegValue.Sweet += item.VegValue.Sweet * item.Weight; VegValue.Weight += item.Weight; } return(VegValue); }
public TasteValue SeasonCalculate(List <SeasonDosing> SeasonList) { TasteValue SeasonValue = new TasteValue(); foreach (SeasonDosing item in SeasonList) { SeasonValue.Salty += item.SeasonValue.Salty * item.Weight; SeasonValue.Spicy += item.SeasonValue.Spicy * item.Weight; SeasonValue.Sour += item.SeasonValue.Sour * item.Weight; SeasonValue.Bitter += item.SeasonValue.Bitter * item.Weight; SeasonValue.Sweet += item.SeasonValue.Sweet * item.Weight; SeasonValue.Oil += item.SeasonValue.Bitter * item.Weight; SeasonValue.Weight = item.Weight; } return(SeasonValue); }
public TasteValue AvgCalculator(List <TasteValue> TasteList) { TasteValue TotalTaste = new TasteValue(); foreach (TasteValue item in TasteList) { TotalTaste.Salty += item.Salty; TotalTaste.Sour += item.Sour; TotalTaste.Spicy += item.Spicy; TotalTaste.Bitter += item.Bitter; TotalTaste.Sweet += item.Sweet; TotalTaste.Oil += item.Oil; TotalTaste.Weight = item.Weight; } TotalTaste.Spicy = TotalTaste.Spicy / TotalTaste.Weight; TotalTaste.Sour = TotalTaste.Sour / TotalTaste.Weight; TotalTaste.Salty = TotalTaste.Salty / TotalTaste.Weight; TotalTaste.Bitter = TotalTaste.Bitter / TotalTaste.Weight; TotalTaste.Sweet = TotalTaste.Sweet / TotalTaste.Weight; TotalTaste.Oil = TotalTaste.Oil / TotalTaste.Weight; return(TotalTaste); }