public InternalController(RoomService roomService, ILogger <InternalController> logger, SpotifyAccessService spotifyAccessService, DevicePersistenceService devicePersistenceService) { _roomService = roomService; _logger = logger; _spotifyAccessService = spotifyAccessService; _devicePersistenceService = devicePersistenceService; }
/// <summary> /// 修改房间信息 /// </summary> /// <param name="RoomID">修改的房间ID</param> /// <param name="RoomName">房间名</param> /// <param name="RoomType">房间类型</param> /// <param name="NumBed">床数</param> /// <param name="NumCust">最大人数</param> /// <param name="Status">状态</param> /// <param name="type">类型,从0-5</param> /// <returns></returns> public static int ChangeRoomValue(int RoomID, string RoomName, string RoomType, int NumBed, int NumCust, string Status, string desc, int type) { switch (type) { case 0: return(RoomService.ChangeRoom(RoomID, RoomName, -1, -1, "", -1, -1, 1)); case 1: int TypeID = RoomTypeService.GetRoomTypeList(RoomType, false)[0].TypeID; return(RoomService.ChangeRoom(RoomID, "", TypeID, -1, "", -1, -1, 2)); case 2: return(RoomService.ChangeRoom(RoomID, "", -1, -1, "", NumBed, -1, 5)); case 3: return(RoomService.ChangeRoom(RoomID, "", -1, -1, "", -1, NumCust, 6)); case 4: int StatusID = RoomStatusService.FindStatusByKeyword(Status, false)[0].RoomStatusID; return(RoomService.ChangeRoom(RoomID, "", -1, StatusID, "", -1, NumCust, 3)); case 5: return(RoomService.ChangeRoom(RoomID, "", -1, -1, desc, -1, -1, 4)); default: return(-1); } }
/// <summary> /// 添加新房间 /// </summary> /// <param name="RoomName"></param> /// <param name="RoomType"></param> /// <param name="NumBed"></param> /// <param name="NumCust"></param> /// <param name="Status"></param> /// <param name="desc"></param> /// <returns>返回1为插入成功,-1为拒绝插入</returns> public static int AddNewRoom(string RoomName, string RoomType, int NumBed, int NumCust, string Status, string desc) { int typeid = RoomTypeService.GetRoomTypeList(RoomType, false)[0].TypeID; int statusid = RoomStatusService.FindStatusByKeyword(Status, false)[0].RoomStatusID; return(RoomService.AddNewRoom(RoomName, typeid, statusid, desc, NumBed, NumCust)); }
public ActionResult Index(string id) { RoomService RoomService = new RoomService(); ViewData["id"] = id; return(View(RoomService.GetData().First(f => f.id == id))); }
public async Task <IActionResult> Index() { var roomService = new RoomService(new Repository <Room>(_context), _mapper); var rooms = await roomService.GetAll(); return(View(new RoomViewModel(rooms))); }
private void btnAddRoom_Click(object sender, EventArgs e) { if (txtRoomNo.TextLength > 6) { rn = new Room() { RoomNo = txtRoomNo.Text, RoomType = cboRoomType.SelectedIndex, RoomMoney = Convert.ToDecimal(txtMoney.Text), RoomPosition = txtRoomPosition.Text, }; RoomManager.InsertRoom(rn); MessageBox.Show("添加房间成功!"); dgvRoomList.DataSource = RoomService.SelectCanUseRoomAll(); #region 获取添加操作日志所需的信息 OperationLog o = new OperationLog(); o.OperationTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss")); o.Operationlog = AdminInfo.Account + AdminInfo.Name + "于" + DateTime.Now + "新增了房间,房间号为:" + txtRoomNo.Text + ",房间类型为:" + cboRoomType.Text; o.OperationAccount = AdminInfo.Account + AdminInfo.Name; #endregion OperationManager.InsertOperationLog(o); } else { MessageBox.Show("房间信息不完整,请重试!"); } }
protected override async Task Handle(CreateRoomServiceRequest request, CancellationToken cancellationToken) { var room = await _roomRepository.GetById(request.RoomId); if (room == null) { throw new RoomNotFoundException($"RoomId {request.RoomId.ToString()} does not exist."); } var employee = await _employeeRepository.GetById(request.EmployeeId); if (employee == null) { throw new EmployeeNotFoundException($"Employee {request.EmployeeId.ToString()} does not exist."); } var roomService = RoomService.CreateFor(RoomId.CreateFor(request.RoomId), EmployeeId.CreateFor(request.EmployeeId)); await eventStore.Save <RoomService, RoomServiceId>(roomService); //We send the integration events after transaction is ok. foreach (var @event in roomService.GetChanges()) { await _mediator.Publish(@event); } }
public PathController(RoomService roomService, EntityService entityService, NgonbLibraryService ngonbLibraryService) { _roomService = roomService; _entityService = entityService; _ngonbLibraryService = ngonbLibraryService; }
private async Task RoomTypeClick(IDialogContext context, IAwaitable <Activity> result) { var temp = await result; if (temp.Text != null && temp.Text.Length != 0) { await this.MessageReceived(context, result); return; } RoomType receivedRoom; using (RoomTypeService roomService = new RoomTypeService()) { receivedRoom = roomService.JsonToRoomType((Newtonsoft.Json.Linq.JObject)temp.Value); } IMessageActivity messageRooms; using (RoomService roomService = new RoomService()) { Activity activity = context.Activity as Activity; messageRooms = roomService.GetRoomsByRoomType(activity.CreateReply()); await context.PostAsync(messageRooms); context.Wait <Activity>(this.BookRoomClick); } }
void btnInsertBookingService_Click(object sender, RoutedEventArgs e) { RoomService service = uiServiceList.SelectedItem as RoomService; if (service != null && _selectedBookingId > 0) { List <BookingRoomService> list = (List <BookingRoomService>)gvwBookingService.ItemsSource; if (list.Count(i => i.ServiceId == service.ServiceId) > 0) { MessageBox.Show(ResourceHelper.GetReourceValue("Common_ItemExist")); } else { BookingRoomService newBookingService = new BookingRoomService(); newBookingService.BookingId = _selectedBookingId; newBookingService.ServiceId = service.ServiceId; newBookingService.Service = service.Service; newBookingService.IsChanged = true; newBookingService.Price = service.Price; newBookingService.Unit = service.Unit; newBookingService.Description = service.Description; list.Add(newBookingService); gvwBookingService.ItemsSource = null; gvwBookingService.ItemsSource = list; } } }
public SelectPageController(ILogger <SelectPageController> logger, ToolService toolService, RoomService roomService, IHttpContextAccessor httpContextAccessor) { _logger = logger; _toolService = toolService; _roomService = roomService; _httpContextAcessor = httpContextAccessor; }
public ActionResult DetailsRoomType(int id) { RoomService service = new RoomService(); var roomtype = service.GetRoomsTypes().FirstOrDefault(p => p.RoomTypeId == id); return(View(roomtype)); }
public async Task <RoomServiceDisplay> ToRoomServiceDisplay(RoomService roomService) { Room roomTask = null; Employee employeeTask = null; if (roomService.RoomId != null) { roomTask = await RoomRepository.GetRoom(roomService.RoomId.Value); } if (roomService.EmployeeId != null) { employeeTask = await EmployeeRepository.GetEmployee(roomService.EmployeeId.Value); } var roomServiceDisplay = new RoomServiceDisplay() { Id = roomService.Id, Ordered = roomService.Ordered, Type = roomService.Type }; if (employeeTask != null) { roomServiceDisplay.Employee = employeeTask; } if (roomTask != null) { roomServiceDisplay.Room = roomTask; } return(roomServiceDisplay); }
public void InitializeServices() { this.hubService = new Mock <ISignalRHubService>(); this.userService = new UserService(this.users); this.roomService = new RoomService(this.hubService.Object, this.rooms, this.users); this.roundService = new RoundService(this.hubService.Object, new TimerService(), this.rooms, this.rounds, this.users, this.decks); }
private void cmbRoomList_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbRoomList.SelectedIndex > 0) { RoomService service = new RoomService(); RoomDTO room = service.GetRoomDetail(Convert.ToInt32(cmbRoomList.SelectedValue)); lbRoomNumber.Text = room.RoomNumber.ToString(); lbRoomName.Text = room.RoomName; lbMaxOccupancy.Text = room.MaxOccupancy.ToString(); lbBaseRate.Text = room.BaseRate.ToString("C"); lbBedType.Text = room.BedType; lbRoomType.Text = room.RoomType; grpGuestInformation.Visible = true; } else { lbRoomNumber.Text = ""; lbRoomName.Text = ""; lbMaxOccupancy.Text = ""; lbBaseRate.Text = ""; lbBedType.Text = ""; lbRoomType.Text = ""; grpGuestInformation.Visible = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void UpdateGroup() { var request = new Mock <HttpRequest>(); var formCol = new FormCollection(new Dictionary <string, Microsoft.Extensions.Primitives.StringValues> { { "name", "GroupTest" }, { "teacherId", "testTeacher" }, { "roomId", "1" }, { "userIds", "[\"testUser1\",\"testUser2\"]" } }); request.Setup(req => req.Form).Returns(formCol); var group = RoomService.CreateGroup(_context, request.Object); formCol = new FormCollection(new Dictionary <string, Microsoft.Extensions.Primitives.StringValues> { { "groupId", group.GroupId.ToString() }, { "userIds", "[\"testUser\",\"testUser1\",\"testUser3\"]" } }); request.Setup(req => req.Form).Returns(formCol); group = RoomService.GroupUpdate(_context, request.Object); Assert.Equal("GroupTest", group.Name); Assert.Equal(3, group.UserIds.Count); }
public void GetGroupByRoomId() { var request = new Mock <HttpRequest>(); var formCol = new FormCollection(new Dictionary <string, Microsoft.Extensions.Primitives.StringValues> { { "name", "GroupTest" }, { "teacherId", "testTeacher" }, { "roomId", "1" }, { "userIds", "[\"testUser1\",\"testUser2\"]" } }); request.Setup(req => req.Form).Returns(formCol); var group = RoomService.CreateGroup(_context, request.Object); Assert.Equal("GroupTest", group.Name); Assert.Equal(2, group.UserIds.Count); Assert.Equal(group.StartTime, group.EndTime); var groups = RoomService.GetGroupByRoomId(_context, 1); Assert.Single(groups); Assert.Equal("GroupTest", groups[0].Name); Assert.Equal(2, groups[0].UserIds.Count); }
public void GetChatByROomId() { var chats = new List <RoomChat>(); chats.Add(new RoomChat() { Id = 1, RoomId = 1, UserId = "testUser", Date = DateTime.Now, Content = "testChat", Type = 1, }); chats.Add(new RoomChat() { Id = 2, RoomId = 1, UserId = "testUser", Date = DateTime.Now, Content = "testChat", Type = 1, }); chats.Add(new RoomChat() { Id = 3, RoomId = 1, UserId = "testUser", Date = DateTime.Now, Content = "testChat", Type = 1, }); foreach (var chat in chats) { RoomChatDAO.Create(_context, chat); } var rChats = RoomService.GetChatByRoomId(_context, 1); Assert.Equal(3, rChats.Count); }
public void RoomGetTest() { int id = 2; var room = DataForTests.Rooms[id - 1]; var toDTO = new MapperConfiguration( cfg => { cfg.CreateMap <Room, RoomDTO>().ReverseMap(); cfg.CreateMap <PriceCategory, PriceCategoryDTO>().ReverseMap(); cfg.CreateMap <Category, CategoryDTO>().ReverseMap(); }).CreateMapper(); var roomDTO = toDTO.Map <Room, RoomDTO>(room); EFWorkUnitMock.Setup(x => x.Rooms.Get(id)).Returns(room); RoomServiceMock.Setup(a => a.Get(id)).Returns(roomDTO); var roomService = new RoomService(EFWorkUnitMock.Object); RoomController controller = new RoomController(RoomServiceMock.Object, ReservationServiceMock.Object); var httpResponse = controller.Get(httpRequest, id); var result = httpResponse.Content.ReadAsAsync <RoomModel>(); RoomModel expected = mapper.Map <RoomDTO, RoomModel>(roomService.Get(id)); Assert.AreEqual(expected, result.Result); }
private void ucRoomList_DoubleClick(object sender, EventArgs e) { if (lblCustoNo.Text == "") { Room r = new RoomService().SelectRoomByRoomNo(lblRoomNo.Text); if (r.RoomStateId == 0) { rm_RoomNo = lblRoomNo.Text; FrmCheckIn frm = new FrmCheckIn(); frm.Show(); } else { return; } } else { rm_CustoNo = lblCustoNo.Text; rm_RoomNo = lblRoomNo.Text; rm_RoomType = lblRoomType.Text; FrmCheckOutForm frm = new FrmCheckOutForm(); frm.Show(); } }
public RoomFormPresenter(RoomForm form) { this.form = form; serviceFactory = new ServiceFactory(new PGRepositoryFactory()); service = serviceFactory.getRoomService(); sendToGrid(); }
public RoomController(RoomService roomService, IRepository <Booking> bookings, IRepository <Room> rooms, ILogger <BookingController> logger) { _logger = logger; _bookings = bookings; _rooms = rooms; _roomService = roomService; }
public RocketChat(string serverUrl) { IRestClient restClient = new RestClient(serverUrl); IJsonSerializer jsonSerializer = new JsonSerializer(); IAuthHelper authHelper = new AuthHelper(); IRestClientService restClientService = new RestClientService(authHelper, restClient, jsonSerializer); IFileRestClientService fileRestClientService = new FileRestClientService(authHelper, restClient, jsonSerializer); IAuthenticationService authService = new AuthenticationService(authHelper, restClientService); IChannelsService channelsService = new ChannelsService(restClientService); IGroupsService groupsService = new GroupsService(restClientService); IUsersService usersService = new UsersService(restClientService); IChatService chatService = new ChatService(restClientService); IRoomService roomService = new RoomService(restClientService); IAssetsService assetsService = new AssetsService(restClientService); IAutoTranslateService autoTranslateService = new AutoTranslateService(restClientService); ICommandsService commandsService = new CommandsService(restClientService); IEmojisService emojisService = new EmojisService(restClientService, fileRestClientService); Api = new RocketChatApi( chatService, usersService, groupsService, channelsService, authService, roomService, assetsService, autoTranslateService, commandsService, emojisService); }
private void FrmCheckIn_Load(object sender, EventArgs e) { txtRoomNo.Text = ucRoomList.rm_RoomNo; Room r = new RoomService().SelectRoomByRoomNo(txtRoomNo.Text); RoomType t = new RoomTypeService().SelectRoomTypeByRoomNo(txtRoomNo.Text); txtType.Text = t.RoomName; txtMoney.Text = r.RoomMoney.ToString(); txtRoomPosition.Text = r.RoomPosition; txtState.Text = r.RoomState; List <Custo> ctos = new CustoService().SelectCustoAll(); List <Room> roms = new RoomService().SelectCanUseRoomAll(); for (int i = 0; i < roms.Count; i++) { txtRoomNo.AutoCompleteCustomSource.Add(roms[i].RoomNo); } for (int j = 0; j < ctos.Count; j++) { txtCustoNo.AutoCompleteCustomSource.Add(ctos[j].CustoNo); } try { txtCustoNo.Text = ""; } catch { txtCustoNo.Text = ucRoomList.rm_CustoNo; } }
private void btnSearchRoom_Click(object sender, EventArgs e) { try { RoomService service = new RoomService(); List<RoomDTO> rooms = service.SearchAvailableRoomByDate(dtpStartDate.Value.Date, dtpEndDate.Value.Date); cmbRoomList.DataSource = null; if (rooms.Count() == 0) { cmbRoomList.DataSource = null; grpRoomSelection.Enabled = false; MessageBox.Show("There is no available room", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { grpRoomSelection.Enabled = true; rooms.Insert(0, new RoomDTO { RoomNumber = 0, RoomName = "-- Select a room --" }); cmbRoomList.DataSource = rooms; cmbRoomList.DisplayMember = "RoomName"; cmbRoomList.ValueMember = "RoomNumber"; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmRoomManager_Load(object sender, EventArgs e) { foreach (Control label in this.Controls) { if (label.GetType().ToString() == "Sunny.UI.UIButton") { label.Font = UI_FontUtil.SetChildControlsFont(); } } foreach (Control item in this.pnlRoomInfo.Controls) { if (item.GetType().ToString() == "System.Windows.Forms.Label") { item.Font = UI_FontUtil.SetChildControlsFont(); } } romsty = RoomService.SelectRoomAll(); for (int i = 0; i < romsty.Count; i++) { romt = new ucRoomList(this); romt.Tag = romsty[i].RoomNo; romt.romCustoInfo = romsty[i]; flpRoom.Controls.Add(romt); } }
private void AddRoom(object sender, RoutedEventArgs e) { var roomNumber = Number.Text; if (roomNumber.Length < 3) { MessageBox.Show($"You need to insert room number", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { try { var campus = AuthenticationManager.GetCurrentCampus(); Room room = new Room { Number = roomNumber, CampusId = campus.Id }; RoomService.AddRoomToCampus(room); MessageBox.Show($"Added room {room.Number} to {campus.Number} campus", "Information", MessageBoxButton.OK, MessageBoxImage.Information); //mw.Owner = this; this.Content = new AddRoomUserControl(); } catch (Exception ex) { MessageBox.Show($"{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
/// <summary> /// Конструктор класса SignalR хаба /// </summary> /// <param name="userService"> Сервис работы с пользователями </param> /// <param name="roomService"> Сервис работы с комнатами </param> /// <param name="deckService"> Сервис работы с колодами </param> /// <param name="hubService"> Сервис работы с хабом SignalR </param> public SignalRHub(UserService userService, RoomService roomService, DeckService deckService, ISignalRHubService hubService) { this.hubService = hubService; this.roomService = roomService; this.deckService = deckService; this.userService = userService; }
protected override async Task OnInitializedAsync() { SchedulerService.Appointments = await AppointmentService.ListAsync(); AppointmentTypes = await AppointmentTypeService.ListAsync(); Clients = await ClientService.ListAsync(); Rooms = await RoomService.ListAsync(); // Patients belong to Clients - This should be driven by the selected client Patients = await PatientService.ListAsync(ClientId); Patient = Patients.FirstOrDefault(p => p.PatientId == PatientId); Today = await ConfigurationService.ReadAsync(); StartDate = UpdateDateToToday(StartDate); DayStart = UpdateDateToToday(DayStart); DayEnd = UpdateDateToToday(DayEnd); Groups.Add("Rooms"); IsLoaded = true; await AddPatientImages(); await InitSignalR(); }
//Sau khi khách chọn loại phòng, khách được chọn tiếp phòng tương ứng của loại phòng //Chọn loại phòng xong thì quay trở lại hàm này. //Ở đây, ta lưu thông tin về RoomID vào reseration. //Sau khi có các thông tin cần thiết, ta lấy thông tin khách hàng. private async Task ResumeAfterRoomCategoryDialog(IDialogContext context, IAwaitable <object> result) { var message = await result; //if (message.Equals("ReMakeReservation")) //{ // var reservationDialog = new FormDialog<Reservation>(this.reservation, Reservation.BuildOrderForm, FormOptions.PromptInStart); // context.Call(reservationDialog, this.ResumeAfterReservationDialog); //} //else if (message.Equals("DontReMakeReservation")) //{ // await context.PostAsync("Tạm biệt quý khách!"); // context.Wait(this.MessageReceivedAsync); //} //else //{ //this.reservation = (message as ReservationAndRooms).Reservation; //this.reservation = message as Reservation; //this.ReservationAndRooms = message as ReservationAndRooms; this.ls = message as List <int>; //Tạo ReceiptCard để hỏi xem thông tin đã đúng chưa using (RoomService roomservice = new RoomService()) { //await context.PostAsync("Thông tin phòng:"); //foreach(int id in ls) //{ // rooms.Add(roomservice.GetRoomFromID(id)); //} ////this.room = roomservice.GetRoomFromID(reservation.RoomID); //StringBuilder stringBuilder = new StringBuilder(); //foreach (Room room in rooms) //{ // stringBuilder.Append(room.Name); // stringBuilder.Append("\n\n"); //} var receiptCard = new HeroCard { Title = "Thông tin dự kiến:", Text = "Ngày đến: " + reservation.CheckInDateTime.Date.ToString("dd/MM/yyyy") + "\n\nNgày đi: " + reservation.CheckOutDateTime.Date.ToString("dd/MM/yyyy") + "\n\nSố phòng: " + ls.Count.ToString() + "\n\n" + //stringBuilder.ToString() + "\n\nNgười lớn: " + reservation.Adult.ToString() + "\n\nTrẻ em: " + reservation.Child.ToString() }; Activity activity = context.Activity as Activity; IMessageActivity messageCard = activity.CreateReply(); messageCard.AttachmentLayout = AttachmentLayoutTypes.Carousel; messageCard.Attachments.Add(receiptCard.ToAttachment()); await context.PostAsync(messageCard); PromptDialog.Confirm(context, ConfirmedRoomReservation, "Thông tin này đã đúng chưa ạ?"); //} } //PromptDialog.Confirm(context, ConfirmedRoomReservation, "Thông tin này đã đúng chưa ạ?"); }
static void Main() { var locationService = new LocationService(); var locations = locationService.GetAll(); var location = locationService.GetById(locations[0].Id); var hotelService = new HotelService(); var hotel = hotelService.GetById(location.Hotels[0].Id); var roomService = new RoomService(); var room = roomService.GetById(hotel.Rooms[0].Id); var photoService = new PhotoService(); // Delete any existing photos foreach (var p in room.Photos) { photoService.Delete(p.Id); } Console.WriteLine("Adding photo to: {0}", room.Name); var photo = new Photo { Title = "A view of the room", Description = "A beautiful room with wonderful views of the neighbours walls", RoomId = room.Id }; const string roomPhoto = @"Pictures\roomview.jpg"; const string roomPhoto2 = @"Pictures\roomview_2.jpg"; photo.Data = ReadPhotoData(roomPhoto); photoService.Insert(photo); photo.Data = ReadPhotoData(roomPhoto2); photoService.Update(photo); }
void Start() { this.player = (Player) GameObject.FindGameObjectWithTag("Player").GetComponent("Player"); this.eventService = (EventService) this.gameObject.GetComponent("EventService"); this.eventService.successResponseHandler = new WebService.SuccessResponseHandler(this.HandleSendEventsSuccess); this.roomService = (RoomService) this.gameObject.GetComponent("RoomService"); if (PlayerPrefs.HasKey("avatar")) { Debug.Log(PlayerPrefs.GetString("avatar")); AvatarModel avatar = JsonMapper.ToObject<AvatarModel>(PlayerPrefs.GetString("avatar")); if (avatar != null) { this.player.AvatarId = avatar.avatar_id; this.player.Name = avatar.label; this.player.XP = avatar.GetAttributeValue("xp"); this.player.HP = avatar.GetAttributeValue("hp"); } } else { Debug.LogWarning("Started game with no avatar data."); } if (this.roomId != 0) { this.roomService.successResponseHandler = new WebService.SuccessResponseHandler(this.PopulateRoomContainers); this.roomService.GetRoom(this.roomId); } }