public void Get_json_resource()
        {
            var person = new ResourceRepo().Get <Person>("person", GetType().Assembly);

            person.LastName.ShouldBe("Jenkins", StringComparison.Ordinal);
            person.FirstName.ShouldBe("Leeroy", StringComparison.Ordinal);
        }
示例#2
0
 public PlannerService(IPreactor preactor)
 {
     this._preactor = preactor;
     _planningBoard = _preactor.PlanningBoard;
     ordRepo        = new OrderRepo(_preactor);
     resRepo        = new ResourceRepo(_preactor);
 }
示例#3
0
        public void DeleteResourceTest()
        {
            var repo     = new ResourceRepo();
            var resource = repo.First(r => r.Username == "retite1");

            repo.Delete(resource);
            UnitOfWork.Commit();
        }
示例#4
0
        public bool changeReservation(int id, string studentId, int reserved)
        {
            ResourceRepo repo = new ResourceRepo();

            if (reserved == 0)
            {
                studentId = null;
            }
            return(repo.changeReservation(id, reserved, studentId));
        }
示例#5
0
 public Resource GetResource(int id)
 {
     Check_ResoruceId(id);
     if (Errors.Count == 0)
     {
         ResourceRepo repo = new ResourceRepo();
         return(repo.RetrieveById(id));
     }
     return(null);
 }
示例#6
0
        private bool IsResourceReserved(string id, string sid)
        {
            ResourceRepo repo = new ResourceRepo();

            if (repo.CheckIfResourceReserved(id, sid) != 1)
            {
                Errors.Add(new ValidationError("This student cannot borrow this resource since its already reserved by another student."));
                return(false);
            }
            return(true);
        }
示例#7
0
        private bool IsLoaned(string id)
        {
            ResourceRepo repo = new ResourceRepo();

            if (repo.ResourceStatusIsOnloan(id) > 0)
            {
                Errors.Add(new ValidationError("This resource is already loaned"));
                return(false);
            }
            return(true);
        }
示例#8
0
        public void AddResourceTest()
        {
            var repo     = new ResourceRepo();
            var resource = new Resource
            {
                FirstName = "Test", LastName = "Reti", EmailAddress = "*****@*****.**", IsActive = true
            };

            repo.Add(resource);
            UnitOfWork.Commit();
        }
示例#9
0
        private bool IsResourceAvailable(string id)
        {
            ResourceRepo repo = new ResourceRepo();

            if (repo.CheckIfResourceAvailable(id) > 0)
            {
                Errors.Add(new ValidationError("This resource cannot be reserved since its not available anymore."));
                return(false);
            }
            return(true);
        }
示例#10
0
        private bool IsResourceReserved(string id)
        {
            ResourceRepo repo = new ResourceRepo();

            if (repo.CheckIfResourceReservedForm3(id) > 0)
            {
                Errors.Add(new ValidationError("This resource cannot be reserved since its already reserved by another student."));
                return(false);
            }
            return(true);
        }
示例#11
0
        public Resource GetResourceForm3(string id)
        {
            ResourceRepo repo = new ResourceRepo();

            Validate(id);

            if (Errors.Count == 0)
            {
                return(repo.RetrieveByResourceId(id));
            }

            return(repo.RetrieveByResourceId(id));;
        }
示例#12
0
        public void Setup()
        {
            _connectionContext = new FileSystemConnectionContext {
                DataRoot = @"TEST:\ThisIsNotARealDirectory\"
            };

            var snapshotProcessor = new Mock <IInventorySnapshotProcessor>();
            var resourceRepo      = new ResourceRepo();

            var fileSystemWrapper = new InMemoryFileSystem();

            _inventoryRepo = new InventoryRepo(snapshotProcessor.Object, resourceRepo, fileSystemWrapper);
        }
示例#13
0
        public Resource GetResource(string id = "")
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.RetrieveByResourceId(id));
        }
示例#14
0
        public bool ReserveResource(string rid, string sid, string name)
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.MakeReserve(rid, sid, name));
        }
示例#15
0
        public bool UpdateResource2(Resource re)
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.UpdateResource2(re));
        }
示例#16
0
        public bool UpdateResource(string id)
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.UpdateResource(id));
        }
示例#17
0
        public IEnumerable <Resource> ResourceTest()
        {
            var repo = new ResourceRepo();

            return(repo.GetAll());
        }
示例#18
0
        public bool InsertResource(Resource r)
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.InsertResource(r));
        }
示例#19
0
        public Resource GetResourceOnLoan(int id)
        {
            ResourceRepo repo = new ResourceRepo();

            return(repo.RetrieveByIdForResourceOnLoan(id));
        }
示例#20
0
 public IQueryable <R.Resource> GetRSFromResource(long rsId)
 {
     return(ResourceRepo.Query(r => r.ResourceStructure.Id == rsId));
 }