private void Context_BeginRequest(object sender, EventArgs e) { // Get the adapter for the 1.0 CoreRepository and store it in the HttpContext.Items collection. IWindsorContainer container = ContainerAccessorUtil.GetContainer(); CoreRepository cr = (CoreRepository)container["corerepositoryadapter"]; HttpContext.Current.Items.Add("CoreRepository", cr); }
public static SailsModule GetInstance() { CoreRepository CoreRepository = HttpContext.Current.Items["CoreRepository"] as CoreRepository; int nodeId = 1; Node node = (Node)CoreRepository.GetObjectById(typeof(Node), nodeId); int sectionId = 15; Section section = (Section)CoreRepository.GetObjectById(typeof(Section), sectionId); SailsModule module = (SailsModule)ContainerAccessorUtil.GetContainer().Resolve <ModuleLoader>().GetModuleFromSection(section); return(module); }
private void ReleaseModules() { List <ModuleBase> loadedModules = HttpContext.Current.Items["LoadedModules"] as List <ModuleBase>; if (loadedModules != null) { IWindsorContainer container = ContainerAccessorUtil.GetContainer(); foreach (ModuleBase module in loadedModules) { container.Release(module); } } }
public string RoomGetAvaiable(int roomClassId, int roomTypeId, int cruiseId, string startDate, int tripId) { CoreRepository CoreRepository = HttpContext.Current.Items["CoreRepository"] as CoreRepository; int nodeId = 1; Node node = (Node)CoreRepository.GetObjectById(typeof(Node), nodeId); int sectionId = 15; Section section = (Section)CoreRepository.GetObjectById(typeof(Section), sectionId); SailsModule module = (SailsModule)ContainerAccessorUtil.GetContainer().Resolve <ModuleLoader>().GetModuleFromSection(section); var roomClass = RoomServiceBLL.RoomClassGetById(roomClassId); var roomType = RoomServiceBLL.RoomTypeGetById(roomTypeId); var cruise = RoomServiceBLL.CruiseGetById(cruiseId); var trip = RoomServiceBLL.TripGetById(tripId); if (startDate == null) { return("Start date is required!"); } var startDateDT = DateTime.ParseExact(startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); return(module.RoomCount(roomClass, roomType, cruise, startDateDT, trip.NumberOfDay, trip.HalfDay).ToString()); }
/// <summary> /// Creates an HttpHandler for AjaxRequests and resolves the dispatchter from the IoC container /// </summary> public AjaxRequestHandler() { PortalContainer container = ContainerAccessorUtil.GetContainer(); this._dispatcher = container.Resolve <IAjaxRequestDispatcher>(); }
/// <summary> /// Constructor. /// </summary> public PortalPage() { this._container = ContainerAccessorUtil.GetContainer(); }
/// <summary> /// Constructor. /// </summary> public CuyahogaPage() { this._container = ContainerAccessorUtil.GetContainer(); }
public string GetAvaiableRoom(string ci, string sd, string ti, string SectionId, string NodeId) { CoreRepository CoreRepository = HttpContext.Current.Items["CoreRepository"] as CoreRepository; int nodeId = Int32.Parse(NodeId); Node node = (Node)CoreRepository.GetObjectById(typeof(Node), nodeId); int sectionId = Int32.Parse(SectionId); Section section = (Section)CoreRepository.GetObjectById(typeof(Section), sectionId); SailsModule module = (SailsModule)ContainerAccessorUtil.GetContainer().Resolve <ModuleLoader>().GetModuleFromSection(section); DateTime?startDate = null; try { startDate = DateTime.ParseExact(sd, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch { } var tripId = -1; try { tripId = Convert.ToInt32(ti); } catch { } var trip = AddSeriesBookingsBLL.TripGetById(tripId); var cruiseId = -1; try { cruiseId = Convert.ToInt32(ci); } catch { } var cruise = AddSeriesBookingsBLL.CruiseGetById(cruiseId); var listRoomClass = AddSeriesBookingsBLL.RoomClassGetAll(); var listRoomType = AddSeriesBookingsBLL.RoomTypeGetAll(); var listAvaiableRoomDTO = new List <AvaiableRoomDTO>(); foreach (var roomClass in listRoomClass) { foreach (var roomType in listRoomType) { if (trip == null) { break; } if (!startDate.HasValue) { break; } var roomCount = module.RoomCount(roomClass, roomType, cruise, startDate.Value, trip.NumberOfDay, true, trip.HalfDay); var avaiableRoomDTO = new AvaiableRoomDTO(); if (roomCount > -1) { avaiableRoomDTO.KindOfRoom = roomClass.Name + " " + roomType.Name; avaiableRoomDTO.RoomClass = new AvaiableRoomDTO.RoomClassDTO() { Id = roomClass.Id, Name = roomClass.Name }; avaiableRoomDTO.RoomType = new AvaiableRoomDTO.RoomTypeDTO() { Id = roomType.Id, Name = roomType.Name, }; var NoOfAdult = roomCount; avaiableRoomDTO.NoOfAdult = NoOfAdult; var NoOfChild = roomCount; avaiableRoomDTO.NoOfChild = NoOfChild; var NoOfBaby = roomCount; avaiableRoomDTO.NoOfBaby = NoOfBaby; listAvaiableRoomDTO.Add(avaiableRoomDTO); } } } Dispose(); return(JsonConvert.SerializeObject(listAvaiableRoomDTO)); }
public string CheckRoom(string sd, string ti, string SectionId, string NodeId) { CoreRepository CoreRepository = HttpContext.Current.Items["CoreRepository"] as CoreRepository; int nodeId = Int32.Parse(NodeId); Node node = (Node)CoreRepository.GetObjectById(typeof(Node), nodeId); int sectionId = Int32.Parse(SectionId); Section section = (Section)CoreRepository.GetObjectById(typeof(Section), sectionId); SailsModule module = (SailsModule)ContainerAccessorUtil.GetContainer().Resolve <ModuleLoader>().GetModuleFromSection(section); DateTime?startDate = null; try { startDate = DateTime.ParseExact(sd, "dd/MM/yyyy", CultureInfo.InvariantCulture); } catch { } var tripId = -1; try { tripId = Convert.ToInt32(ti); } catch { } var trip = AddSeriesBookingsBLL.TripGetById(tripId); var listRoomClass = AddSeriesBookingsBLL.RoomClassGetAll(); var listRoomType = AddSeriesBookingsBLL.RoomTypeGetAll(); var listCruise = AddSeriesBookingsBLL.CruiseGetAllByTrip(trip); var listCheckRoomResultDTO = new List <CheckRoomResultDTO>(); foreach (var cruise in listCruise) { var checkRoomResultDTO = new CheckRoomResultDTO(); checkRoomResultDTO.Cruise = new CheckRoomResultDTO.CruiseDTO() { Id = cruise.Id, Name = cruise.Name }; int total = 0; string detail = ""; foreach (var roomClass in listRoomClass) { foreach (var roomType in listRoomType) { if (trip == null) { break; } if (!startDate.HasValue) { break; } int avail = module.RoomCount(roomClass, roomType, cruise, startDate.Value, trip.NumberOfDay, trip.HalfDay); if (avail > 0) { total += avail; detail += string.Format("{0} {2} {1} ", avail, roomType.Name, roomClass.Name); } } } checkRoomResultDTO.NoOfRoomAvaiable = total; checkRoomResultDTO.DetailRooms = detail; listCheckRoomResultDTO.Add(checkRoomResultDTO); } Dispose(); return(JsonConvert.SerializeObject(listCheckRoomResultDTO)); }
public WebServiceBase(string className) { _container = ContainerAccessorUtil.GetContainer(); _moduleLoader = Container.Resolve <ModuleLoader>(); _module = _moduleLoader.GetModuleFromClassName(className); }