private void timAff_Tick(object sender, EventArgs e) { if (Main.hoverShop != null && (lastShopHover == null || lastShopHover.id != Main.hoverShop.id)) { lastShopHover = Main.hoverShop; flowReviewShop.Controls.Clear(); List <clReview> r = Main.hoverShop.getReviews().OrderBy(X => X.user.name).ToList(); foreach (var item in r) { ucReview ucR = new ucReview(); flowReviewShop.Controls.Add(ucR); ucR.init(item, false, true); } } if (Main.hoverUser != null && (lastUserHover == null || lastUserHover.id != Main.hoverUser.id)) { lastUserHover = Main.hoverUser; flowReviews.Controls.Clear(); List <clReview> r = Main.hoverUser.getReviews().OrderBy(X => X.shop.name).ToList(); foreach (var item in r) { ucReview ucR = new ucReview(); flowReviews.Controls.Add(ucR); ucR.init(item, true, false); } } }
internal void update(clShop newShop = null) { if (newShop != null) { shop = newShop; } if (shop == null) { return; } lblName.Text = shop.name; lblAddress.Text = shop.address.ToString(); lblName.BackColor = shop.fullyListed ? Color.LightBlue : Color.White; }
internal void init() { user = Main.data.getUserById(idUser); shop = Main.data.getShopById(idShop); }
public clReview(string in_date, clUser in_user, clShop in_shop) { try { in_date = in_date.Replace("★★★★★", "").Trim(); if (in_date.EndsWith("months ago")) { in_date = in_date.Replace("months ago", "").Trim(); date = DateTime.Now.AddMonths(-int.Parse(in_date)); } else if (in_date.EndsWith("weeks ago")) { in_date = in_date.Replace("weeks ago", "").Trim(); date = DateTime.Now.AddDays(-int.Parse(in_date) * 7); } else if (in_date.EndsWith("days ago")) { in_date = in_date.Replace("days ago", "").Trim(); date = DateTime.Now.AddDays(-int.Parse(in_date)); } else if (in_date.EndsWith("hours ago")) { in_date = in_date.Replace("hours ago", "").Trim(); date = DateTime.Now.AddHours(-int.Parse(in_date)); } else if (in_date.EndsWith("years ago")) { in_date = in_date.Replace("years ago", "").Trim(); date = DateTime.Now.AddDays(-int.Parse(in_date) * 360); } else if (in_date.Contains("a week ago")) { date = DateTime.Now.AddDays(-5); } else if (in_date.Contains("a month ago")) { date = DateTime.Now.AddDays(-30); } else if (in_date.Contains("a year ago")) { date = DateTime.Now.AddDays(-365); } else if (in_date.Contains("a day ago")) { date = DateTime.Now.AddDays(-1); } else { return; } user = in_user; shop = in_shop; idShop = shop.id; idUser = user.id; rating = 5; loadOK = true; } catch (Exception ex) { Main.lastText = ex.Message; } }