Beispiel #1
0
        public UnitOfWork(IDataSource dataSource)
        {
            _dataSource = dataSource;

            DeveloperRepository = new DeveloperRepository(_dataSource);
            ProjectRepository   = new ProjectRepository(_dataSource);
        }
Beispiel #2
0
 public DeveloperProfileController()
 {
     _db = new ApplicationDbContext();
     _companyRepository   = new CompanyRepository(_db);
     _developerRepository = new DeveloperRepository(_db);
     _addressRepository   = new AddressRepository(_db);
 }
        /// <summary>
        /// Make some requests on the Developer collection
        /// </summary>
        public static void DeveloperCollectionTest()
        {
            IDeveloperRepository repository = new DeveloperRepository();
            var          developer          = Factory.CreateDeveloper();
            BsonDocument doc = repository.CreateDocument(developer);

            //Insert a document
            var savedDoc = Task.Factory.StartNew(async() => await repository.InsertDocumentAsync(doc))
                           .GetAwaiter().GetResult().Result;

            //Update a document
            DeveloperModel savedObj = BsonSerializer.Deserialize <DeveloperModel>(savedDoc);

            savedObj.CompanyName = "Bosch";

            savedObj = Task.Factory.StartNew(async() => await repository.UpdateAsync(savedObj))
                       .GetAwaiter().GetResult().Result;

            //Find all developers
            var developers = Task.Factory.StartNew(async() => await repository.FindAllAsync())
                             .GetAwaiter().GetResult().Result;

            //Find by id
            var obj = Task.Factory.StartNew(async() => await repository.FindByIdAsync(savedObj.ID))
                      .GetAwaiter().GetResult().Result;

            if (obj != null)
            {
                Console.WriteLine(obj.ToJson());
            }

            //Find by text

            var objects = Task.Factory.StartNew(async() => await repository.FindByTextSearchAsync("bosch"))
                          .GetAwaiter().GetResult().Result;

            foreach (var result in objects)
            {
                Console.WriteLine(result.ToJson());
            }

            //Call view
            var viewDocs = Task.Factory.StartNew(async() => await repository.GetDocumentFromDeveloperView())
                           .GetAwaiter().GetResult().Result;

            foreach (var viewDoc in viewDocs)
            {
                Console.WriteLine(viewDoc.ToJson());
            }

            //Delete by id
            //var ok = Task.Factory.StartNew(async () => await repository.DeleteByIdAsync(savedObj.ID))
            //  .GetAwaiter().GetResult().Result;

            //Delete all objects
            //ok = Task.Factory.StartNew(async () => await repository.DeleteAllAsync())
            //  .GetAwaiter().GetResult().Result;
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            DeveloperRepository developerR = new DeveloperRepository();
            GameRepository      gameR      = new GameRepository();
            GenreRepository     genreR     = new GenreRepository();
            OrderRepository     orderR     = new OrderRepository();
            PublisherRepository publisherR = new PublisherRepository();

            Genre genre1 = new Genre()
            {
                Title = "genre1"
            };
            Genre genre2 = new Genre()
            {
                Title = "genre2"
            };
            Genre genre3 = new Genre()
            {
                Title = "genre3"
            };

            Publisher publisher1 = new Publisher()
            {
                Title = "publisher"
            };

            Developer developer1 = new Developer()
            {
                Title = "developer"
            };

            genreR.Create(genre1);
            genreR.Create(genre2);
            genreR.Create(genre3);

            publisherR.Create(publisher1);

            developerR.Create(developer1);

            genre1 = genreR.GetById(1);
            genre2 = genreR.GetById(2);
            genre3 = genreR.GetById(3);

            publisher1 = publisherR.GetById(1);

            developer1 = developerR.GetById(1);

            Game game1 = new Game()
            {
                Title = "game1", Developer = developer1, Publisher = publisher1, Genres = new List <Genre> {
                    genre1, genre2, genre3
                }, Discription = "AAA", ReleaseDate = DateTime.Now, Discount = 10, Price = 15
            };

            gameR.Create(game1);

            game1 = gameR.GetById(1);
        }
        /// <summary>
        /// Initializes a new instance of the DeveloperService class.
        /// </summary>
        /// <param name="unitOfWork">UnitOfWork information</param>
        public DeveloperService(UnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException(UnitOfWorkConst);
            }

            this.unitOfWork = unitOfWork;
            this.developerRepository = new DeveloperRepository(this.unitOfWork);
        }
        public async Task TestDeveloperRepo_Exists()
        {
            //Arrange
            DeveloperRepository TestRepo = CreateDeveloperTestRepo("DeveloperExists");

            //Act
            var result = await TestRepo.Exist(_DeveloperNumber - 1);  //Subtract one since it starts at 0

            //Assert
            Assert.IsTrue(result);
        }
        public void TestDeveloperRepo_GetAll()
        {
            //Arrange
            DeveloperRepository TestRepo = CreateDeveloperTestRepo("DeveloperGetAll");

            //Act
            var result = TestRepo.GetAll();

            //Assert
            Assert.IsTrue(result.Count() == _DeveloperNumber);
        }
        public async Task TestDeveloperRepo_GetSingle()
        {
            //Arrange
            DeveloperRepository TestRepo = CreateDeveloperTestRepo("DeveloperGetSingle");

            //Act
            var result = await TestRepo.Find(_DeveloperNumber - 1);  //Subtract one since it starts at 0

            //Assert
            Assert.IsTrue(result.Id == (_DeveloperNumber - 1));
            Assert.IsTrue(result.DeveloperName == _DeveloperName + (_DeveloperNumber - 1).ToString());
        }
 public UnityOfWork(ProjectTracerEntities _context)
 {
     context       = _context;
     Project       = new ProjectRepository(_context);
     Task          = new TaskRepository(_context);
     Document      = new DocumentRepository(_context);
     Team          = new TeamRepository(_context);
     Client        = new ClientRepository(_context);
     Developer     = new DeveloperRepository(_context);
     Senior        = new SeniorRepository(_context);
     Administrator = new AdministratorRepository(_context);
 }
 public void Arrange()
 {
     _course           = new Course("C# Fundamentals", 75m);
     _course2          = new Course("Inheritance", 50m);
     _course3          = new Course("C# Advanced", 80m);
     _course4          = new Course("Contoso", 42m);
     _courseRepository = new CourseRepository();
     _courseRepository.AddCourseToRepository(_course);
     _courseRepository.AddCourseToRepository(_course2);
     _courseRepository.AddCourseToRepository(_course3);
     _courseRepository.AddCourseToRepository(_course4);
     _developerRepository = new DeveloperRepository();
     //_developer = new Developer("John", new List<Course>(_course2, _course4), 25);
 }
