public void rel_admin(string f) { la_2.cardType = "user"; vis_admin.Clear(); List <Products> list = DBActions._a((Admins)MapPage._g); if (f != null && f != "") { f = f.ToLower(); foreach (Guests g in DBActions.guests) { if (g.Name.ToLower().StartsWith(f)) { var l1 = DBActions.GetProducts(g); foreach (Products p in l1) { if (list.Contains(p)) { vis_admin.Add(new Binary { OWNER = g, PRODUCT = p, QUANTITY = DBActions.GetQuantity(g, p) }); } } } } } else { foreach (Guests g in DBActions.guests) { var l1 = DBActions.GetProducts(g); foreach (Products p in l1) { if (list.Contains(p)) { vis_admin.Add(new Binary { OWNER = g, PRODUCT = p, QUANTITY = DBActions.GetQuantity(g, p) }); } } } } la_2.visible = vis_admin; la_2.OpenPage(1, FilterState.BOOKERS); }
public void rel(string f) { vis1.Clear(); Account acc = MapPage._g; if (filter == FilterState.ALL) { layout_b.cardType = "default"; } else if (filter == FilterState.B) { if (acc is Admins) { layout_b.cardType = "admin"; } else if (acc is Guests) { layout_b.cardType = "booked"; } } if (!string.IsNullOrEmpty(f)) { f = f.ToLower(); if (filter == FilterState.ALL) { foreach (Products p in DBActions.products) { if (p.Quantity > 0) { Admins ad = DBActions._p(p); if (ad != null) { if (ad.SName.ToLower().StartsWith(f)) { vis1.Add(new Binary { PRODUCT = p, ADMIN = ad }); } } } } } else if (filter == FilterState.B) { if (acc is Admins) { var acc1 = acc as Admins; var list = DBActions._a(acc1); foreach (Products p in list) { if (p.PName.ToLower().StartsWith(f)) { vis1.Add(new Binary { PRODUCT = p }); } } } } } else { if (filter == FilterState.ALL) { foreach (Products p in DBActions.products) { if (p.Quantity > 0) { Binary b = new Binary { PRODUCT = p }; vis1.Add(b); } } } else if (filter == FilterState.B) { if (acc is Admins) { var ap = DBActions._a(acc as Admins); foreach (Products prd in ap) { vis1.Add(new Binary { PRODUCT = prd }); } } else { var ap = DBActions.GetProducts(acc as Guests); var ap1 = DBActions.GetQuantities(acc as Guests); for (int x = 0; x < ap.Count; x++) { vis1.Add(new Binary { PRODUCT = ap[x], QUANTITY = ap1[x], OWNER = acc as Guests }); } } } } layout_b.visible = vis1; if (MapPage.mapPage.current_state == FilterState.BOOKERS) { layout_b.OpenPage(1, FilterState.ALL); } else { layout_b.OpenPage(1, filter); } }