public static void insertTheater(string name, string address, string phone) { var context = new MovieTheaterEntities(); Theater tr = new Theater(); tr.Theater_Name = name; tr.Theater_Address = address; tr.Theater_Phone_No = phone; tr.Active_Indicator = true; tr.Update_Datetime = DateTime.Today; context.Theater.Add(tr); context.SaveChanges(); }
public void Then_a_specific_value_is_retrieved_by_a_number_of_pops(int[] valuesToPush, int numberOfPops, int expectedValueRetrievedByPop) { Theater theater = new Theater(); var promiseOfTheActualValue = new TaskCompletionSource<int>(); Address customer = null; Address stack = null; Given(() => { SetThe<IActorNamingService>().To(new InMemoryActorNamingService()); stack = theater.CreateActor(new StackNodeBehavior<int>(default(int), null)); foreach (var i in valuesToPush) { var push = new Push<int>(i); theater.Dispatch(push, stack); } customer = theater.CreateActor(new AssertionBehavior<int>(promiseOfTheActualValue, numberOfPops)); }); When(() => { for (var i = 0; i < numberOfPops; i++) { var pop = new Pop(customer); theater.Dispatch(pop, stack); } }); Then(async () => { var actualValue = await promiseOfTheActualValue.Task; actualValue.Should().Be(expectedValueRetrievedByPop); }); }
private void DrawScene() { var isPremium = Settings.IsPremiumUser(); var isColorAnimationOff = Settings.IsSceneColorAnimationDeactivated(); var scene = Scenes.CreateNew( _pageDataSource.Forecast, isPremium, isColorAnimationOff); Theater.Children.Add(scene); scene.Opacity = 0; Theater.Fade(1, 1000, 500).Start(); scene.Offset(0, 200, 0) .Then() .Fade(1, 1000) .Offset(0, 0, 1000) .SetDelay(500) .Start(); //Timer deffered = null; //deffered = new Timer(async (object state) => { // await _UIDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // if (_isSpecialSceneChecked) { deffered?.Dispose(); } // _isSpecialSceneChecked = true; // AddSpecialScene(); // }); //}, new AutoResetEvent(true), 3000, 2000); }
public void Then_factorial_of_x_is_calculated(int input, int expectedValue) { Theater theater = new Theater(); Address customer = null; var promiseOfTheActualValue = new TaskCompletionSource<CalculatedFactorial>(); Given(() => { customer = theater.CreateActor(new AssertionBehavior<CalculatedFactorial>(promiseOfTheActualValue, 1)); }); When(() => { var factorialCalculator = theater.CreateActor(new FactorialCalculationBehavior()); var calculateFactorialFor = new CalculateFactorialFor(input, customer); theater.Dispatch(calculateFactorialFor, factorialCalculator); }); Then(async () => { var calculatedFactorial = await promiseOfTheActualValue.Task; calculatedFactorial.Result.Should().Be(expectedValue); }); }
public IHttpActionResult GetFilteredTheaterJobs(int theaterId, [FromUri] string[] jobType, [FromUri] string[] position, int currentPage, int numberOfItems) { using (var dbcontext = new BroadwayBuilderContext()) { try { TheaterService theaterService = new TheaterService(dbcontext); Theater theater = theaterService.GetTheaterByID(theaterId); if (theater == null) { return(Content((HttpStatusCode)404, "There is no record of that Theater in our database")); } TheaterJobPostingService service = new TheaterJobPostingService(dbcontext); int count = 0; var list = service.FilterTheaterJobPostingsFromTheater(theaterId, jobType, position, currentPage, numberOfItems, out count); TheaterJobResponseList theaterJobResponseList = new TheaterJobResponseList(count, list); return(Content((HttpStatusCode)200, theaterJobResponseList)); } catch (Exception e) { return(Content((HttpStatusCode)400, e.Message)); } } }
public void GetShouldGetAllTheaters() { //Arrange var dbcontext = new BroadwayBuilderContext(); var theater = new Theater("createTheater", "Regal", "theater st", "LA", "CA", "US", "323323"); var service = new TheaterService(dbcontext); service.CreateTheater(theater); dbcontext.SaveChanges(); var controller = new TheaterController(); //Act var actionResult = controller.GetAllTheaters(); var response = actionResult as NegotiatedContentResult <IEnumerable>; var content = response.Content; //Assert Assert.IsNotNull(response); Assert.IsNotNull(response.Content); Assert.AreEqual((HttpStatusCode)200, response.StatusCode); service.DeleteTheater(theater); dbcontext.SaveChanges(); }
public void PostShouldAddTheater() { //Arrange var dbcontext = new BroadwayBuilderContext(); var theater = new Theater("createTheater", "Regal", "theater st", "LA", "CA", "US", "323323"); var service = new TheaterService(dbcontext); var controller = new TheaterController(); //Act var actionResult = controller.CreateTheater(theater); var response = actionResult as NegotiatedContentResult <string>; var content = response.Content; //Assert Assert.IsNotNull(response); Assert.IsNotNull(response.Content); Assert.AreEqual("Theater Created", content); Assert.AreEqual((HttpStatusCode)201, response.StatusCode); Theater gettheater = service.GetTheaterByName("createTheater"); service.DeleteTheater(gettheater); dbcontext.SaveChanges(); }
public async Task <IActionResult> Create([Bind("id,name,status,rows,cols")] Theater theater) { Customer cus = null; if (!Auth.isAdmin(HttpContext, ref cus)) { return(Unauthorized()); } ViewBag.customer = cus; if (ModelState.IsValid) { await _context.AddAsync(theater); await _context.SaveChangesAsync(); for (int i = 0; i < theater.rows; ++i) { for (int j = 0; j < theater.cols; ++j) { Seat seat = new Seat { r = i, c = j, theaterid = theater.id }; await _context.AddAsync(seat); } } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(theater)); }
public void WorldLoaded(World w, WorldRenderer wr) { theater = wr.Theater; render = new TerrainSpriteLayer(w, wr, theater.Sheet, BlendMode.Alpha, wr.Palette(info.Palette), wr.World.Type != WorldType.Editor); }
public void WorldLoaded(World w, WorldRenderer wr) { theater = wr.Theater; bi = w.WorldActor.Trait <BuildingInfluence>(); render = new TerrainSpriteLayer(w, wr, theater.Sheet, BlendMode.Alpha, wr.Palette(info.Palette), wr.World.Type != WorldType.Editor); }
public static Address Actor(BehaviorBase behavior, Theater theater) { return theater.CreateActor(behavior); }
public ActionResult Copy([Bind(Include = "ScheduleID")] Schedule schedule, DateTime datPickDate, Theater theaterPick, DateTime datCopyToDate, Theater theaterCopy) { // find object in database Schedule s = db.Schedules.Find(schedule.ScheduleID); var query = from sh in db.Showings select sh; // find showings in the correct schedule query = query.Where(c => c.Schedule.ScheduleID == schedule.ScheduleID); // find date to copy showing from query = query.Where(c => DbFunctions.TruncateTime(c.ShowDate) == datPickDate.Date); // find theater to copy from query = query.Where(c => c.Theater == theaterPick); List <Showing> SelectedShowings = query.ToList(); // restrict date to copy showing if (datCopyToDate.DayOfYear >= s.StartDate.DayOfYear && datCopyToDate.DayOfYear <= s.EndDate.DayOfYear) { if (ModelState.IsValid) { foreach (Showing showing in SelectedShowings) { Showing copyShowing = new Showing(); copyShowing.Theater = theaterCopy; copyShowing.Schedule = s; copyShowing.Movie = showing.Movie; copyShowing.StartHour = showing.StartHour; copyShowing.StartMinute = showing.StartMinute; copyShowing.ShowDate = datCopyToDate.AddHours(copyShowing.StartHour).AddMinutes(copyShowing.StartMinute).AddSeconds(0); copyShowing.EndTime = copyShowing.ShowDate.Add(copyShowing.Movie.Runtime); copyShowing.Special = showing.Special; Debug.WriteLine("1"); Debug.WriteLine(copyShowing.ShowingID); if (Utilities.ScheduleValidation.ShowingValidation(copyShowing) == "ok") { db.Showings.Add(copyShowing); db.SaveChanges(); Debug.WriteLine("2"); Debug.WriteLine(copyShowing.ShowingID); copyShowing.ShowingPrice = Utilities.DiscountPrice.GetBasePrice(copyShowing); Debug.WriteLine("3"); Debug.WriteLine(copyShowing.ShowingID); Debug.WriteLine(Utilities.DiscountPrice.GetBasePrice(copyShowing)); db.SaveChanges(); Debug.WriteLine("4"); Debug.WriteLine(copyShowing.ShowingID); } else { ViewBag.CopyOutofRange = Utilities.ScheduleValidation.ShowingValidation(copyShowing); return(View(schedule)); } } return(RedirectToAction("Details", "Schedules", new { id = schedule.ScheduleID })); } } else { ViewBag.CopyOutofRange = "The date to copy showings is out of the schedule's range. Choose a date within the schedule's range."; } return(View(schedule)); }
//새로운 영화 등록 protected void Button_New_Click(object sender, EventArgs e) { //TODO List: // 1. 새로운 영화의 ID를 지정하기위해 이전 영화의 MaxID 호출 // 2. 영화등록 // 3. 상영관의 좌석수를 얻기위해 값을 받아온다. // 4. 영화스케줄 등록 // 5. 영화 스케쥴당 좌석 생성 // 6. 이전화면으로 이동 string command = "Select Top 1 * From Movie Order by MovieID DESC"; String NewMovieID = "-1"; String Seatcount = "0"; String TheaterID = "0"; //상영관 ID String TheaterMaxRow = "0"; //상영관 최대 열 String TheaterMaxNumber = "0"; //상영관 최대 행 #region 1. 새로운 영화의 ID를 지정하기위해 이전 영화의 MaxID 호출 SqlDataReader reader = dbManager.GetDataList(command, new List <Tuple <string, object> >()); List <Movie> movies = Movie.SqlDataReaderToMember(reader); if (movies.Count == 0) { NewMovieID = "0"; } else if (movies.Count == 1) { //가장 큰 ID에 +1 해준값이 새로운 영화의 ID NewMovieID = (Convert.ToInt32(movies[0].MovieID.Trim(' ')) + 1).ToString(); } else { //영화 아이디 불러오기 실패 return; } #endregion #region 2. 영화등록 command = "insert into Movie(MovieID, Moviename, Playstartdatetime, Playenddatetime, Runningtime, Viewingclass, Movieposter)" + "values(@MovieID, @Moviename, @Playstartdatetime, @Playenddatetime, @Runningtime, @Viewingclass, @Movieposter)"; List <Tuple <string, object> > Params = new List <Tuple <string, object> >(); Params.Add(new Tuple <string, object>("@MovieID", NewMovieID)); Params.Add(new Tuple <string, object>("@Moviename", TextBox_Name.Text)); Params.Add(new Tuple <string, object>("@Playstartdatetime", TextBox_StartMovie.Text)); Params.Add(new Tuple <string, object>("@Playenddatetime", TextBox_endMovie.Text)); Params.Add(new Tuple <string, object>("@Runningtime", TextBox_RunningTIme.Text)); Params.Add(new Tuple <string, object>("@Viewingclass", TextBox_ViewingClass.Text)); if (this.FileUpload1.HasFile) { this.FileUpload1.SaveAs(HttpRuntime.AppDomainAppPath + "MoviePoster\\" + NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1]); //this.FileUpload1.SaveAs(Constant.MoviePosterPath + NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1]); } Params.Add(new Tuple <string, object>("@Movieposter", NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1])); if (!dbManager.DoCommand(command, Params)) { Console.WriteLine("영화 추가 에러"); return; } #endregion #region 3. 상영관의 좌석수를 얻기위해 값을 받아온다. Params.Clear(); TheaterID = Request[this.TextBox_TheaterNumber.UniqueID].Trim(); command = "Select * From Theater Where TheaterID = @TheaterID"; Params.Add(new Tuple <string, object>("@TheaterID", TheaterID)); reader = dbManager.GetDataList(command, Params); List <Theater> Theaters = Theater.SqlDataReaderToMember(reader); if (Theaters.Count != 1) { Console.WriteLine("같은 아이디의 극장이 여러개"); return; } Seatcount = Theaters[0].Seatcount; TheaterMaxRow = Theaters[0].Seatrowcount; TheaterMaxNumber = Theaters[0].Seatnumbercount; #endregion #region 4. 영화스케줄 등록 Params.Clear(); string[] stringSeparators = new string[] { "\r\n" }; string[] playtimes = TextBox_MoviePlayList.Text.Split(stringSeparators, StringSplitOptions.None); foreach (string playtime in playtimes) { command = "insert into Movieschedule(MovieID, TheaterID, Playtime, Seatbooked, Seatremained)" + "values(@MovieID, @TheaterID, @Playtime, @Seatbooked, @Seatremained)"; if (playtime == "") { continue; } Params.Add(new Tuple <string, object>("@MovieID", NewMovieID)); Params.Add(new Tuple <string, object>("@TheaterID", TheaterID)); Params.Add(new Tuple <string, object>("@Seatbooked", "0")); Params.Add(new Tuple <string, object>("@Seatremained", Seatcount)); Params.Add(new Tuple <string, object>("@Playtime", playtime.ToString())); //영화스케쥴 생성에 성공하였으니 5번:영화관스케쥴당좌석을 생성한다. if (dbManager.DoCommand(command, Params)) { #region 5. 영화 스케쥴당 좌석 생성 command = "insert into Seat(TheaterID, Seatrow, Seatnumber, Isbooked, Playtime)" + "values(@TheaterID, @Seatrow, @Seatnumber, @Isbooked, @Playtime)"; //A = 1, B = 2 ..... Z = 26 int I_TheaterMaxRow = Common.AlphabetToNumber(TheaterMaxRow); int I_TheaterMaxNumber = Convert.ToInt32(TheaterMaxNumber); for (int Seatrow = 1; Seatrow <= I_TheaterMaxRow; Seatrow++) //좌석 열수만큼 { for (int Seatnumber = 1; Seatnumber <= I_TheaterMaxNumber; Seatnumber++) //열당 좌석수만큼 { Params.Clear(); Params.Add(new Tuple <string, object>("@TheaterID", TheaterID)); Params.Add(new Tuple <string, object>("@Seatrow", Common.NumberToAlphabet(Seatrow))); Params.Add(new Tuple <string, object>("@Seatnumber", Seatnumber)); Params.Add(new Tuple <string, object>("@Isbooked", "false")); Params.Add(new Tuple <string, object>("@Playtime", playtime.ToString())); dbManager.DoCommand(command, Params); } } #endregion } Params.Clear(); } #endregion #region 6. 이전화면으로 이동 Response.Redirect(string.Format("MovieList.aspx")); #endregion }
public void CreateTheater(Theater theater) { theater.DateCreated = DateTime.Now; _dbContext.Theaters.Add(theater); }
public async Task UpdateTheater([FromBody] Theater theater) { await theatersRepository.UpdateTheaterAsync(theater); }
public static void MixMapImportSpecial(Theater theater, TemplateDoc tmpdCopyTerrain, string strFileSave) { TemplateDoc tmpd24 = (TemplateDoc)DocManager.NewDocument(typeof(TemplateDoc), new Object[] { new Size(24, 24) }); MixTemplate[] amixt = MixSuck.LoadTemplates(theater); MixSuck.ImportTemplates(amixt, tmpd24); Template[] atmpl24 = tmpd24.GetTemplates(); Template[] atmpl16 = tmpdCopyTerrain.GetTemplates(); for (int n = 0; n < atmpl24.Length; n++) { Template tmpl24 = atmpl24[n]; Template tmpl16 = atmpl16[n]; tmpl24.TerrainMap = tmpl16.TerrainMap; } tmpd24.SetBackgroundTemplate(atmpl24[0]); tmpd24.SaveAs(strFileSave); }
public void Update(Theater entity) { _theaterDal.Update(entity); }
public static MixTemplate[] LoadTemplates(Theater theater) { ArrayList alMagicTable = GetTemplateList(); MixReader mixr = new MixReader(s_astrTheaterFileNames[(int)theater]); // Load palette Stream stm = mixr.GetFileStream(s_idePalette[(int)theater] - 1); Color[] aclrPalette = LoadPalette(stm); stm.Close(); // Load templates ArrayList alsTemplates = new ArrayList(); foreach (MagicEntry me in alMagicTable) { if (me.aiTheater[(int)theater] == 0xff) { alsTemplates.Add(null); continue; } stm = mixr.GetFileStream(me.aiTheater[(int)theater] - 1); alsTemplates.Add(new MixTemplate(stm, me.ctx, me.cty, aclrPalette, me.index)); stm.Close(); } mixr.Dispose(); return (MixTemplate[])alsTemplates.ToArray(typeof(MixTemplate)); }
public IEnumerable <Theater> GetAllTheaters() { return(new List <Theater> { Theater.BuildStandardTheater() }); }
public async Task <Theater> AddTheater([FromBody] Theater theater) { var result = await theatersRepository.AddTheaterAsync(theater); return(result); }
public void Bids_Get__All_3() { // Arrange var theater = new Theater { Name = "Arena" }; _unitOfWork.Theaters.Add(theater); _unitOfWork.SaveChanges(); var user1 = Utils.GetTestUser(1); var user2 = Utils.GetTestUser(2); var user3 = Utils.GetTestUser(3); var user4 = Utils.GetTestUser(4); _unitOfWork.Users.AddRange(new[] { user1, user2, user3, user4 }); _unitOfWork.SaveChanges(); var userItem1 = new UserItem { TheaterId = theater.TheaterId, ISofAUserId = user1.Id, ExpirationDate = DateTime.Now.AddHours(2), Approved = true, Sold = false }; var userItem2 = new UserItem { TheaterId = theater.TheaterId, ISofAUserId = user1.Id, ExpirationDate = DateTime.Now.AddHours(2), Approved = true, Sold = false }; _unitOfWork.UserItems.AddRange(new[] { userItem1, userItem2 }); _unitOfWork.SaveChanges(); var bid1 = new Bid { Bidder = user2, UserItem = userItem1, BidDate = DateTime.Now, BidAmount = 50 }; var bid2 = new Bid { Bidder = user3, UserItem = userItem1, BidDate = DateTime.Now, BidAmount = 60 }; var bid3 = new Bid { Bidder = user4, UserItem = userItem1, BidDate = DateTime.Now, BidAmount = 70 }; var bid4 = new Bid { Bidder = user1, UserItem = userItem2, BidDate = DateTime.Now, BidAmount = 50 }; _unitOfWork.Bids.AddRange(new[] { bid1, bid2, bid3, bid4 }); _unitOfWork.SaveChanges(); // Act var bids1 = _bidService.GetAll(userItem1.UserItemId); var bids2 = _bidService.GetAll(userItem2.UserItemId); var bids3 = _bidService.GetAll(Guid.NewGuid()); // Arrange Assert.AreEqual(1, bids2.Count()); Assert.AreEqual(3, bids1.Count()); Assert.AreEqual(0, bids3.Count()); }
public Theater DeleteTheaterAgain(Theater theater) { Theater deletedTheater = _dbContext.Theaters.Remove(theater); return(deletedTheater); }
public ActionResult Create(Theater thtr) { m.theaters.Add(thtr); m.SaveChanges(); return(RedirectToAction("Index")); }
public void AddNewTheaterMovieOrShow() { Console.WriteLine("Press {0} : => Add Theater", (int)SubMenu.AddNewTheater); Console.WriteLine("Press {0} : => Add Movie", (int)SubMenu.AddNewMovie); Console.WriteLine("Press {0} : => Add Show", (int)SubMenu.AddShow); Console.Write("Enter Your Choice"); int option = Convert.ToInt16(Console.ReadLine()); switch (option) { case (int)SubMenu.AddNewTheater: Theater theater = new Theater(); Console.Write("Enter Theater Name :"); theater.SetName(Convert.ToString(Console.ReadLine())); Console.Write("Enter Theater Capacity :"); theater.SetCapacity(Convert.ToInt32(Console.ReadLine())); Console.Write("Enter Theater Location :"); theater.SetLoaction(Convert.ToString(Console.ReadLine())); tvm.AddToList(theater); Console.WriteLine("Theater Details has been added successfully"); break; case (int)SubMenu.AddNewMovie: Movie movie = new Movie(); Console.Write("Enter Movie Id :"); movie.SetId(Convert.ToInt32(Console.ReadLine())); Console.Write("Enter Movie Name :"); movie.SetName(Convert.ToString(Console.ReadLine())); Console.Write("Enter Movie Casting :"); movie.SetCasting(Convert.ToString(Console.ReadLine())); Console.Write("Enter Movie Director :"); movie.SetDirector(Convert.ToString(Console.ReadLine())); tvm.AddToList(movie); Console.WriteLine("Movie Details has been added successfully"); break; case (int)SubMenu.AddShow: Show show = new Show(); Console.Write("Enter Show Time :"); Console.WriteLine("------------------"); Console.WriteLine("Movies running in theater\n"); int movieCount = 1; foreach (var movies in tvm.GetAllMovies()) { Console.WriteLine("Press {0} For => {1} ", movieCount, movies.GetName()); movieCount++; } Console.Write("Enter Your Choice : "); int movieIndex = Convert.ToInt16(Console.ReadLine()); int theaterCount = 1; Console.WriteLine("--------------------------------"); foreach (var theaters in tvm.GetAllTheaters()) { Console.WriteLine("Press {0} to select => Theater :{1} Location : {2}", theaterCount, theaters.GetName(), theaters.GetLocation()); theaterCount++; } Console.Write("Enter Your Choice : "); int theaterIndex = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter Show Time / eg. 9:30 AM/1:30 PM/6:30 PM"); show.SetShowTime(Convert.ToString(Console.ReadLine())); show.SetMovie(tvm.movieList[movieIndex - 1]); show.SetTheater(tvm.theaterList[theaterIndex - 1]); tvm.AddToList(show); Console.WriteLine("Show details has been added succesfully"); break; default: Console.WriteLine("Wrong Option"); break; } }
public override void ChildDeserialize( GenericReader reader ) { int version = reader.ReadEncodedInt(); m_Theater = (Theater) reader.ReadEncodedInt(); }
public void Should_build_theater_from_file_topology() { var actual = new Theater(); Check.That(actual).IsNotNull(); }
private void DtoToTheater(TheaterDTO dto, Theater theater) { theater.Id = dto.Id; theater.TheaterName = dto.TheaterName; }
/// <summary>Detect map type.</summary> /// <param name="rules">The rules.ini file to be used.</param> /// <returns>The engine to be used to render this map.</returns> public static EngineType DetectEngineType(MapFile mf) { var vfsTS = new VFS(); var vfsFS = new VFS(); var vfsRA2 = new VFS(); var vfsYR = new VFS(); if (Directory.Exists(VFS.TSInstallDir)) { vfsTS.ScanMixDir(VFS.TSInstallDir, EngineType.TiberianSun); vfsFS.ScanMixDir(VFS.TSInstallDir, EngineType.Firestorm); } if (Directory.Exists(VFS.RA2InstallDir)) { vfsRA2.ScanMixDir(VFS.RA2InstallDir, EngineType.RedAlert2); vfsYR.ScanMixDir(VFS.RA2InstallDir, EngineType.YurisRevenge); } IniFile rulesTS = vfsTS.OpenFile <IniFile>("rules.ini"); IniFile rulesFS = vfsFS.OpenFile <IniFile>("rules.ini"); if (rulesFS != null) { rulesFS.MergeWith(vfsFS.OpenFile <IniFile>("firestrm.ini")); } IniFile rulesRA2 = vfsRA2.OpenFile <IniFile>("rules.ini"); IniFile rulesYR = vfsYR.OpenFile <IniFile>("rulesmd.ini"); TheaterType theater = Theater.TheaterTypeFromString(mf.ReadString("Map", "Theater")); TheaterSettings thsTS = ModConfig.DefaultsTS.GetTheater(theater); TheaterSettings thsFS = ModConfig.DefaultsFS.GetTheater(theater); TheaterSettings thsRA2 = ModConfig.DefaultsRA2.GetTheater(theater); TheaterSettings thsYR = ModConfig.DefaultsYR.GetTheater(theater); if (thsTS != null) { foreach (var f in thsTS.Mixes) { vfsTS.AddFile(f); } } if (thsFS != null) { foreach (var f in thsFS.Mixes) { vfsFS.AddFile(f); } } if (thsRA2 != null) { foreach (var f in thsRA2.Mixes) { vfsRA2.AddFile(f); } } if (thsYR != null) { foreach (var f in thsYR.Mixes) { vfsYR.AddFile(f); } } var ret = DetectEngineFromRules(mf, rulesTS, rulesFS, rulesRA2, rulesYR, thsTS, thsFS, thsRA2, thsYR, vfsTS, vfsFS, vfsRA2, vfsYR); Logger.Debug("Engine type detected as {0}", ret); return(ret); }
/// <summary> /// Initializes a new instance of the <see cref="TheaterControllerActivator" /> class. /// </summary> /// <param name="theater">The theater.</param> public TheaterControllerActivator(Theater theater) { _theater = theater; }
public void InitTheater() { switch ( Utility.Random( 3 ) ) { case 1: m_Theater = Theater.Britain; break; case 2: m_Theater = Theater.Nujelm; break; default: m_Theater = Theater.Jhelom; break; } }
public void ProductionService_GetProductionsByCurrentDate_Pass() { // Arrange // Arrange var dbcontext = new BroadwayBuilderContext(); var theaterService = new TheaterService(dbcontext); var theater = new Theater() { TheaterName = "The Language", StreetAddress = "Pantene", State = "CA", City = "LA", CompanyName = "123 Sesame St", Country = "US", PhoneNumber = "123456789" }; theaterService.CreateTheater(theater); dbcontext.SaveChanges(); var productionService = new ProductionService(dbcontext); var production1 = new Production() { ProductionName = "The Lion King 14", DirectorFirstName = "Joan", DirectorLastName = "Doe", Street = "123 Anahiem St", City = "Long Beach", StateProvince = "California", Country = "United States", Zipcode = "919293", TheaterID = theater.TheaterID }; productionService.CreateProduction(production1); dbcontext.SaveChanges(); var production2 = new Production() { ProductionName = "The Lion King 15", DirectorFirstName = "Joan", DirectorLastName = "Doe", Street = "123 Anahiem St", City = "Long Beach", StateProvince = "California", Country = "United States", Zipcode = "919293", TheaterID = theater.TheaterID }; productionService.CreateProduction(production2); dbcontext.SaveChanges(); var productionDateTime1 = new ProductionDateTime() { Date = DateTime.Parse("3/23/2019 3:22:29 PM"), Time = TimeSpan.Parse("10:30:00"), ProductionID = production1.ProductionID }; productionService.CreateProductionDateTime(production1.ProductionID, productionDateTime1); dbcontext.SaveChanges(); var productionDateTime2 = new ProductionDateTime() { Date = DateTime.Parse("3/29/2019 3:22:29 PM"), Time = TimeSpan.Parse("5:30:00"), ProductionID = production2.ProductionID }; productionService.CreateProductionDateTime(production2.ProductionID, productionDateTime2); dbcontext.SaveChanges(); var expected = true; var actual = false; // Act var readProductionsList = productionService.GetProductionsByCurrentAndFutureDate(new DateTime(2019, 3, 1), null, 1, 10); // Theater id is meant to be null if (readProductionsList != null) { actual = true; } // Assert productionService.DeleteProductionDateTime(productionDateTime2); dbcontext.SaveChanges(); productionService.DeleteProductionDateTime(productionDateTime1); dbcontext.SaveChanges(); productionService.DeleteProduction(production1.ProductionID); dbcontext.SaveChanges(); productionService.DeleteProduction(production2.ProductionID); dbcontext.SaveChanges(); theaterService.DeleteTheater(theater); dbcontext.SaveChanges(); Assert.AreEqual(expected, actual); }
public void AddOrUpdateTheater(Theater theater) { unitOfWork.Theaters.AddOrUpdate(theater); unitOfWork.Save(); }
public void ProductionService_UpdateProduction_Pass() { // Arrange var dbcontext = new BroadwayBuilderContext(); var theaterService = new TheaterService(dbcontext); var theater = new Theater() { TheaterName = "The Magicians", StreetAddress = "Pantene", State = "CA", City = "LA", CompanyName = "123 Sesame St", Country = "US", PhoneNumber = "123456789" }; theaterService.CreateTheater(theater); dbcontext.SaveChanges(); var productionService = new ProductionService(dbcontext); var production = new Production() { ProductionName = "The Lion King", DirectorFirstName = "Jane", DirectorLastName = "Doe", Street = "Anahiem", City = "Long Beach", StateProvince = "California", Country = "United States", Zipcode = "919293", TheaterID = theater.TheaterID }; productionService.CreateProduction(production); dbcontext.SaveChanges(); production.ProductionName = "The Lion King 2"; production.StateProvince = "Utah"; production.DirectorLastName = "Mangos"; var expected = new List <string>() { "The Lion King 2", "Utah", "Mangos" }; // Act var actual = productionService.UpdateProduction(production); dbcontext.SaveChanges(); // Assert productionService.DeleteProduction(production.ProductionID); dbcontext.SaveChanges(); theaterService.DeleteTheater(theater); dbcontext.SaveChanges(); Assert.AreEqual(expected[0], actual.ProductionName); Assert.AreEqual(expected[1], actual.StateProvince); Assert.AreEqual(expected[2], actual.DirectorLastName); }
private void TheaterToDto(Theater theater, TheaterDTO dto) { dto.Id = theater.Id; dto.TheaterName = theater.TheaterName; }
public void ProductionService_DeleteProductionDateTime_Pass() { // Arrange var dbcontext = new BroadwayBuilderContext(); var theaterService = new TheaterService(dbcontext); var theater = new Theater() { TheaterName = "The Magicians", StreetAddress = "Pantene", State = "CA", City = "LA", CompanyName = "123 Sesame St", Country = "US", PhoneNumber = "123456789" }; theaterService.CreateTheater(theater); dbcontext.SaveChanges(); var productionService = new ProductionService(dbcontext); var production = new Production { ProductionName = "The Pajama Game 1", DirectorFirstName = "Doris", DirectorLastName = "Day", City = "San Diego", StateProvince = "California", Country = "U.S", TheaterID = theater.TheaterID, Street = "1234 Sesame St", Zipcode = "91911" }; productionService.CreateProduction(production); dbcontext.SaveChanges(); var date = DateTime.Parse("3/28/2019 3:22:29 PM"); var time = TimeSpan.Parse("11:30:00"); var productionDateTime = new ProductionDateTime(production.ProductionID, date, time); productionService.CreateProductionDateTime(production.ProductionID, productionDateTime); dbcontext.SaveChanges(); var expected = true; var actual = false; // Act productionService.DeleteProductionDateTime(productionDateTime); var affectedRows = dbcontext.SaveChanges(); if (affectedRows > 0) { actual = true; } // Assert productionService.DeleteProduction(production.ProductionID); dbcontext.SaveChanges(); theaterService.DeleteTheater(theater); dbcontext.SaveChanges(); Assert.AreEqual(expected, actual); }
public override void ChildDeserialize(GenericReader reader) { int version = reader.ReadEncodedInt(); m_Theater = (Theater)reader.ReadEncodedInt(); }
public void ProductionService_SavePhotos_Pass() { // Arrange var dbcontext = new BroadwayBuilderContext(); var theaterService = new TheaterService(dbcontext); var theater = new Theater() { TheaterName = "Some Theater 1", StreetAddress = "Theater St", State = "CA", City = "LA", CompanyName = "Regal", Country = "US", PhoneNumber = "123456789" }; theaterService.CreateTheater(theater); dbcontext.SaveChanges(); var production = new Production() { ProductionName = "The Lion King 2", DirectorFirstName = "Jane", DirectorLastName = "Doe", Street = "Anahiem", City = "Long Beach", StateProvince = "California", Country = "United States", Zipcode = "919293", TheaterID = theater.TheaterID }; var productionService = new ProductionService(dbcontext); productionService.CreateProduction(production); dbcontext.SaveChanges(); var mockedPostedPdfFile = new MockPostedFile("jpg", 5000000, "productionPhotoTestFile.jpg"); var extension = Path.GetExtension(mockedPostedPdfFile.FileName); var currentDirectory = ConfigurationManager.AppSettings["FileDir"]; var dir = Path.Combine(currentDirectory, "Photos/"); var subdir = Path.Combine(dir, $"Production{production.ProductionID}/"); var filePath = Path.Combine(subdir, $"{production.ProductionID}-0{extension}"); var expected = true; var actual = false; // Act productionService.SavePhoto(production.ProductionID, mockedPostedPdfFile); if (File.Exists(filePath)) { actual = true; } // Assert productionService.DeleteProduction(production.ProductionID); dbcontext.SaveChanges(); theaterService.DeleteTheater(theater); dbcontext.SaveChanges(); File.Delete(filePath); Directory.Delete(subdir); Assert.AreEqual(expected, actual); }
public Customer GetNewCustomer(string firstName, string lastName, string phoneNumber, int ticketAmount, Theater theater) { var customer = new Customer { FirstName = firstName, LastName = lastName, PhoneNumber = phoneNumber }; for (int i = 0; i < ticketAmount; i++) { theater.OccupiedSeats += 1; customer.Tickets.Add(new Ticket { TheaterId = theater.Id, CustomerId = customer.Id, Seat = theater.OccupiedSeats, Wheelchair = theater.GotWheelchairRamp }); } context.Customers.Add(customer); context.SaveChanges(); return(customer); }
public DownloadSetting NewData() { int lastId; DownloadSetting lastData = de.DownloadSetting.OrderByDescending(p => p.Created).FirstOrDefault(); Theater threater = de.Theater.FirstOrDefault(); // 不能两条记录的创建时间一样,避免主键重复 if (lastData != null && lastData.Created == DateTime.Now) { throw new Exception(); } if (lastData != null) { lastId = lastData.DownloadId; } else { lastId = 0; } string newId; // 生成新的Id(这里长度是12位) try { newId = string.Format("{0:D12}", Convert.ToInt64(lastId) + 1); } catch { newId = string.Format("{0:D12}", 1); } DownloadSetting data = new DownloadSetting(); data.DownloadId = Convert.ToInt32(newId); //2011.12.24 LIN 判断是否存在id这一条数据 int id = data.DownloadId; while (IsCreated(id) != null) { id += 1; IsCreated(id); } data.DownloadId = id; // 更新数据基础值 data.Created = DateTime.Now; data.Updated = data.Created; data.ActiveFlag = true; // 更新非String类型的值,优化速度 data.TheaterId = threater.TheaterId; data.ProxyPort = 0; data.Port = 0; data.IsProxy = false; data.IsAnonymAllowed = false; de.DownloadSetting.AddObject(data); de.SaveChanges(); return(data); }