public JsonResult GetHall(int hallId) { JsonResponseModel result = new JsonResponseModel(); try { if (hallId > 0) { _hallLogic = new HallLogic(); HALL hall = _hallLogic.GetEntityBy(c => c.Id == hallId); if (hall != null) { result.HallId = hall.Id; result.HallName = hall.Name; result.HallDescription = hall.Description; } result.IsError = false; } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public static List <SelectListItem> PopulateHallSelectListItem() { try { HallLogic hallLogic = new HallLogic(); List <HALL> halls = hallLogic.GetEntitiesBy(p => p.Active); if (halls == null || halls.Count <= 0) { return(new List <SelectListItem>()); } List <SelectListItem> selectItemList = new List <SelectListItem>(); SelectListItem list = new SelectListItem(); list.Value = ""; list.Text = Select; selectItemList.Add(list); foreach (HALL hall in halls) { SelectListItem selectList = new SelectListItem(); selectList.Value = hall.Id.ToString(); selectList.Text = hall.Name; selectItemList.Add(selectList); } return(selectItemList); } catch (Exception) { throw; } }
public HallIntegrationTests() { var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile())); _mapper = mockMapper.CreateMapper(); hallLogic = new HallLogic(new HallRepository(new DatabaseHall(new DatabaseConnection("Server = mssql.fhict.local; Database = dbi409997; User Id = dbi409997; Password = Ikbencool20042000!;"))), _mapper); }
public HallBasicsTests() { var mockMapper = new MapperConfiguration(cfg => cfg.AddProfile(new MappingProfile())); _mapper = mockMapper.CreateMapper(); hallLogic = new HallLogic(new HallContextMock(), _mapper); }
public JsonResult CreateHall(string name, string description) { JsonResponseModel result = new JsonResponseModel(); try { if (!string.IsNullOrEmpty(name)) { _hallLogic = new HallLogic(); HALL existingHall = _hallLogic.GetEntitiesBy(c => c.Name.ToLower().Trim() == name.ToLower().Trim()).LastOrDefault(); if (existingHall == null) { HALL maxHall = _hallLogic.GetAll().LastOrDefault(); int maxHallId = 0; if (maxHall != null) { maxHallId = maxHall.Id + 1; } else { maxHallId = 1; } existingHall = new HALL(); existingHall.Id = maxHallId; existingHall.Name = name; existingHall.Description = description; existingHall.Active = true; _hallLogic.Create(existingHall); result.IsError = false; result.Message = "Operation Successful!"; } else { result.IsError = true; result.Message = "Hall with the same name exists."; } } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult ManageHall() { _viewModel = new SetupViewModel(); _hallLogic = new HallLogic(); try { _viewModel.HallList = _hallLogic.GetEntitiesBy(c => c.Active); } catch (Exception) { throw; } return(View(_viewModel)); }
public JsonResult SaveHall(int hallId, string name, string description) { JsonResponseModel result = new JsonResponseModel(); try { if (hallId > 0 && !string.IsNullOrEmpty(name)) { _hallLogic = new HallLogic(); HALL hall = _hallLogic.GetEntityBy(c => c.Id == hallId); HALL existingHall = _hallLogic.GetEntitiesBy(c => c.Name.ToLower().Trim() == name.ToLower().Trim() && c.Id != hallId).LastOrDefault(); if (existingHall == null) { if (hall != null) { hall.Name = name; hall.Description = description; _hallLogic.Modify(hall); } result.IsError = false; result.Message = "Operation Successful!"; } else { result.IsError = true; result.Message = "Hall with the same name exists."; } } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public void Should_GetHallsFromTheList_WhenGettingHalls() { //Arrange var hallLogic = new HallLogic(new HallContextMock(), _mapper); HallModel hall = new HallModel { Id = 10, Price = 5, ScreenType = "GetTest", Seats = 30, SeatsTaken = 0 }; hallLogic.AddHall(hall); bool found = false; //Act if (hallLogic.GetHalls()[4].Id == 10 && hallLogic.GetHalls()[4].ScreenType == "GetTest") { found = true; } //Assert Assert.True(found); }
public JsonResult DeleteHall(int hallId) { JsonResponseModel result = new JsonResponseModel(); try { if (hallId > 0) { _hallLogic = new HallLogic(); EventLogic eventLogic = new EventLogic(); EVENT hallEvent = eventLogic.GetEntitiesBy(e => e.Hall_Id == hallId).LastOrDefault(); if (hallEvent == null) { _hallLogic.Delete(c => c.Id == hallId); result.IsError = false; result.Message = "Operation Successful!"; } else { result.IsError = true; result.Message = "Hall is already attached to an event, hence cannot be deleted"; } } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public static void Init(HallLogic login) { Instance = new HallRunTimeInfo(); Instance.m_login = login; }
public bool Init(ILogic logic, object obj) { m_Logic = (HallLogic)logic; SceneMain.Instance.StartInnerCoroutine(MainInitProcedure(null)); return(true); }