private void button1_Click(object sender, EventArgs e) { Top10 form = new Top10(); ga.manager.updateTopTen(); form.SetTop10(ga.manager.ten); form.Show(); }
internal void FromTop10(Top10 t) { this.SetAllNull(); if (t.Top != null) this.Top = t.Top.Value; if (t.Percent != null) this.Percent = t.Percent.Value; this.Val = t.Val.Value; if (t.FilterValue != null) this.FilterValue = t.FilterValue.Value; }
internal Top10 ToTop10() { Top10 t = new Top10(); if (this.Top != null && !this.Top.Value) t.Top = this.Top.Value; if (this.Percent != null && this.Percent.Value) t.Percent = this.Percent.Value; t.Val = this.Val; if (this.FilterValue != null) t.FilterValue = this.FilterValue.Value; return t; }
public static void OnSave(WorldSaveEventArgs e) { Persistence.Serialize( FilePath, writer => { writer.Write((int)0); writer.Write(Top10.Count); Top10.ForEach(entry => entry.Serialize(writer)); }); }
public IActionResult CreateTop10(string name) { if (string.IsNullOrEmpty(name)) { return(NotFound()); } var top = new Top10 { Name = name, Top10Id = Guid.NewGuid().ToString() }; AdministrationRepository.AddTop10(top); return(RedirectToAction("GetTop10")); }
internal void FromFilterColumn(FilterColumn fc) { SetAllNull(); if (fc.Filters != null) { Filters.FromFilters(fc.Filters); HasFilters = true; } if (fc.Top10 != null) { Top10.FromTop10(fc.Top10); HasTop10 = true; } if (fc.CustomFilters != null) { CustomFilters.FromCustomFilters(fc.CustomFilters); HasCustomFilters = true; } if (fc.DynamicFilter != null) { DynamicFilter.FromDynamicFilter(fc.DynamicFilter); HasDynamicFilter = true; } if (fc.ColorFilter != null) { ColorFilter.FromColorFilter(fc.ColorFilter); HasColorFilter = true; } if (fc.IconFilter != null) { IconFilter.FromIconFilter(fc.IconFilter); HasIconFilter = true; } ColumnId = fc.ColumnId.Value; if ((fc.HiddenButton != null) && fc.HiddenButton.Value) { HiddenButton = fc.HiddenButton.Value; } if ((fc.ShowButton != null) && !fc.ShowButton.Value) { ShowButton = fc.ShowButton.Value; } }
internal void FromTop10(Top10 t) { SetAllNull(); if (t.Top != null) { Top = t.Top.Value; } if (t.Percent != null) { Percent = t.Percent.Value; } Val = t.Val.Value; if (t.FilterValue != null) { FilterValue = t.FilterValue.Value; } }
internal Top10 ToTop10() { var t = new Top10(); if ((Top != null) && !Top.Value) { t.Top = Top.Value; } if ((Percent != null) && Percent.Value) { t.Percent = Percent.Value; } t.Val = Val; if (FilterValue != null) { t.FilterValue = FilterValue.Value; } return(t); }
internal Top10 ToTop10() { Top10 t = new Top10(); if (this.Top != null && !this.Top.Value) { t.Top = this.Top.Value; } if (this.Percent != null && this.Percent.Value) { t.Percent = this.Percent.Value; } t.Val = this.Val; if (this.FilterValue != null) { t.FilterValue = this.FilterValue.Value; } return(t); }
internal FilterColumn ToFilterColumn() { var fc = new FilterColumn(); if (HasFilters) { fc.Filters = Filters.ToFilters(); } if (HasTop10) { fc.Top10 = Top10.ToTop10(); } if (HasCustomFilters) { fc.CustomFilters = CustomFilters.ToCustomFilters(); } if (HasDynamicFilter) { fc.DynamicFilter = DynamicFilter.ToDynamicFilter(); } if (HasColorFilter) { fc.ColorFilter = ColorFilter.ToColorFilter(); } if (HasIconFilter) { fc.IconFilter = IconFilter.ToIconFilter(); } fc.ColumnId = ColumnId; if ((HiddenButton != null) && HiddenButton.Value) { fc.HiddenButton = HiddenButton.Value; } if ((ShowButton != null) && !ShowButton.Value) { fc.ShowButton = ShowButton.Value; } return(fc); }
internal SLFilterColumn Clone() { var fc = new SLFilterColumn(); fc.HasFilters = HasFilters; fc.Filters = Filters.Clone(); fc.HasTop10 = HasTop10; fc.Top10 = Top10.Clone(); fc.HasCustomFilters = HasCustomFilters; fc.CustomFilters = CustomFilters.Clone(); fc.HasDynamicFilter = HasDynamicFilter; fc.DynamicFilter = DynamicFilter.Clone(); fc.HasColorFilter = HasColorFilter; fc.ColorFilter = ColorFilter.Clone(); fc.HasIconFilter = HasIconFilter; fc.IconFilter = IconFilter.Clone(); fc.ColumnId = ColumnId; fc.HiddenButton = HiddenButton; fc.ShowButton = ShowButton; return(fc); }
private static void PopulateAutoFilter(XLAutoFilter xlAutoFilter, AutoFilter autoFilter) { var filterRange = xlAutoFilter.Range; autoFilter.Reference = filterRange.RangeAddress.ToString(); foreach (var kp in xlAutoFilter.Filters) { var filterColumn = new FilterColumn {ColumnId = (UInt32)kp.Key - 1}; var xlFilterColumn = xlAutoFilter.Column(kp.Key); var filterType = xlFilterColumn.FilterType; if (filterType == XLFilterType.Custom) { var customFilters = new CustomFilters(); foreach (var filter in kp.Value) { var customFilter = new CustomFilter {Val = filter.Value.ToString()}; if (filter.Operator != XLFilterOperator.Equal) customFilter.Operator = filter.Operator.ToOpenXml(); if (filter.Connector == XLConnector.And) customFilters.And = true; customFilters.Append(customFilter); } filterColumn.Append(customFilters); } else if (filterType == XLFilterType.TopBottom) { var top101 = new Top10 {Val = (double)xlFilterColumn.TopBottomValue}; if (xlFilterColumn.TopBottomType == XLTopBottomType.Percent) top101.Percent = true; if (xlFilterColumn.TopBottomPart == XLTopBottomPart.Bottom) top101.Top = false; filterColumn.Append(top101); } else if (filterType == XLFilterType.Dynamic) { var dynamicFilter = new DynamicFilter {Type = xlFilterColumn.DynamicType.ToOpenXml(), Val = xlFilterColumn.DynamicValue}; filterColumn.Append(dynamicFilter); } else { var filters = new Filters(); foreach (var filter in kp.Value) { filters.Append(new Filter {Val = filter.Value.ToString()}); } filterColumn.Append(filters); } autoFilter.Append(filterColumn); } if (xlAutoFilter.Sorted) { var sortState = new SortState { Reference = filterRange.Range(filterRange.FirstCell().CellBelow(), filterRange.LastCell()).RangeAddress. ToString() }; var sortCondition = new SortCondition { Reference = filterRange.Range(1, xlAutoFilter.SortColumn, filterRange.RowCount(), xlAutoFilter.SortColumn).RangeAddress.ToString() }; if (xlAutoFilter.SortOrder == XLSortOrder.Descending) sortCondition.Descending = true; sortState.Append(sortCondition); autoFilter.Append(sortState); } }
static int SortByTime(Top10 a, Top10 b) { return(a.playerTime.CompareTo(b.playerTime)); }
public void AddTop10(Top10 top10) { }
public void AddTop10(Top10 top10) { _context.Top10.Add(top10); _context.SaveChanges(); }
public static void SeedDataBase(IServiceProvider serviceProvider) { var context = serviceProvider.GetRequiredService <CinePlusDBContext>(); if (!context.MovieType.Any()) { var type = new MovieType { Name = "Acción", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); type = new MovieType { Name = "Terror", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); type = new MovieType { Name = "Horror", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); type = new MovieType { Name = "Comedia", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); type = new MovieType { Name = "Drama", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); type = new MovieType { Name = "Aventura", MovieTypeId = Guid.NewGuid().ToString() }; context.MovieType.Add(type); context.SaveChanges(); } if (!context.Movie.Any()) { var movie = new Movie { Name = "Rápido y Furioso I", DateUpload = DateTime.Now, Description = "Película de Carrera de Autos, protagonizada por Paul Walker and Vin Diesel.", Director = "Rob Cohen", MovieType = context.MovieType.Where(x => x.Name == "Acción").FirstOrDefault(), MovieTypeId = context.MovieType.Where(x => x.Name == "Acción").FirstOrDefault().MovieTypeId, URL = "https://localhost:44304/img/movie.jpg", MovieId = Guid.NewGuid().ToString() }; context.Movie.Add(movie); context.SaveChanges(); movie = new Movie { Name = "Titanic", DateUpload = DateTime.Now, Description = "Película basada en hechos reales que relata los sucesos del zarpe, travesía y hundimiento del trasatlántico Titanic.", Director = "James Cameron", MovieType = context.MovieType.Where(x => x.Name == "Drama").FirstOrDefault(), MovieTypeId = context.MovieType.Where(x => x.Name == "Drama").FirstOrDefault().MovieTypeId, URL = "https://localhost:44304/img/movie.jpg", MovieId = Guid.NewGuid().ToString() }; context.Movie.Add(movie); context.SaveChanges(); movie = new Movie { Name = "The Curse of La Llorona", DateUpload = DateTime.Now, Description = "Es protagonizada por Linda Cardellini, Patricia Velásquez, Sean Patrick Thomas y Raymond Cruz. James Wan es el productor a través de su compañía Atomic Monster Productions.", Director = "Michael Chaves", MovieType = context.MovieType.Where(x => x.Name == "Terror").FirstOrDefault(), MovieTypeId = context.MovieType.Where(x => x.Name == "Terror").FirstOrDefault().MovieTypeId, URL = "https://localhost:44304/img/movie.jpg", MovieId = Guid.NewGuid().ToString() }; context.Movie.Add(movie); context.SaveChanges(); movie = new Movie { Name = "Ocho Apellidos Bascos", DateUpload = DateTime.Now, Description = "Relata la historia de amor entre una vasca y un sevillano a pesar de las diferencias políticas y culturales.", Director = "Emilio Martínez-Lázaro", MovieType = context.MovieType.Where(x => x.Name == "Comedia").FirstOrDefault(), MovieTypeId = context.MovieType.Where(x => x.Name == "Comedia").FirstOrDefault().MovieTypeId, URL = "https://localhost:44304/img/movie.jpg", MovieId = Guid.NewGuid().ToString() }; context.Movie.Add(movie); context.SaveChanges(); movie = new Movie { Name = "Harry Potter I", DateUpload = DateTime.Now, Description = "Relata la historia de un mago en la escuela de Howarts.", Director = "Chris Columbus", MovieType = context.MovieType.Where(x => x.Name == "Comedia").FirstOrDefault(), MovieTypeId = context.MovieType.Where(x => x.Name == "Comedia").FirstOrDefault().MovieTypeId, URL = "https://localhost:44304/img/movie.jpg", MovieId = Guid.NewGuid().ToString() }; context.Movie.Add(movie); context.SaveChanges(); } if (!context.Top10.Any()) { var top = new Top10 { Name = "Las más vistas", Top10Id = Guid.NewGuid().ToString() }; context.Top10.Add(top); context.SaveChanges(); } if (!context.MovieOnTop10.Any()) { var movieOnTop10 = new MovieOnTop10 { MovieOnTop10Id = Guid.NewGuid().ToString(), Top10 = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault(), Top10Id = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault().Top10Id, Movie = context.Movie.Where(x => x.Name == "Rápido y Furioso I").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Rápido y Furioso I").FirstOrDefault().MovieId, }; context.MovieOnTop10.Add(movieOnTop10); context.SaveChanges(); movieOnTop10 = new MovieOnTop10 { MovieOnTop10Id = Guid.NewGuid().ToString(), Top10 = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault(), Top10Id = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault().Top10Id, Movie = context.Movie.Where(x => x.Name == "Titanic").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Titanic").FirstOrDefault().MovieId, }; context.MovieOnTop10.Add(movieOnTop10); context.SaveChanges(); movieOnTop10 = new MovieOnTop10 { MovieOnTop10Id = Guid.NewGuid().ToString(), Top10 = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault(), Top10Id = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault().Top10Id, Movie = context.Movie.Where(x => x.Name == "The Curse of La Llorona").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "The Curse of La Llorona").FirstOrDefault().MovieId, }; context.MovieOnTop10.Add(movieOnTop10); context.SaveChanges(); movieOnTop10 = new MovieOnTop10 { MovieOnTop10Id = Guid.NewGuid().ToString(), Top10 = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault(), Top10Id = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault().Top10Id, Movie = context.Movie.Where(x => x.Name == "Ocho Apellidos Bascos").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Ocho Apellidos Bascos").FirstOrDefault().MovieId, }; context.MovieOnTop10.Add(movieOnTop10); context.SaveChanges(); movieOnTop10 = new MovieOnTop10 { MovieOnTop10Id = Guid.NewGuid().ToString(), Top10 = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault(), Top10Id = context.Top10.Where(x => x.Name == "Las más vistas").FirstOrDefault().Top10Id, Movie = context.Movie.Where(x => x.Name == "Harry Potter I").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Harry Potter I").FirstOrDefault().MovieId, }; context.MovieOnTop10.Add(movieOnTop10); context.SaveChanges(); } if (!context.Show.Any()) { var room = new Room { RoomId = Guid.NewGuid().ToString(), Name = "Principal", NoArmChairs = 200 }; var discount1 = new Discount { DiscountId = Guid.NewGuid().ToString(), Name = "Estudiantes de la FEU", Percent = 50 }; var discount2 = new Discount { DiscountId = "ninguno", Name = "Ninguno", Percent = 0 }; var show1 = new Show { Room = room, RoomId = room.RoomId, DateTime = DateTime.Now.AddHours(5), Price = 50, PriceInPoints = 20, ShowId = Guid.NewGuid().ToString(), Movie = context.Movie.Where(x => x.Name == "Rápido y Furioso I").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Rápido y Furioso I").FirstOrDefault().MovieId }; var discountByShow1 = new DiscountsByShow { Discount = discount1, DiscountId = discount1.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show1, ShowId = show1.ShowId }; var discountByShow2 = new DiscountsByShow { Discount = discount2, DiscountId = discount2.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show1, ShowId = show1.ShowId }; context.Discount.Add(discount1); context.Discount.Add(discount2); context.Show.Add(show1); context.DiscountsByShow.Add(discountByShow1); context.DiscountsByShow.Add(discountByShow2); context.SaveChanges(); var show2 = new Show { Room = room, RoomId = room.RoomId, DateTime = DateTime.Now.AddHours(5), Price = 20, PriceInPoints = 20, ShowId = Guid.NewGuid().ToString(), Movie = context.Movie.Where(x => x.Name == "Titanic").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Titanic").FirstOrDefault().MovieId }; discountByShow1 = new DiscountsByShow { Discount = discount1, DiscountId = discount1.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show2, ShowId = show2.ShowId }; discountByShow2 = new DiscountsByShow { Discount = discount2, DiscountId = discount2.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show2, ShowId = show2.ShowId }; context.Show.Add(show2); context.DiscountsByShow.Add(discountByShow1); context.DiscountsByShow.Add(discountByShow2); context.SaveChanges(); var show3 = new Show { Room = room, RoomId = room.RoomId, DateTime = DateTime.Now.AddHours(5), Price = 20, PriceInPoints = 20, ShowId = Guid.NewGuid().ToString(), Movie = context.Movie.Where(x => x.Name == "The Curse of La Llorona").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "The Curse of La Llorona").FirstOrDefault().MovieId }; discountByShow1 = new DiscountsByShow { Discount = discount1, DiscountId = discount1.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show3, ShowId = show3.ShowId }; discountByShow2 = new DiscountsByShow { Discount = discount2, DiscountId = discount2.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show3, ShowId = show3.ShowId }; context.Show.Add(show3); context.DiscountsByShow.Add(discountByShow1); context.DiscountsByShow.Add(discountByShow2); context.SaveChanges(); var show4 = new Show { Room = room, RoomId = room.RoomId, DateTime = DateTime.Now.AddHours(5), Price = 20, PriceInPoints = 20, ShowId = Guid.NewGuid().ToString(), Movie = context.Movie.Where(x => x.Name == "Ocho Apellidos Bascos").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Ocho Apellidos Bascos").FirstOrDefault().MovieId }; discountByShow1 = new DiscountsByShow { Discount = discount1, DiscountId = discount1.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show4, ShowId = show4.ShowId }; discountByShow2 = new DiscountsByShow { Discount = discount2, DiscountId = discount2.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show4, ShowId = show4.ShowId }; context.Show.Add(show4); context.DiscountsByShow.Add(discountByShow1); context.DiscountsByShow.Add(discountByShow2); context.SaveChanges(); var show5 = new Show { Room = room, RoomId = room.RoomId, DateTime = DateTime.Now.AddHours(5), Price = 20, PriceInPoints = 20, ShowId = Guid.NewGuid().ToString(), Movie = context.Movie.Where(x => x.Name == "Harry Potter I").FirstOrDefault(), MovieId = context.Movie.Where(x => x.Name == "Harry Potter I").FirstOrDefault().MovieId }; discountByShow1 = new DiscountsByShow { Discount = discount1, DiscountId = discount1.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show5, ShowId = show5.ShowId }; discountByShow2 = new DiscountsByShow { Discount = discount2, DiscountId = discount2.DiscountId, DiscountsByShowId = Guid.NewGuid().ToString(), Show = show5, ShowId = show5.ShowId }; context.Show.Add(show5); context.DiscountsByShow.Add(discountByShow1); context.DiscountsByShow.Add(discountByShow2); context.SaveChanges(); for (int i = 0; i < 200; i++) { var armChair = new ArmChair { ArmChairId = Guid.NewGuid().ToString(), No = i + 1 }; var armChairByRoom1 = new ArmChairByRoom { ArmChair = armChair, ArmChairByRoomId = Guid.NewGuid().ToString(), ArmChairId = armChair.ArmChairId, Room = room, RoomId = room.RoomId, StateArmChair = StateArmChair.ready, ShowId = show1.ShowId, Show = show1 }; var armChairByRoom2 = new ArmChairByRoom { ArmChair = armChair, ArmChairByRoomId = Guid.NewGuid().ToString(), ArmChairId = armChair.ArmChairId, Room = room, RoomId = room.RoomId, StateArmChair = StateArmChair.ready, ShowId = show2.ShowId, Show = show2 }; var armChairByRoom3 = new ArmChairByRoom { ArmChair = armChair, ArmChairByRoomId = Guid.NewGuid().ToString(), ArmChairId = armChair.ArmChairId, Room = room, RoomId = room.RoomId, StateArmChair = StateArmChair.ready, ShowId = show3.ShowId, Show = show3 }; var armChairByRoom4 = new ArmChairByRoom { ArmChair = armChair, ArmChairByRoomId = Guid.NewGuid().ToString(), ArmChairId = armChair.ArmChairId, Room = room, RoomId = room.RoomId, StateArmChair = StateArmChair.ready, ShowId = show4.ShowId, Show = show4 }; var armChairByRoom5 = new ArmChairByRoom { ArmChair = armChair, ArmChairByRoomId = Guid.NewGuid().ToString(), ArmChairId = armChair.ArmChairId, Room = room, RoomId = room.RoomId, StateArmChair = StateArmChair.ready, ShowId = show5.ShowId, Show = show5 }; context.ArmChair.Add(armChair); context.ArmChairByRoom.Add(armChairByRoom1); context.ArmChairByRoom.Add(armChairByRoom2); context.ArmChairByRoom.Add(armChairByRoom3); context.ArmChairByRoom.Add(armChairByRoom4); context.ArmChairByRoom.Add(armChairByRoom5); context.SaveChanges(); } } }
public override void Event(object sender, EventArgs e, Player player) { Top10 FormTop10 = new Top10(); FormTop10.Show(); }