private double GamesAddictScore(HandSetFeatures phone) { double ramScore, resolutionScore, batteryLifeScore, screenSizeScore; double min, max; /**** RAM (Most important) **/ basket.GetMaxAndMinLimits(x => x.RamSize, out min, out max); ramScore = LogisticFunc(phone.RamSize, max - min); /*** Resolution (Second most important) ****/ basket.GetMaxAndMinLimits(x => Miscellany.Product(x.DisplayResolution), out min, out max); resolutionScore = LogisticFunc(Miscellany.Product(phone.DisplayResolution), max - min); /***** Battery Life (third most important) ********/ basket.GetMaxAndMinLimits(x => x.BatteryLife, out min, out max); batteryLifeScore = LogisticFunc(phone.BatteryLife, max - min); /********** Screen Size (The least important) *************/ basket.GetMaxAndMinLimits(x => x.ScreenSize, out min, out max); screenSizeScore = LogisticFunc(phone.ScreenSize, max - min); return((4 * ramScore + 3 * resolutionScore + 2 * batteryLifeScore + screenSizeScore) / 10); }
public static void ComposeBrandsCarousel(Activity reply, IEnumerable <string> brands, HandSets hs) { List <string> listOfBrands = new List <string>(brands); int len; HeroCard heroCard; listOfBrands.Sort(); len = listOfBrands.Count; for (int n = 0; n < len; ++n) { heroCard = new HeroCard { Title = Miscellany.Capitalize(listOfBrands[n]), Subtitle = Miscellany.Capitalize(listOfBrands[n]), Text = "", Images = new List <CardImage> { new CardImage(hs.GetBrandLogo(listOfBrands[n]), "img/jpeg") }, Buttons = new List <CardAction> { new CardAction { Title = "Pick Me!", Type = ActionTypes.ImBack, Value = "I want " + Miscellany.Capitalize(listOfBrands[n]) } }, }; reply.Attachments.Add(heroCard.ToAttachment()); } reply.AttachmentLayout = "carousel"; }
private double SameSizeScore(HandSetFeatures phone) { HandSetFeatures currentPhoneFeatures = basket.GetModelFeatures(CurrentPhone); double currentPhoneSize, candidatePhoneSize, m, b; // m = declive currentPhoneSize = Miscellany.Product(currentPhoneFeatures.BodySize); candidatePhoneSize = Miscellany.Product(phone.BodySize); if ((candidatePhoneSize >= (currentPhoneSize * 0.95)) && (candidatePhoneSize <= (currentPhoneSize * 1.05))) { return(1); } if ((candidatePhoneSize <= (currentPhoneSize * 0.8)) || (candidatePhoneSize >= (currentPhoneSize * 1.2))) { return(0); } if (candidatePhoneSize < currentPhoneSize) { m = 1 / (0.15 * currentPhoneSize); b = -16 / 3; return(candidatePhoneSize * m + b); } else { m = -1 / (0.15 * currentPhoneSize); b = 8; } return(candidatePhoneSize * m + b); }