Beispiel #11
0
        public virtual async Task <Dictionary <int, TaskItem> > DeserializeHistoryEventsAsync(JToken jsonTaskList,
                                                                                              Dictionary <int, TaskItem> taskItems)
        {
            foreach (var jsonTaskItem in jsonTaskList)
            {
                var historyEventList = new List <HistoryEvent>();

                foreach (var jsonHistoryEvent in GetJTokenHistoryEventList(jsonTaskItem))
                {
                    try
                    {
                        if ((jsonHistoryEvent["historyevent"].ToString() != "Task moved" &&
                             jsonHistoryEvent["historyevent"].ToString() != "Task created") ||
                            jsonHistoryEvent["details"].ToString().Contains("reordered"))
                        {
                            continue;
                        }

                        var historyEvent = DeserializeHistoryEvent(jsonHistoryEvent);
                        historyEventList.Add(historyEvent);

                        var taskItem             = taskItems[(int)jsonTaskItem["taskid"]];
                        var taskItemDeserializer = new KanbanizeTaskItemDeserializer();
                        var developerRepository  = new DeveloperRepository();
                        taskItem = await taskItemDeserializer.FillInTaskItemStateDetailsAsync(historyEvent, taskItem);

                        if (taskItem.LastChangedOn < historyEvent.EventDate || taskItem.LastChangedOn == null)
                        {
                            taskItem.LastChangedOn = historyEvent.EventDate;
                            taskItem.LastChangedBy = await developerRepository.GetDeveloperByNameAsync(historyEvent.Author);
                        }

                        taskItem.NumRevisions++;

                        taskItems[historyEvent.TaskId] = taskItem;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(
                            $"Unable to process History Event for task: {jsonTaskItem["taskid"]}\nJson: {jsonTaskItem["historydetails"]["item"]} - {ex.Message}");
                    }
                }

                taskItems[(int)jsonTaskItem["taskid"]].HistoryEvents = historyEventList;
            }

            return(taskItems);
        }
