Пример #1
0
        public RoomMutation()
        {
            Field <NonNullGraphType <RoomType> >(
                _Creation,
                "Tạo và trả về một phòng mới",
                _InputArgument <RoomCreateInput>(),
                _CheckPermission_TaskObject(
                    p => p.PermissionManageMap,
                    context => RoomBusiness.Add(_GetInput(context))
                    )
                );

            Field <NonNullGraphType <RoomType> >(
                _Updation,
                "Cập nhật và trả về một phòng vừa cập nhật",
                _InputArgument <RoomUpdateInput>(),
                _CheckPermission_TaskObject(
                    p => p.PermissionManageMap,
                    context => RoomBusiness.Update(_GetInput(context))
                    )
                );

            Field <NonNullGraphType <StringGraphType> >(
                _Deletion,
                "Xóa một phòng",
                _IdArgument(),
                _CheckPermission_String(
                    p => p.PermissionManageMap,
                    context =>
            {
                RoomBusiness.Delete(_GetId <int>(context));
                return("Xóa thành công");
            }
                    )
                );

            Field <NonNullGraphType <StringGraphType> >(
                _SetIsActive,
                "Cập nhật trạng thái hoạt động của một phòng",
                new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id"
            },
                    new QueryArgument <NonNullGraphType <BooleanGraphType> > {
                Name = "isActive"
            }
                    ),
                _CheckPermission_String(
                    p => p.PermissionManageMap,
                    context =>
            {
                var id       = context.GetArgument <int>("id");
                var isActive = context.GetArgument <bool>("isActive");
                RoomBusiness.SetIsActive(id, isActive);
                return("Cập nhật trạng thái thành công");
            }
                    )
                );
        }
Пример #2
0
        public Room GetManaged()
        {
            var room = RoomBusiness.Get(Id);

            if (room == null)
            {
                throw new Exception("Mã phòng không tồn tại");
            }
            return(room);
        }
Пример #3
0
 protected View()
 {
     ClientRepository  = new Repository <ClientEntity>();
     RoomRepository    = new Repository <RoomEntity>();
     BookingRepository = new Repository <BookingEntity>();
     ClientBusiness    = new ClientBusiness(ClientRepository);
     RoomBusiness      = new RoomBusiness(RoomRepository);
     HotelBusiness     = new HotelBusiness(RoomRepository);
     BookingBusiness   = new BookingBusiness(RoomRepository, BookingRepository);
     BookingServices   = new BookingServices(BookingBusiness, ClientBusiness, RoomBusiness);
     RoomServices      = new RoomServices(RoomBusiness);
     ClientServices    = new ClientServices(ClientBusiness);
     HotelServices     = new HotelServices(HotelBusiness);
 }
Пример #4
0
        public RoomQuery()
        {
            Field <NonNullGraphType <ListGraphType <NonNullGraphType <RoomType> > > >(
                _List,
                "Trả về một danh sách các phòng",
                resolve: _CheckPermission_List(
                    p => p.PermissionGetMap,
                    context => RoomBusiness.Get()
                    )
                );

            Field <NonNullGraphType <RoomType> >(
                _Item,
                "Trả về thông tin của một phòng",
                _IdArgument(),
                _CheckPermission_Object(
                    p => p.PermissionGetMap,
                    context => RoomBusiness.Get(_GetId <int>(context))
                    )
                );
        }
Пример #5
0
        static void Main(string[] args)
        {
            string options = "";

            UserInterface userInterface = new UserInterface();

            //Bild a list of all enum values
            List <RoomType> roomTypes = Enum.GetValues(typeof(RoomType)).Cast <RoomType>().ToList();

            #region Dependencies builds

            #region repositories
            RoomRepository roomRepository = new RoomRepository();

            #endregion

            #region Business
            RoomBusiness roomBusiness = new RoomBusiness();

            #endregion

            #region Services
            RoomService roomService = new RoomService(roomRepository, roomBusiness);

            #endregion

            #endregion

            //#region Build many rooms
            //int roomsQuantity = 0;
            //int availableRoomsQuantity = 0;
            //foreach (var type in roomTypes)
            //{
            //    userInterface.RequestRoomQuantity(type);
            //    roomsQuantity = Int32.Parse(Console.ReadLine());

            //    userInterface.RequestAvailableRoomQuantity(type);
            //    availableRoomsQuantity = Int32.Parse(Console.ReadLine());

            //    roomService.CreateManyRooms(type, roomsQuantity, availableRoomsQuantity);
            //}
            //#endregion

            while (options != "0")
            {
                Console.Clear();

                userInterface.LoadMenu();

                options = Console.ReadLine();

                switch (options)
                {
                // Room management
                case "1":
                    string roomOptions = "";

                    while (roomOptions != "0")
                    {
                        Console.Clear();

                        userInterface.LoadRoonsOptions(roomService.ListRooms());

                        roomOptions = Console.ReadLine();

                        switch (roomOptions)
                        {
                        //Room add
                        case "1":
                            bool enable = false;

                            userInterface.RequestRoomType();

                            userInterface.ListRoomType(roomTypes);

                            int typePosition = Int32.Parse(Console.ReadLine());

                            userInterface.RequestRoomAvailability();

                            string availableRoom = Console.ReadLine();

                            if (availableRoom.Equals("Y") || availableRoom.Equals("y"))
                            {
                                enable = true;
                            }

                            roomService.CreateRoom(roomTypes.ElementAt(typePosition - 1), enable);
                            break;

                        //Room maintenance
                        case "2":
                            userInterface.RequestRoomTypeToActive();

                            userInterface.ListRoomType(roomTypes);

                            int typePosition = Int32.Parse(Console.ReadLine());

                            try
                            {
                            }
                            catch (Exception e)
                            {
                                throw e;
                            }

                            break;

                        default:
                            break;
                        }
                    }

                    break;

                default:
                    break;
                }
            }
        }
Пример #6
0
 private void treeViewFloor_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     gridControl1.DataSource = RoomBusiness.GetRoomsByFloorId(e.Node.Text);
     InitLookUpEditClub();
 }
Пример #7
0
 private void FormRoom_Load(object sender, EventArgs e)
 {
     RoomBusiness.CreateTreeRoom(treeViewFloor);
     //InitLookUpEditClub();
 }
Пример #8
0
        public void GetRoomsByFloorIdTest(string floorId)
        {
            var actual = RoomBusiness.GetRoomsByFloorId(floorId).Count;

            Assert.AreEqual(16, actual);
        }
Пример #9
0
 public RoomModel(string connectionString)
 {
     this.roomBusiness = new RoomBusiness(connectionString);
 }
Пример #10
0
 private void lookUpEditFloor_EditValueChanged(object sender, EventArgs e)
 {
     InitLookUpEdit(lockUpEditRoom, RoomBusiness.GetRoomsByFloorId(lookUpEditFloor.Text), "RoomId", "RoomId");
     lockUpEditRoom.Properties.Columns["FloorId"].Visible = false;
 }