Exemple #1
0
 public SearchWorkplaces(double latitude, double longitude, int clientId)
 {
     _workplaceParameterDB = new WorkplaceParameterRepository();
     _searchSettingDB      = new SearchSettingRepository();
     _buildingDB           = new BuildingRepository();
     _workplaceDB          = new WorkplaceRepository();
     _workplaceEquipmentDB = new WorkplaceEquipmentRepository();
     _latitude             = latitude;
     _longitude            = longitude;
     _workplaceParameters  = _workplaceParameterDB.GetEntityListByClientId(clientId);
     _idealMark            = GetIdealMark();
     _searchSetting        = _searchSettingDB.GetEntity(clientId);
     _buildingsInRadius    = GetBuildingsInRadius();
 }
        public void RemoveBuilding_TwoBuildings()
        {
            // Arrange
            BuildingRepository buildingRepo = new BuildingRepository();

            // Act
            buildingRepo.RemoveBuilding(1);
            buildingRepo.RemoveBuilding(2);

            Building[] buildings = buildingRepo.GetBuildings().ToArray();

            // Assert
            Assert.AreEqual(18, buildings.Length);
        }
Exemple #3
0
        public void CreateBuilding(Building building)
        {
            BuildingRepository buildingRepo = new BuildingRepository();

            try
            {
                buildingRepo.Add(building);
                GlobalUnitOfWork.Commit();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
 public void DeleteBuilding(int buildingID)
 {
     try
     {
         BuildingRepository buildingRepo = new BuildingRepository();
         var r = buildingRepo.Get(buildingID);
         buildingRepo.Delete(r);
         GlobalUnitOfWork.Commit();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #5
0
        public ActionResult DeleteBuilding(Building building)
        {
            var  bldgRepo  = new BuildingRepository();
            bool isDeleted = bldgRepo.DeleteById(building.Id);

            //Delete addresses
            AddressManager.DeleteByBuildingId(building.Id);

            // Deletes the content.
            Document doc = new Document(CurrentPage.Parent.Id);

            doc.delete();

            return(RedirectToUmbracoPage(CurrentPage.Parent.Parent));
        }
Exemple #6
0
 public AccountController(SignInManager <AppIdentityUser> signInManager,
                          UserManager <AppIdentityUser> userManager, RoleManager <IdentityRole> roleManager,
                          DepartmentRepository departmentRepository, BuildingRepository buildingRepository,
                          TechnicalGroupRepository technicalGroupRepository, RoomRepository roomRepository,
                          SubTechnicalGroupRepository subTechnicalGroupRepository)
 {
     _signInManager               = signInManager;
     _userManager                 = userManager;
     _roleManager                 = roleManager;
     _departmentRepository        = departmentRepository;
     _buildingRepository          = buildingRepository;
     _technicalGroupRepository    = technicalGroupRepository;
     _roomRepository              = roomRepository;
     _subTechnicalGroupRepository = subTechnicalGroupRepository;
 }
Exemple #7
0
 public UnitOfWork(RoleplayContext context)
 {
     _context                    = context;
     AccountRepository           = new AccountRepository(_context);
     CharacterRepository         = new CharacterRepository(_context);
     VehicleRepository           = new VehicleRepository(_context);
     AtmRepository               = new AtmRepository(_context);
     BusRepository               = new BusRepository(_context);
     BuildingRepository          = new BuildingRepository(_context);
     ItemRepository              = new ItemRepository(_context);
     ShopRepository              = new ShopRepository(_context);
     GroupRepository             = new GroupRepository(_context);
     WarehouseRepository         = new WarehouseRepository(_context);
     SmartphoneMessageRepository = new SmartphoneMessageRepository(_context);
 }
Exemple #8
0
        public Building GetBuildingById(int id)
        {
            Building result;

            try
            {
                BuildingRepository buildingRepo = new BuildingRepository();
                result = buildingRepo.Get(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Exemple #9
0
        public IEnumerable <Building> ReturnAllBuildings()
        {
            IEnumerable <Building> buildings;

            try
            {
                BuildingRepository buildingRepo = new BuildingRepository();

                buildings = buildingRepo.GetAll();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(buildings);
        }
Exemple #10
0
        public IActionResult GetReports(int id, [FromBody] ReportDate reportDate)
        {
            var buildingId = new BuildingId(id);
            var building   = BuildingRepository.Get(buildingId);
            var user       = _userSession.User;
            var userRoles  = user.Roles.Where(r => r.BuildingId == buildingId).ToList();

            var reportRepository = ReportRepository(buildingId);

            IEnumerable <Repositories.ReportListItem> reports;

            if (user.CompanyId == building.MainContractor.Id && userRoles.Any(r => r.UserBuildingRole == UserBuildingRole.Admin))
            {
                reports = reportRepository.GetAll(reportDate.Month, reportDate.Year);
            }
            else if (userRoles.Any(r => r.UserBuildingRole == UserBuildingRole.Admin))
            {
                var usersId = _userRepository.GetBuildingWorkers(buildingId, user.CompanyId)
                              .Select(u => u.Id);
                reports = reportRepository.GetFor(reportDate.Month, reportDate.Year, usersId.Select(i => i.Value).ToArray());
            }
            else
            {
                reports = reportRepository.GetFor(reportDate.Month, reportDate.Year, user.Id.Value);
            }

            var companies = _companyRepository.GetContractors(buildingId).ToList();
            var users     = companies.SelectMany(c => _userRepository.GetWorkers(c.Id));

            return(Ok(reports.GroupBy(r => r.Date.Day)
                      .Select(g => new ReportList
            {
                Day = g.Key,
                Reports = g.Select(r =>
                {
                    var us = users.Single(u => u.Id.Value == r.UserId);
                    return new ReportListItem
                    {
                        Id = r.Id,
                        CompanyName =
                            companies.Single(c => c.Id == us.CompanyId).Name,
                        UserName = $"{us.FirstName} {us.LastName} ({us.Email})"
                    };
                })
            }).OrderBy(g => g.Day)));
        }
 public UnitOfWork(SchedulingDbContext context)
 {
     this.context           = context;
     ScheduleConfigurations = new ScheduleConfigurationRepository(context);
     Types             = new TypeRepository(context);
     Rooms             = new RoomRepository(context);
     Courses           = new CourseRepository(context);
     Sections          = new SectionRepository(context);
     AcademicSemesters = new AcademicSemesterRepository(context);
     WeekDays          = new WeekDayRepository(context);
     Instructors       = new InstructorRepository(context);
     Curriculums       = new CurriculumRepository(context);
     CourseOfferings   = new CourseOfferingRepository(context);
     CourseOfferingInstructorAssignments = new InstructorAssignmentRepository(context);
     Departments     = new DepartmentRepository(context);
     Colleges        = new CollegeRepository(context);
     Buildings       = new BuildingRepository(context);
     LabTypes        = new LabTypeRepository(context);
     ScheduleEntries = new ScheduleEntryRepository(context);
     Schedules       = new ScheduleRepository(context);
 }
Exemple #12
0
        private async Task <bool> DoInitialize()
        {
            await Task.Yield();

            lock (mLock)
            {
                mGame = mApplicationRepository.GetGame(BuildingId);

                if (mGame == null)
                {
                    return(false);
                }

                var wBuildingDataFilePath = mGame.DataFileName;

                mBuildingRepository = new BuildingRepository(wBuildingDataFilePath);

                mCommonRepository = new CommonRepository();

                return(true);
            }
        }
        public void AddBuilding_TwoBuildings()
        {
            // Arrange
            Building b1 = new Building {
                BuildingId = 1000, Name = "BLD001"
            };
            Building b2 = new Building {
                BuildingId = 2000, Name = "BLD002"
            };

            BuildingRepository buildingRepo = new BuildingRepository();

            // Act
            buildingRepo.AddBuilding(b1);
            buildingRepo.AddBuilding(b2);

            Building[] buildings = buildingRepo.GetBuildings().ToArray();

            // Assert
            Assert.AreEqual(22, buildings.Length);
            Assert.AreEqual(b1, buildings[20]);
            Assert.AreEqual(b2, buildings[21]);
        }
Exemple #14
0
 public BuildingController()
 {
     BuildingDB = new BuildingRepository();
     LandlordDB = new LandlordRepository();
 }
Exemple #15
0
 public void Post([FromBody] int id)
 {
     BuildingRepository.HirePerson(id);
 }
Exemple #16
0
 public void PutWorkplace(int id, int workplaceId)
 {
     BuildingRepository.ChangePersonWorkplace(id, workplaceId);
 }
        public Floor Post()
        {
            var wId = BuildingRepository.AddFloor();

            return(BuildingRepository.GetFloor(wId));
        }
Exemple #18
0
 public void DeleteWorkplace(int id, int workplaceId)
 {
     BuildingRepository.RemovePersonWorkplace(id, workplaceId);
 }
 public IEnumerable <Floor> Get()
 {
     return(BuildingRepository.GetFloors());
 }
Exemple #20
0
        public Room Post([FromBody] ParentChildPosition ids)
        {
            var wId = BuildingRepository.AddRoom(ids.ParentId, CommonRepository.GetRoomTemplate(ids.ChildId), ids.X, ids.Y, ids.Rotation);

            return(Get(wId));
        }
Exemple #21
0
 public void Delete(int id)
 {
     BuildingRepository.RemoveRoom(id);
 }
Exemple #22
0
 public void PutTeam(int id, int teamId)
 {
     BuildingRepository.ChangePersonTeam(id, teamId);
 }
Exemple #23
0
 public IEnumerable <Room> Get()
 {
     return(BuildingRepository.GetRooms());
 }
Exemple #24
0
 public void DeleteTeam(int id, int teamId)
 {
     BuildingRepository.RemovePersonTeam(id, teamId);
 }
Exemple #25
0
 public Person Get(int id)
 {
     return(BuildingRepository.GetPerson(id));
 }
 public BuildingStats GetStats()
 {
     return(BuildingRepository.GetStats());
 }
Exemple #27
0
 public IEnumerable <Person> Get([FromQuery] string state = "hired")
 {
     return(BuildingRepository.GetPersons((PersonState)Enum.Parse(typeof(PersonState), state, true)));
 }
 public Floor Get(int id)
 {
     return(BuildingRepository.GetFloor(id));
 }
Exemple #29
0
 public Room Get(int id)
 {
     return(BuildingRepository.GetRoom(id));
 }
Exemple #30
0
 public void Delete(int id)
 {
     BuildingRepository.FirePerson(id);
 }