Beispiel #12
0
        public async Task UpdateBoardUsersAsync(int boardId)
        {
            var uri             = $"https://{Subdomain}.kanbanize.com/index.php/api/kanbanize/get_board_settings/";
            var body            = $"{{\"boardid\":\"{boardId}\"}}";
            var xmlTaskItemList = GetInformation(uri, body);

            var doc = new XmlDocument();

            doc.LoadXml(xmlTaskItemList);

            var json      = JObject.Parse(JsonConvert.SerializeXmlNode(doc));
            var usernames = json["xml"]["usernames"]["item"];

            var developerRepository = new DeveloperRepository();

            foreach (var username in usernames)
            {
                await developerRepository.InsertDeveloperAsync(username.ToString());
            }
        }
Beispiel #13
0
        public void Run()
        {
            bool isRunning = true;
            DeveloperRepository devRepo  = new DeveloperRepository();
            TeamRepository      teamRepo = new TeamRepository();

            while (isRunning)
            {
                Console.WriteLine("Hey! What would you like to do?\n" +
                                  "1. Add Developer\n" +
                                  "2. Add Team\n" +
                                  "3. See Developers\n" +
                                  "4. See Teams");
                string userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    Console.WriteLine("What is the name of the developer?");
                    string devName = Console.ReadLine();
                    devRepo.CreateDeveloper(new Developer(1, devName));
                    break;

                case "2":
                    break;

                case "3":
                    foreach (Developer developer in devRepo.GetAllDevelopers())
                    {
                        Console.WriteLine($"ID: {developer.DeveloperID} Name: {developer.Name}");
                    }
                    break;

                case "4":
                    break;

                default:
                    break;
                }
            }
        }
        public async Task <string> GetAsync(double timeSpentInBacklog, string type, string devTeam, string createdBy)
        {
            var helper = new MultipleLinearRegressionAnalysisHelper();
            var developerRepository = new DeveloperRepository();
            var taskItemType        = GetTaskItemType(type);

            var taskItem = new MultipleLinearRegressionTaskItem
            {
                TimeSpentInBacklog = timeSpentInBacklog,

                TypeIsProduct       = taskItemType == TaskItemType.Product,
                TypeIsEngineering   = taskItemType == TaskItemType.Engineering,
                TypeIsUnanticipated = taskItemType == TaskItemType.Unanticipated,

                DevTeamIsAssessments = devTeam == "Assessments",
                DevTeamIsEnterprise  = devTeam == "Enterprise",

                CreatedBy = await developerRepository.GetDeveloperByNameAsync(createdBy)
            };

            return(await helper.GetEstimation(taskItem));
        }
Beispiel #15
0
 public DeveloperController(DeveloperRepository developerRepository)
 {
     _developerRepository = developerRepository;
 }
 public DeveloperService(DbEntitiesContext context)
 {
     developerRepository = new DeveloperRepository(context);
 }
 public DeveloperService()
     : base()
 {
     developerRepository = new DeveloperRepository();
 }
