public RoomController() { _roomDao = new RoomDao(); _environmentDao = new EnvironmentDao(); _roomCategoryDao = new RoomCategoryDao(); _environments = _environmentDao.GetAll().ToList(); }
public ActionResult Edit(int id) { RoomDao roomDao = new RoomDao(); Room room = roomDao.GetById(id); return(View(room)); }
public ActionResult Add(Room room) { try { if (ModelState.IsValid) { RoomDao rDao = new RoomDao(); if (rDao.RoomExist(room.Name) == false) { rDao.Create(room); } else { TempData["warning"] = "Stroj pod tímto názvem již existuje!"; return(View("Create", room)); } TempData["succes"] = "Místnost úspěšně přidána."; } else { return(View("Create", room)); } } catch (Exception e) { Console.WriteLine(e); throw; } return(RedirectToAction("Index")); }
//pridat upozorneni pro vypsane teminy public ActionResult Delete(int id) { try { RoomDao rDao = new RoomDao(); Room r = rDao.GetById(id); //je zapotřebí smazat nejdrive vsechny terminy v teto mistnosti, a take rezervace na tyto terminy TermDao tDao = new TermDao(); ReservationDao resDao = new ReservationDao(); IList <Term> terms = tDao.GetTermsByRoom(r); foreach (Term t in terms) { IList <Reservation> reservations = resDao.GetAllReservationsByTerm(t); foreach (Reservation res in reservations) { resDao.Delete(res); } tDao.Delete(t); } rDao.Delete(r); TempData["succes"] = "Místnost " + r.Name + " byla odstraněna, stejně tak i všechny termíny v této místnosti."; } catch (Exception e) { Console.WriteLine(e); throw; } return(RedirectToAction("Index")); }
public ActionResult Update(Room room) { try { if (ModelState.IsValid) { RoomDao rDao = new RoomDao(); Room.CapacityCheck(room); rDao.Update(room); TempData["succes"] = "Místnost úspěšně upravena."; } else { return(View("Edit", room)); } } catch (Exception e) { Console.WriteLine(e); throw; } return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> Put(int id, [FromBody] RoomType update) { if (update.pretPeNoapte == 0) { return(BadRequest("The price cannot be 0")); } if (update.tipCamera == "") { return(BadRequest("The room type cannot be blank")); } if (update.camereDisponibile == 0) { return(BadRequest("The room's number cannot be 0")); } var code = await RoomDao.updateRoomTypeAsync(id, update); if (code == 1) { return(Ok("Room type updated")); } else if (code == 0) { return(NotFound()); } else { return(Content(HttpStatusCode.InternalServerError, "Error occured")); } }
public ActionResult Delete(int id) { try { RoomDao roomDao = new RoomDao(); Room room = roomDao.GetById(id); // TomSko: ještě předtím, než vyčistím jméno, je potřeba, abych smazal starý soubor if (room.IllustrationImageName != null) { System.IO.File.Delete(Server.MapPath("~/uploads/roomImage/" + room.IllustrationImageName)); } // TomSko: ještě předtím, než vyčistím jméno, je potřeba, abych smazal starý soubor if (room.IllustrationThumbImageName != null) { System.IO.File.Delete(Server.MapPath("~/uploads/roomThumbImage/" + room.IllustrationThumbImageName)); } roomDao.Delete(room); TempData["message-success"] = "Místnost " + room.Name + " byla úspěšně smazána."; } catch (Exception) { // mechanismus zachytávání výjimek doporučuje dobře si nastudovat throw; } return(RedirectToAction("Index")); }
public ActionResult Create(Room room) { if (ModelState.IsValid) { var dao = new RoomDao(); //lấy id trong session đăng nhập của quản trị lưu vào phiên tạo mới user var session = (UserLogin)Session[CommonConstants.USER_SESSION]; room.CreatedBy = session.UserName; room.CreatedDate = DateTime.Now; long id = dao.Insert(room); if (id > 0) { SetAlert("Thêm chấm công nhân viên thành công", "success"); return(RedirectToAction("Index", "Room")); } else { ModelState.AddModelError("", "Thêm chấm nhân viên công không thành công"); } } SetViewDepartment(); SetAlert("Error", "error"); return(RedirectToAction("Index", "Room")); }
public async Task <IHttpActionResult> Post([FromBody] RoomType room) { try { if (room.pretPeNoapte == 0) { return(BadRequest("The price cannot be 0")); } if (room.tipCamera == "") { return(BadRequest("The room type cannot be blank")); } if (room.camereDisponibile == 0) { return(BadRequest("The room's number cannot be 0")); } if (await RoomDao.addRoomTypeAsync(room) == 1) { return(Content(HttpStatusCode.Created, "Room type created")); } else { return(Content(HttpStatusCode.InternalServerError, "Error occured")); } } catch (NullReferenceException e) { return(Content(HttpStatusCode.BadRequest, e)); } }
public ActionResult Edit(int id) { var room = new RoomDao().ViewDetail(id); SetViewDepartment(); return(View(room)); }
public async Task <IActionResult> DeleteRoom(int id) { var data = new RoomDao().Delete(id); var value = await new RoomDao().GeList(); return(RedirectToAction("Rooms", value)); }
/// <summary> /// Load game data /// </summary> private static void tryGameData() { ValueManager.Instance.Load(); ItemManager.Instance.Load(); CatalogueManager.Instance.Load(); RoomManager.Instance.Load(); NavigatorManager.Instance.Load(); MessageHandler.Instance.Load(); /*int defId = 2300; * foreach (int fx in "1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23,24,25,26,27,28,29,3,4,5,6,7,8,9,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140".ToIntArray(',')) * { * if (fx > 26) * { * if (fx != 28 && fx != 29 && fx != 30 && fx != 33 && fx != 34 && fx != 35 && fx != 36 && fx != 37 && fx != 38 && fx != 39 && fx != 40 && fx != 41 && fx != 42 && fx != 43 * && fx != 45 && fx != 46 && fx != 49 && fx != 50 && fx != 51 && fx != 52 && fx != 55 && fx != 56 && fx != 57 && fx != 58 && fx != 68 && fx != 77 && fx != 65 && fx != 96 && fx != 97 && fx != 98 * && fx != 101 && fx != 102 && fx != 103 && fx != 95) { * defId++; * Console.WriteLine($"INSERT INTO `catalogue_items` (`sale_code`, `page_id`, `order_id`, `price_coins`, `price_pixels`, `hidden`, `amount`, `definition_id`, `item_specialspriteid`, `is_package`) VALUES ('avatar_effect{fx}', '60', 1, 0, 89, 0, 1, {defId}, '{fx}', 0);"); * Console.WriteLine($"INSERT INTO `item_definitions` (`id`, `sprite`, `name`, `description`, `sprite_id`, `length`, `width`, `top_height`, `max_status`, `behaviour`, `interactor`, `is_tradable`, `is_recyclable`, `drink_ids`, `rental_time`) VALUES ({defId}, 'avatar_effect{fx}', NULL, NULL, {fx}, 0, 0, 0, '0', 'effect,requires_rights_for_interaction', 'default', 1, 1, '', -1);"); * } * } * }*/ RoomDao.ResetVisitorCounts(); }
public ActionResult Edit(int id) { RoomDao rDao = new RoomDao(); ViewBag.Mark = "Room"; return(View(rDao.GetById(id))); }
public void Handle(Player player, Request request) { var roomList = RoomManager.SortRooms( RoomManager.Instance.ReplaceQueryRooms(RoomDao.GetUserRooms(player.Details.Id)) ); player.Send(new FlatListComposer(2, roomList, null)); }
public EquipmentController() { _roomDao = new RoomDao(); _environmentDao = new EnvironmentDao(); _equipmentDao = new EquipmentDao(); _equipmentCategoryDao = new EquipmentCategoryDao(); _equipmentStatusDao = new EquipmentStatusDao(); }
public void Handle(Player player, Request request) { var roomList = RoomManager.Instance.ReplaceQueryRooms( RoomDao.GetPopularFlats() ); player.Send(new FlatListComposer(2, roomList, NavigatorManager.Instance.GetPopularPromotion())); }
public ActionResult Create(Phong model) { if (ModelState.IsValid) { var dao = new RoomDao(); } return(View(model)); }
public void Handle(Player player, Request request) { var roomList = RoomManager.SortRooms( RoomManager.Instance.ReplaceQueryRooms(RoomDao.SearchTags(request.ReadString())) ); player.Send(new FlatListComposer(2, roomList, null)); }
internal static RoomDao getRoom() { if (roomDao == null) { roomDao = new RoomDao(ConnectionProvider.getProvide()); } return(roomDao); }
// GET: Admin/Room public ActionResult Index() { RoomDao rDao = new RoomDao(); IList <Room> r = rDao.GetAll(); ViewBag.Mark = "Room"; return(View(r)); }
public ActionResult Index(string searchString, int page = 1, int pageSize = 10) { var session = (UserLogin)Session[CommonConstants.USER_SESSION]; var dao = new RoomDao(); var model = dao.ListAllPaging(searchString, page, pageSize, session.DepartmentID); ViewBag.SearchString = searchString; return(View(model)); }
public bool Update(Room Room) { if (string.IsNullOrEmpty(Room.ID)) { throw new Exception("没有房间ID"); } ISqlMapper mapper = MapperHelper.GetMapper(); RoomDao dao = new RoomDao(mapper); return dao.Update(new RoomUpdateForm { Entity = Room, RoomQueryForm = new RoomQueryForm { ID = Room.ID } }); }
public bool Delete(string id) { if (string.IsNullOrEmpty(id)) { throw new Exception("没有房间ID"); } ISqlMapper mapper = MapperHelper.GetMapper(); RoomDao dao = new RoomDao(mapper); return dao.Delete(new RoomQueryForm { ID = id }); }
public ControlController() { _userDao = new UserDao(); _roomDao = new RoomDao(); _environmentDao = new EnvironmentDao(); _controlDao = new ControlDao(); _controlStatusDao = new ControlStatusDao(); _controlCategoryDao = new ControlCategoryDao(); _equipmentDao = new EquipmentDao(); }
public TicketController() { _ticketDao = new TicketDao(); _ticketCategoryDao = new TicketCategoryDao(); _ticketStatusDao = new TicketStatusDao(); _userDao = new UserDao(); _environmentDao = new EnvironmentDao(); _equipmentDao = new EquipmentDao(); _roomDao = new RoomDao(); }
public void Handle(Player player, Request request) { int maxRoomsAllowed = ValueManager.Instance.GetInt("max.rooms.allowed"); if (player.IsSubscribed) maxRoomsAllowed = ValueManager.Instance.GetInt("max.rooms.allowed.subscribed"); player.Send(new CanCreateRoomComposer( maxRoomsAllowed >= RoomDao.CountUserRooms(player.Details.Id), maxRoomsAllowed) ); }
public async Task <IHttpActionResult> Get(int id) { var found = await RoomDao.findRoomTypeByIdAsync(id); if (found == null) { return(NotFound()); } else { return(Ok(found)); } }
// GET: /Rooms/ public ActionResult Index(int?page) { const int itemsOnPage = 6; int pg = page.HasValue ? page.Value : 1; int totalRooms; RoomDao roomDao = new RoomDao(); IList <Room> listRoomsPerPage = roomDao.GetRoomsPaged(itemsOnPage, pg, out totalRooms); ViewBag.Pages = (int)Math.Ceiling((double)totalRooms / (double)itemsOnPage); ViewBag.CurrentPage = pg; return(View("Index", listRoomsPerPage)); }
public void Handle(Player player, Request request) { var room = player.RoomUser.Room; if (room == null) { return; } room.Data.IsMuted = !room.Data.IsMuted; player.Send(new RoomMuteSettingsComposer(room.Data.IsMuted)); RoomDao.SaveRoom(room.Data); }
/// <summary> /// Get room instance, else return newly created instance if room exists /// </summary> public Room GetRoom(int roomId) { if (Rooms.TryGetValue(roomId, out var room)) { return(room); } var data = RoomDao.GetRoomData(roomId); if (data != null) { return(new Room(data)); } return(null); }
private void FrmRoomManager_Load(object sender, EventArgs e) { romsty = RoomDao.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); } lblCanUse.Text = RoomService.SelectCanUseRoomAllByRoomState().ToString(); lblCheck.Text = RoomService.SelectNotUseRoomAllByRoomState().ToString(); lblNotClear.Text = RoomService.SelectNotClearRoomAllByRoomState().ToString(); lblFix.Text = RoomService.SelectFixingRoomAllByRoomState().ToString(); }
public ActionResult SelectKTV(int page = 1, int pageSize = 10) { var dao = new EmployeeDao(); var session = (UserLogin)Session[CommonConstants.USER_SESSION]; string searchString = null; var model = dao.ListAllPagingKTVStatus(searchString, page, pageSize, session.DepartmentID, "KTV"); List <TimerModel> list = new List <TimerModel>(); WebAppDbContext db = new WebAppDbContext(); var daoRoom = new RoomDao(); var modelRoom = daoRoom.ListAllPaging(searchString, page, pageSize, session.DepartmentID); var rooms = modelRoom; foreach (var item in rooms) { DateTime now = DateTime.Now; foreach (var temp in item.OrderDetails.Where(x => x.DailyList.Status == true).OrderByDescending(x => x.ID).Take(1)) { if (temp.DailyEmployees.Sum(x => x.Tip) < 1) { foreach (var ktv in temp.DailyEmployees) { list.Add(new TimerModel { Name = ktv.Employee.Code, ReleaseDateTime = temp.TimeOut.Subtract(new DateTime(1970, 1, 1).AddHours(7)).TotalMilliseconds, Message = string.Concat(item.Name, " hết giờ") }); } } } } ViewBag.UserGroup = session.GroupID; ViewBag.TimerList = list; ViewBag.SearchString = searchString; return(View(model)); }
public string Add(Room Room) { ISqlMapper mapper = MapperHelper.GetMapper(); RoomDao dao = new RoomDao(mapper); return dao.Add(Room); }
public List<Room> Query(RoomQueryForm form) { ISqlMapper mapper = MapperHelper.GetMapper(); RoomDao dao = new RoomDao(mapper); return dao.Query(form); }