// // GET: /Frame/Attach/5 public ActionResult Attach(int id = 0) { Frame frame = db.Frames.Find(id); if (frame == null) { return(View("Missing", new MissingItem(id))); } LocationSelector selector = new LocationSelector { FrameId = id, }; var locations = db.Locations .Where(l => !db.Frames .FirstOrDefault(f => f.FrameId == selector.FrameId) .Locations.Any(fl => fl.LocationId == l.LocationId)) .Include(l => l.Level) .Select(l => new { LocationId = l.LocationId, Name = l.Level.Name + " : " + l.Name }) .OrderBy(l => l.Name) .ToList() ; ViewBag.Locations = new SelectList(locations, "LocationId", "Name"); return(View(selector)); }
public ActionResult Attach(LocationSelector selector) { Frame frame = db.Frames.Find(selector.FrameId); if (frame == null) { return(View("Missing", new MissingItem(selector.FrameId))); } if (selector.LocationId > 0) { Location location = db.Locations.Find(selector.LocationId); if (location == null) { return(View("Missing", new MissingItem(selector.LocationId, "Location"))); } frame.Locations.Add(location); db.SaveChanges(); return(RedirectToAction("Index")); } IEnumerable <Location> locations = db.Locations .Where(l => !db.Frames .FirstOrDefault(f => f.FrameId == selector.FrameId) .Locations.Any(fl => fl.LocationId == l.LocationId)) ; ViewBag.Locations = new SelectList(db.Locations, "LocationId", "Name"); return(View(selector)); }
public void splashPage_logIn() { var agent = ConfigurationManager.AppSettings["Browser"]; var cbtapi = new CBTApi(); var sessionId = ((RemoteWebDriver)Driver.Instance).SessionId.ToString(); var caps = new DesiredCapabilities(); if (agent == "Remote_CBT") { try { caps.SetCapability("name", "Club Automation Test: splashPage_logIn"); caps.SetCapability("build", "TestCase #"); SplashPage.GoTo(); SplashPage.AssertPageTitle(); SplashPage.EnterUsername(); SplashPage.EnterPassword(); cbtapi.takeSnapshot(sessionId); SplashPage.ClickLoginBtn(); LocationSelector.SelectLocation(); LocationSelector.SelectPos(); LocationSelector.ClickSelect(); DashboardPage.AssertLoggedUserName(); cbtapi.takeSnapshot(sessionId); log.InfoFormat($"{TestContext.TestName} - Test Passed"); cbtapi.setScore(sessionId, "Pass"); } catch (Exception e) { var snapshotHash = cbtapi.takeSnapshot(sessionId); cbtapi.setDescription(sessionId, snapshotHash, e.ToString()); cbtapi.setScore(sessionId, "Fail"); log.ErrorFormat($"{TestContext.TestName} - Test Failed", e.Message, e.StackTrace); throw; } } else { try { SplashPage.GoTo(); SplashPage.AssertPageTitle(); SplashPage.EnterUsername(); SplashPage.EnterPassword(); SplashPage.ClickLoginBtn(); LocationSelector.SelectLocation(); LocationSelector.SelectPos(); LocationSelector.ClickSelect(); DashboardPage.AssertLoggedUserName(); log.InfoFormat($"{TestContext.TestName} - Test Passed"); } catch (Exception e) { log.ErrorFormat($"{TestContext.TestName} - Test Failed", e.Message, e.StackTrace); throw; } } }
public void cities_SelectedChanged(object sender, CommandEventArgs e) { panelSearch.Update(); NameValueCollection args = Renderer.ParseQueryString(e.CommandArgument.ToString()); LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(args)); GetData(sender, e); }
public void linkLocal_Click(object sender, EventArgs e) { if (!SessionManager.IsLoggedIn) { return; } checkboxBloggersOnly.Checked = false; checkboxPicturesOnly.Checked = false; inputName.Text = string.Empty; inputCity.Text = string.Empty; inputEmailAddress.Text = string.Empty; LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(SessionManager.Account)); GetData(sender, e); panelSearch.Update(); }
// // GET: /Frame/Detach/5 public ActionResult Detach(int id = 0, int locationId = 0) { Frame frame = db.Frames.Find(id); if (frame == null) { return(View("Missing", new MissingItem(id))); } LocationSelector selector = new LocationSelector { FrameId = id, LocationId = locationId, LocationName = db.Locations.Find(locationId).Name, }; return(View(selector)); }
// // GET: /Frame/Attach/5 public ActionResult Attach(int id = 0) { Frame frame = db.Frames.Find(id); if (frame == null) { return(View("Missing", new MissingItem(id))); } LocationSelector selector = new LocationSelector { FrameId = id, }; FillLocationsSelectList(frameId: selector.FrameId); return(View(selector)); }
public ActionResult Attach(LocationSelector selector) { Frame frame = db.Frames.Find(selector.FrameId); if (frame == null) { return(View("Missing", new MissingItem(selector.FrameId))); } if (selector.LocationId > 0) { Location location = db.Locations.Find(selector.LocationId); if (location == null) { return(View("Missing", new MissingItem(selector.LocationId, "Location"))); } frame.Locations.Add(location); db.SaveChanges(); //temporary workaround to prevent frame edit > attach > save > return to attach //downsides: with frame filters or when referer is the panel page still returns to default frame page. Use browser history. TempData[HtmlExtensions.CameFrom] = "/Frame/Index"; return(RedirectToAction("Index")); } IEnumerable <Location> locations = db.Locations .Where(l => !db.Frames .FirstOrDefault(f => f.FrameId == selector.FrameId) .Locations.Any(fl => fl.LocationId == l.LocationId)) ; ViewBag.Locations = new SelectList(db.Locations, "LocationId", "Name"); return(View(selector)); }