Beispiel #18
0
 public DeveloperController()
 {
     DeveloperRepository = new DeveloperRepository();
 }
Beispiel #19
0
        public virtual async Task <TaskItem> FillInTaskItemStateDetailsAsync(HistoryEvent historyEvent,
                                                                             TaskItem taskItem)
        {
            var developerRepository = new DeveloperRepository();

            switch (historyEvent.EventType)
            {
            case "Task created":
                taskItem.CreatedOn = historyEvent.EventDate;
                taskItem.CreatedBy = await developerRepository.GetDeveloperByNameAsync(historyEvent.Author);

                break;

            case "Task moved":
            {
                switch (historyEvent.TaskItemState)
                {
                case TaskItemState.None:
                    break;

                case TaskItemState.Backlog:
                    break;

                case TaskItemState.TopPriority:
                    if (taskItem.StartTime == null || taskItem.StartTime > historyEvent.EventDate)
                    {
                        taskItem.StartTime = historyEvent.EventDate;
                    }
                    break;

                case TaskItemState.InProcess:
                    taskItem.StartTime ??= taskItem.CreatedOn;
                    if (taskItem.StartTime > historyEvent.EventDate)
                    {
                        taskItem.StartTime = historyEvent.EventDate;
                    }
                    break;

                case TaskItemState.Released:
                    taskItem.StartTime ??= taskItem.CreatedOn;
                    if (taskItem.StartTime > historyEvent.EventDate)
                    {
                        taskItem.StartTime = historyEvent.EventDate;
                    }
                    if (historyEvent.EventDate < taskItem.FinishTime || taskItem.FinishTime == null)
                    {
                        var releaseRepository = new ReleaseRepository();
                        taskItem.FinishTime = historyEvent.EventDate;
                        taskItem.Release    =
                            await releaseRepository.GetFirstReleaseBeforeDateAsync(taskItem.FinishTime);
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                break;
            }
            }

            return(taskItem);
        }
Beispiel #20
0
        public EFUnitOfWork(ApplicationContext db, Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.Identity.IdentityOptions> optionAccessor, Microsoft.AspNetCore.Identity.IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <Microsoft.AspNetCore.Identity.IUserValidator <ApplicationUser> > userValidators, IEnumerable <Microsoft.AspNetCore.Identity.IPasswordValidator <ApplicationUser> > passwordValidators, Microsoft.AspNetCore.Identity.ILookupNormalizer keyNormalizer, Microsoft.AspNetCore.Identity.IdentityErrorDescriber errors, IServiceProvider servises, Microsoft.Extensions.Logging.ILogger <Microsoft.AspNetCore.Identity.UserManager <ApplicationUser> > logger, IEnumerable <Microsoft.AspNetCore.Identity.IRoleValidator <ApplicationRole> > roleValidators, Microsoft.Extensions.Logging.ILogger <Microsoft.AspNetCore.Identity.RoleManager <ApplicationRole> > roleLogger)
        {
            this.db = db;

            #region User repositories

            ApplicationUsers      = new ApplicationUserManager(new UserStore <ApplicationUser>(db), optionAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, servises, logger);
            Roles                 = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db), roleValidators, keyNormalizer, errors, roleLogger);
            UserProfiles          = new UserProfileRepository(db);
            Comments              = new CommentRepository(db);
            ComputerAssemblyRates = new ComputerAssemblyRateRepository(db);

            #endregion

            #region Infrastructure repositories

            ComputerAssemblies = new ComputerAssemblyRepository(db);
            Manufacturers      = new ManufacturerRepository(db);
            Softwares          = new SoftwareRepository(db);
            Developers         = new DeveloperRepository(db);
            Publishers         = new PublisherRepository(db);
            Countries          = new CountryRepository(db);

            #endregion

            #region Specification repositories

            CPUSockets                       = new CPUSocketRepository(db);
            GPUs                             = new GPURepository(db);
            GraphicMemoryTypes               = new GraphicMemoryTypeRepository(db);
            MotherBoardFormFactors           = new MotherBoardFormFactorRepository(db);
            MotherBoardNorthBridges          = new MotherBoardNorthBridgeRepository(db);
            OuterMemoryFormFactors           = new OuterMemoryFormFactorRepository(db);
            OuterMemoryInterfaces            = new OuterMemoryInterfaceRepository(db);
            PowerSupplyCPUInterfaces         = new PowerSupplyCPUInterfaceRepository(db);
            PowerSupplyMotherBoardInterfaces = new PowerSupplyMotherBoardInterfaceRepository(db);
            RAMTypes                         = new RAMTypeRepository(db);
            RequirementTypes                 = new RequirementTypeRepository(db);
            VideoCardInterfaces              = new VideoCardInterfaceRepository(db);
            #endregion

            #region Joins repositories

            ComputerAssemblyHDDs                = new ComputerAssemblyHDDRepository(db);
            ComputerAssemblyRAMs                = new ComputerAssemblyRAMRepository(db);
            ComputerAssemblySSDs                = new ComputerAssemblySSDRepository(db);
            ComputerAssemblyVideoCards          = new ComputerAssemblyVideoCardRepository(db);
            MotherBoardOuterMemorySlots         = new MotherBoardOuterMemorySlotRepository(db);
            MotherBoardRAMSlots                 = new MotherBoardRAMSlotRepository(db);
            MotherBoardPowerSupplySlots         = new MotherBoardPowerSupplySlotRepository(db);
            MotherBoardVideoCardSlots           = new MotherBoardVideoCardSlotRepository(db);
            PCCaseMotherBoardFormFactors        = new PCCaseMotherBoardFormFactorRepository(db);
            PCCaseOuterMemoryFormFactors        = new PCCaseOuterMemoryFormFactorRepository(db);
            PowerSupplyPowerSupplyCPUInterfaces = new PowerSupplyPowerSupplyCPUInterfaceRepository(db);
            SoftwareCPURequirements             = new SoftwareCPURequirementRepository(db);
            SoftwareVideoCardRequirements       = new SoftwareVideoCardRequirementRepository(db);
            #endregion

            #region Hardware Repositories

            CPUs          = new CPURepository(db);
            HDDs          = new HDDRepository(db);
            MotherBoards  = new MotherBoardRepository(db);
            PCCases       = new PCCaseRepository(db);
            PowerSupplies = new PowerSupplyRepository(db);
            RAMs          = new RAMRepository(db);
            SSDs          = new SSDRepository(db);
            VideoCards    = new VideoCardRepository(db);

            #endregion
        }
Beispiel #21
0
 public DeveloperController(IConfiguration configuration)
 {
     repo = new DeveloperRepository(configuration);
 }
Beispiel #22
0
 public DeveloperRepositoryTest()
 {
     _developerRepository = new DeveloperRepository(_db);
 }
 public UnitOfWork(ApplicationContext context)
 {
     _context   = context;
     Developers = new DeveloperRepository(_context);
     Projects   = new ProjectRepository(_context);
 }
Beispiel #24
0
 //constructor initialisation
 public DeveloperController()
 {
     _developerRepository =
         new DeveloperRepository();
     _formatServices = new FormatServices();
 }
 public DeveloperController()
 {
     db = new ApplicationDbContext();
     developerRepository = new DeveloperRepository(db);
     unitOfWork          = new UnitOfWork(db);
 }
Beispiel #26
0
 public DeveloperService(DeveloperRepository repository,UserRepository userRepository, IUnitOfWork unitOfWork)
 {
     _devrepository = repository;
     _user = userRepository;
     _unitOfWork = unitOfWork;
 }