public NannyDetailes AddNannyDetailesGrid(Nanny n) { double rat; if (n.peopleThatRating != 0) { rat = n.Stars / n.peopleThatRating; } else { rat = 0; } var myGrid = new NannyDetailes(); myGrid.ID.Content = n.ID; myGrid.Nanny_Name.Content = String.Format(n.name.FirstName + " " + n.name.LastName); myGrid.Nanny_Address.Content = n.address + "; Floor " + n.floor.ToString(); myGrid.Nanny_Detailes.Text += n.print(); myGrid.Price.Text += String.Format("Price Per Months: " + n.SallaryPerMonth); myGrid.Number_Recommendations.Content = String.Format(n.numberRecommendations + " Recommendations"); myGrid.Rating.Text += rat; for (int i = 0; i < rat; i++) { myGrid.rating.Children.Add(new Star(1, 0)); } for (int i = Convert.ToInt32(rat); i < 5; i++) { myGrid.rating.Children.Add(new Star(0, 0)); } return(myGrid); }
public MotherOptions(int id) { InitializeComponent(); instance = BL_imp.GetInstance();//singelton r = new Random(); tofunctions = instance.getMother().Find(x => x.ID == id); idM = tofunctions.ID; Selected = instance.getNanny(); Element_of_Nanny_Detailes = new NannyDetailes(); foreach (Nanny item in Selected) { Grid_Detailes.Children.Add(Element_of_Nanny_Detailes.AddNannyDetailesGrid(item)); } Number_of_nannies.Text += String.Format("We Find " + Selected.Count + " Nannies suit for you"); lastClicked = new Button(); detailes.Content = String.Format(tofunctions.name.FirstName + " " + tofunctions.name.LastName); }