private void SetRegionInstances(RegionSet regionSet) { if (regionSet == null || regionSet.Regions == null) { return; } foreach (var region in regionSet.Regions) { if (region.Region != null) { IElement regionContent = null; if (_regionComponents.ContainsKey(region.RegionName)) { regionContent = _regionComponents[region.RegionName] as IElement; } if (_regionLayouts.ContainsKey(region.RegionName)) { regionContent = _regionLayouts[region.RegionName] as IElement; } _layout.PopulateElement(region.RegionName, regionContent); } if (region.ChildRegions != null) { SetRegionInstances(region.ChildRegions); } } }
public static RegionSet Parse(string regions, ref int position) { var result = new RegionSet { Regions = new List <RegionSetRegion>() }; var start = position; while (position < regions.Length) { switch (regions[position]) { case '(': result.Regions.AddRange(BuildList(regions, start, position)); position++; result.Regions.Add(new RegionSetRegion { ChildRegions = Parse(regions, ref position) }); position++; start = position; break; case ')': result.Regions.AddRange(BuildList(regions, start, position)); return(result); default: position++; break; } } result.Regions.AddRange(BuildList(regions, start, position)); return(result); }
ILayoutDefinition ILayoutDefinition.RegionNesting(string regionNesting) { var position = 0; _regionSet = RegionSet.Parse(regionNesting, ref position); return(this); }
public IActionResult Edit([Bind("RegionSetId,Name,OwnerId,ImageURL,Description,IsPublic")] RegionSet model) { if (ModelState.IsValid) { model = _worldService.UpdateRegionSet(model); return(RedirectToAction("RegionSet", model)); } return(View(model)); }
public IActionResult Edit(string regionSetId) { if (_worldService.CanEditRegionSet(User.GetUserId(), regionSetId)) { RegionSet model = _worldService.GetRegionSet(regionSetId); return(View(model)); } return(RedirectToAction("Index")); }
public IActionResult Create() { RegionSet model = new RegionSet() { OwnerId = User.GetUserId() }; return(View(model)); }
public IActionResult Create([Bind("RegionSetId,Name,OwnerId,ImageURL,Description,IsPublic")] RegionSet model) { if (ModelState.IsValid) { model.OwnerId = User.GetUserId(); var regionSet = _worldService.CreateRegionSet(model); return(RedirectToAction("RegionSet", new { regionSetId = regionSet.RegionSetId })); } return(View(model)); }
public ActionResult Delete(int id, FormCollection collection) { using (TeamEVotingDBEntities teamEVotingDBEntities = new TeamEVotingDBEntities()) { RegionSet regionSet = teamEVotingDBEntities.RegionSet.Where(x => x.Region_Id == id).FirstOrDefault(); teamEVotingDBEntities.RegionSet.Remove(regionSet); teamEVotingDBEntities.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Create(RegionSet region) { using (TeamEVotingDBEntities teamEVotingDBEntities = new TeamEVotingDBEntities()) { if (ModelState.IsValid) { teamEVotingDBEntities.RegionSet.Add(region); teamEVotingDBEntities.SaveChanges(); } } return(RedirectToAction("Index")); }
public IActionResult RegionSet(string regionSetId) { var userId = User.GetUserId(); if (_worldService.CanViewRegionSet(userId, regionSetId)) { RegionSet model = _worldService.GetRegionSet(regionSetId); ViewBag.CanEdit = _worldService.CanEditRegionSet(userId, regionSetId); ViewBag.Owner = _userRepository.GetUser(model.OwnerId); return(View(model)); } return(RedirectToAction("Index")); }
public void RegionsByUrl_CB(string jsonRegionsDS) { RegionSet rset = JsonUtility.FromJson <RegionSet>(jsonRegionsDS); _rDS.curUrl = rset.url; RegionsDownloaded evt = new RegionsDownloaded(); evt.url = rset.url; _signalBus.Fire(evt); if (rset != null && rset.regions != null) { UpdateRDictBy(rset.regions); } }
public ActionResult CreateWithSql(RegionSet region) { try { using (TeamEVotingDBEntities teamEVotingDBEntities = new TeamEVotingDBEntities()) { //teamEVotingDBEntities.Database.ExecuteSqlCommand("INSERT into RegionSet (Region_Name) VALUES (@Region_Name)"); //teamEVotingDBEntities.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
private void ResolveRegionNames(RegionSet regionSet, INameManager nameManager) { if (regionSet == null || regionSet.Regions == null) { return; } foreach (var region in regionSet.Regions) { if (region.Region == null) { if (region.RegionElementName == null) { if (region.RegionName != null) { object element; if (_regionElements.TryGetValue(region.RegionName, out element)) { region.RegionElementName = element as string; region.Region = element as IRegion; } } } if (region.RegionElementName != null && region.Region == null) { region.Region = nameManager.ResolveRegion(region.RegionElementName, _layout.Package); } } if (region.Region == null && region.RegionName != null) { region.Region = new RegionComponent(_regionDependenciesFactory); } if (region.RegionName != null) { _layout.PopulateRegion(region.RegionName, region.Region); } if (region.ChildRegions != null) { ResolveRegionNames(region.ChildRegions, nameManager); } } }
public ActionResult Create(RegionSet region) { try { using (TeamEVotingDBEntities teamEVotingDBEntities = new TeamEVotingDBEntities()) { List <object> list = new List <object>(); list.Add(region.Region_Name); object[] allitems = list.ToArray(); int output = teamEVotingDBEntities.Database.ExecuteSqlCommand("INSERT into RegionSet(Region_Name) values (@p0)", allitems); } return(RedirectToAction("Index")); } catch (Exception ex) { return(View(ex)); } }
private void WriteRegions(RegionSet regionSet) { if (regionSet == null || regionSet.Regions == null) { return; } foreach (var region in regionSet.Regions) { if (region.RegionName != null) { _layout.AddRegionVisualElement(region.RegionName); } if (region.ChildRegions != null) { WriteNestingOpeningTag(); WriteRegions(region.ChildRegions); WriteNestingClosingTag(); } } }
public RegionSet UpdateRegionSet(RegionSet regionSet) { return(_repo.Update(regionSet)); }
public RegionSet CreateRegionSet(RegionSet regionSet) { return(_repo.Create(regionSet)); }
public UrlPartTypes ProcessFilterPart(ref int currentIndex, string[] urlParts) { if (HasYearFilter && urlParts[currentIndex].Equals("tickets")) { #region tickets calendar PageType = PageTypes.Pages; PageName = "CalendarTickets"; CurrentApplication = "tickets"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (HasYearFilter && urlParts[currentIndex].Equals("free")) { #region Free Guestlist calendar PageType = PageTypes.Pages; PageName = "CalendarFreeGuestlist"; CurrentApplication = "free"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (urlParts[currentIndex].Equals("tags")) { #region tags PageType = PageTypes.Pages; PageName = "TagSearch"; CurrentApplication = "tags"; HasTagFilter = true; currentIndex++; if (urlParts.Length > currentIndex) { CurrentApplication = "tags/" + urlParts[currentIndex]; foreach (string s in urlParts[currentIndex].Split('-')) { if (!s.Equals("all")) TagFilter.Add(Cambro.Web.Helpers.UrlTextDeSerialize(s)); } currentIndex++; } return UrlPartTypes.Application; #endregion } else if ((HasBrandObjectFilter || HasVenueObjectFilter) && (urlParts[currentIndex].Equals("tickets") || urlParts[currentIndex].Equals("photos"))) { #region Styled page currentIndex++; PageType = PageTypes.Styled; PageName = "Home"; if (urlParts.Length > currentIndex && YearRegex.IsMatch(urlParts[currentIndex])) { #region //year and month int year = int.Parse(urlParts[currentIndex]); if (year > 1990 && year < 2030) { HasYearFilter = true; DateFilter = new DateTime(year, 1, 1); PageName = "Calendar"; currentIndex++; if (urlParts.Length > currentIndex && MonthRegex.IsMatch(urlParts[currentIndex])) { int month = MonthNumber(urlParts[currentIndex]); HasMonthFilter = true; DateFilter = new DateTime(year, month, 1); currentIndex++; } return UrlPartTypes.Application; } #endregion } else if (urlParts.Length > currentIndex && MonthRegex.IsMatch(urlParts[currentIndex])) { #region //month only - infer the year int requestedMonth = MonthNumber(urlParts[currentIndex]); HasYearFilter = true; HasMonthFilter = true; int requestedMonthIndex = (DateTime.Today.Year * 12) + requestedMonth; int currentMonthIndex = (DateTime.Today.Year * 12) + DateTime.Today.Month; DateTime d = new DateTime(DateTime.Today.Year, requestedMonth, 1); if (currentMonthIndex - requestedMonthIndex > 4) { d = new DateTime(DateTime.Today.Year + 1, requestedMonth, 1); } else if (currentMonthIndex - requestedMonthIndex < -7) { d = new DateTime(DateTime.Today.Year - 1, requestedMonth, 1); } DateFilter = d; PageName = "Calendar"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (urlParts.Length > currentIndex && urlParts[currentIndex].ToLower().Equals("calendar")) { #region //todays month DateFilter = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); PageName = "Calendar"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (urlParts.Length > currentIndex && NumericRegex.IsMatch(urlParts[currentIndex])) { #region //event id PageName = "EventDetail"; return UrlPartTypes.Application; #endregion } return UrlPartTypes.ObjectFilter; #endregion } else if (urlParts[currentIndex].Equals("parties")) { #region brand currentIndex++; Query brandQuery = new Query(); brandQuery.NoLock = true; brandQuery.Columns = new ColumnSet(Brand.Columns.K); brandQuery.QueryCondition = new Q(Brand.Columns.UrlName, urlParts[currentIndex]); BrandSet bs = new BrandSet(brandQuery); if (bs.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Brand; ObjectFilterK = bs[0].K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/parties/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].Equals("groups")) { #region group currentIndex++; if (urlParts.Length > currentIndex) { string groupUrlName = urlParts[currentIndex]; if (urlParts[currentIndex].Equals("parties")) { currentIndex++; groupUrlName = "parties/" + urlParts[currentIndex]; } Query groupQuery = new Query(); groupQuery.NoLock = true; groupQuery.Columns = new ColumnSet(Bobs.Group.Columns.K); groupQuery.QueryCondition = new Q(Bobs.Group.Columns.UrlName, groupUrlName); GroupSet gs = new GroupSet(groupQuery); if (gs.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Group; ObjectFilterK = gs[0].K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/groups/" + groupUrlName; currentIndex++; return UrlPartTypes.ObjectFilter; } } PageType = PageTypes.Pages; PageName = "GroupBrowser"; CurrentApplication = "groups"; return UrlPartTypes.Application; #endregion } else if (!HasObjectFilter && urlParts[currentIndex].Equals("promoters")) { #region promoter currentIndex++; Query promoterQuery = new Query(); promoterQuery.NoLock = true; promoterQuery.Columns = new ColumnSet(Promoter.Columns.K); promoterQuery.QueryCondition = new Q(Promoter.Columns.UrlName, urlParts[currentIndex]); PromoterSet ps = new PromoterSet(promoterQuery); if (ps.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Promoter; ObjectFilterK = ps[0].K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/promoters/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } return UrlPartTypes.Null; #endregion } else if (!HasObjectFilter && urlParts[currentIndex].Equals("members")) { #region members - usr currentIndex++; if (urlParts[currentIndex].Length > 0) { Usr usr = Usr.GetFromNickName(urlParts[currentIndex]); if (usr != null) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Usr; ObjectFilterK = usr.K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/members/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } //Query usrQuery = new Query(); //usrQuery.NoLock = true; //usrQuery.Columns = new ColumnSet(Usr.Columns.K); //usrQuery.QueryCondition = new Q(Usr.Columns.NickName, urlParts[currentIndex]); //UsrSet us = new UsrSet(usrQuery); //if (us.Count > 0) //{ // HasObjectFilter = true; // ObjectFilterType = Model.Entities.ObjectType.Usr; // ObjectFilterK = us[0].K; // PageType = PageTypes.Application; // PageName = "Home"; // CurrentFilter += "/members/" + urlParts[currentIndex]; // currentIndex++; // return UrlPartTypes.ObjectFilter; //} } return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].StartsWith("event-")) { #region event try { Event ev = new Event(int.Parse(urlParts[currentIndex].Split('-')[1])); HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Event; ObjectFilterK = ev.K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } catch { currentIndex++; } return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].StartsWith("gallery-")) { #region gallery try { Gallery g = new Gallery(int.Parse(urlParts[currentIndex].Split('-')[1])); HasObjectFilter = true; PageType = PageTypes.Application; PageName = "Home"; ObjectFilterType = Model.Entities.ObjectType.Gallery; ObjectFilterK = g.K; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } catch { currentIndex++; } return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].StartsWith("photo-")) { #region photo try { Photo p = new Photo(int.Parse(urlParts[currentIndex].Split('-')[1])); HasObjectFilter = true; PageType = PageTypes.Application; PageName = "Home"; ObjectFilterType = Model.Entities.ObjectType.Photo; ObjectFilterK = p.K; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } catch { currentIndex++; } return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].StartsWith("article-")) { #region article try { Article a = new Article(int.Parse(urlParts[currentIndex].Split('-')[1])); HasObjectFilter = true; PageType = PageTypes.Application; PageName = "Home"; ObjectFilterType = Model.Entities.ObjectType.Article; ObjectFilterK = a.K; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; return UrlPartTypes.ObjectFilter; } catch { currentIndex++; } return UrlPartTypes.Null; #endregion } else if (GetMusicTypeK(urlParts[currentIndex].ToLower()) > 0) { #region music filter this.HasMusicFilter = true; this.MusicFilterK = GetMusicTypeK(urlParts[currentIndex].ToLower()); CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; return UrlPartTypes.MusicFilter; #endregion } else if (GetThemeK(urlParts[currentIndex].ToLower()) > 0) { #region theme filter this.HasThemeFilter = true; this.ThemeFilterK = GetThemeK(urlParts[currentIndex].ToLower()); CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; return UrlPartTypes.ThemeFilter; #endregion } else if (GetCountryK(urlParts[currentIndex].ToLower()) > 0) { #region Lookup country / place / venue HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Country; ObjectFilterK = GetCountryK(urlParts[currentIndex].ToLower()); PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; int countryK = this.ObjectFilterK; if (urlParts.Length > currentIndex) { Country country = new Country(countryK); Q regionQ = new Q(true); if (country.UseRegion) { Query qRegion = new Query(); qRegion.NoLock = true; qRegion.Columns = new ColumnSet(Region.Columns.K); qRegion.TopRecords = 1; qRegion.QueryCondition = new And( new Q(Region.Columns.CountryK, countryK), new Q(Region.Columns.Abbreviation, urlParts[currentIndex])); RegionSet rs = new RegionSet(qRegion); if (rs.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Region; ObjectFilterK = rs[0].K; PageType = PageTypes.Application; PageName = "Home"; int regionK = ObjectFilterK; regionQ = new Q(Place.Columns.RegionK, regionK); CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; if (!(urlParts.Length > currentIndex)) return UrlPartTypes.ObjectFilter; } } #region Lookup place Query placeQuery = new Query(); placeQuery.NoLock = true; placeQuery.Columns = new ColumnSet(Place.Columns.K); placeQuery.QueryCondition = new And( new Q(Place.Columns.Enabled, true), new Q(Place.Columns.CountryK, countryK), new Q(Place.Columns.UrlName, urlParts[currentIndex].ToLower()), regionQ ); PlaceSet ps = new PlaceSet(placeQuery); if (ps.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Place; ObjectFilterK = ps[0].K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; int placeK = this.ObjectFilterK; if (urlParts.Length > currentIndex) { #region Lookup venue Query venueQuery = new Query(); venueQuery.NoLock = true; venueQuery.Columns = new ColumnSet(Venue.Columns.K); venueQuery.QueryCondition = new And( new Q(Venue.Columns.PlaceK, placeK), new Q(Venue.Columns.UrlName, urlParts[currentIndex].ToLower()) ); VenueSet vs = new VenueSet(venueQuery); if (vs.Count > 0) { HasObjectFilter = true; ObjectFilterType = Model.Entities.ObjectType.Venue; ObjectFilterK = vs[0].K; PageType = PageTypes.Application; PageName = "Home"; CurrentFilter += "/" + urlParts[currentIndex].ToLower(); currentIndex++; int venueK = this.ObjectFilterK; } #endregion } } #endregion } return UrlPartTypes.ObjectFilter; #endregion } else if (YearRegex.IsMatch(urlParts[currentIndex])) { #region year / month / day int year = int.Parse(urlParts[currentIndex]); if (year > 1990 && year < 2030) { HasYearFilter = true; DateFilter = new DateTime(year, 1, 1); PageType = PageTypes.Pages; PageName = "Calendar"; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; if (urlParts.Length > currentIndex && MonthRegex.IsMatch(urlParts[currentIndex])) { int month = MonthNumber(urlParts[currentIndex]); HasMonthFilter = true; DateFilter = new DateTime(year, month, 1); PageType = PageTypes.Pages; PageName = "Calendar"; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; if (urlParts.Length > currentIndex && DayRegex.IsMatch(urlParts[currentIndex])) { int day = int.Parse(urlParts[currentIndex]); try { DateFilter = new DateTime(year, month, day); HasDayFilter = true; PageType = PageTypes.Pages; PageName = "Calendar"; CurrentFilter += "/" + urlParts[currentIndex]; currentIndex++; } catch { currentIndex++; } } } return UrlPartTypes.DateFilter; } else return UrlPartTypes.Null; #endregion } else if (urlParts[currentIndex].Equals("chat") || urlParts[currentIndex].Equals("messages")) { #region chat application PageType = PageTypes.Pages; PageName = "Chat"; CurrentApplication = "chat"; currentIndex++; if (ObjectFilterType.Equals(Model.Entities.ObjectType.Usr)) { PageType = PageTypes.PagesFolder; PageFolder = "Usrs"; PageName = "MyComments"; CurrentApplication = "chat"; } return UrlPartTypes.Application; #endregion } else if (urlParts[currentIndex].Equals("archive")) { #region archive application PageType = PageTypes.Pages; PageName = "Archive"; CurrentApplication = "archive"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (urlParts[currentIndex].Equals("hottickets")) { #region hot tickets application PageType = PageTypes.Pages; PageName = "HotTickets"; CurrentApplication = "hottickets"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (urlParts[currentIndex].Equals("home")) { #region home application CurrentApplication = "home"; currentIndex++; return UrlPartTypes.Application; #endregion } else if (HasUsrObjectFilter && urlParts[currentIndex].Equals("photosof")) { #region photosof page currentIndex++; PageType = PageTypes.Application; PageName = "photosof"; CurrentApplication = "photosof/" + urlParts[currentIndex].ToLower(); currentIndex++; return UrlPartTypes.Application; #endregion } else { if (urlParts.Length > currentIndex) { if (!PageType.Equals(PageTypes.Styled)) PageType = PageTypes.Application; PageName = urlParts[currentIndex].ToLower(); CurrentApplication = urlParts[currentIndex].ToLower(); currentIndex++; return UrlPartTypes.Application; } else { currentIndex++; return UrlPartTypes.Null; } } }