public UnitOfWork(KaznituLabContext context) { db = context; Users = new UserRepository(db); Equipments = new EquipmentRepository(db); Laboratories = new LaboratoryRepository(db); Project = new ProjectRepository(db); Works = new WorkRepository(db); // EquipmentTechnicalMaintenances = new Repository <EquipmentTechnicalMaintenance>(db); LaboratoryEmployees = new Repository <LaboratoryEmployee>(db); LaboratoryEqiupments = new Repository <LaboratoryEqiupment>(db); LaboratoryServices = new Repository <LaboratoryService>(db); LaboratoryProjects = new Repository <LaboratoryProject>(db); ProjectContracts = new Repository <ProjectContract>(db); ProjectCustomers = new Repository <ProjectCustomer>(db); ProjectEmployees = new Repository <ProjectEmployee>(db); WorkCoAuthors = new Repository <WorkCoAuthor>(db); ProjectCertificateRegistrations = new Repository <ProjectCertificateRegistration>(db); ProjectFundings = new Repository <ProjectFunding>(db); ProjectFundingStages = new Repository <ProjectFundingStage>(db); ProjectFundingCoFinancings = new Repository <ProjectFundingCoFinancing>(db); ProjectPatents = new Repository <ProjectPatent>(db); ProjectRevenues = new Repository <ProjectRevenue>(db); }
public void Init() { _workService = new WorkService(); _workRepository = new WorkRepository(); _path = AppDomain.CurrentDomain.BaseDirectory + "\\resources\\work.csv"; }
public ActionResult Put(Work work) { var works = WorkRepository.GetWorks(); var oldWork = works.FirstOrDefault(x => x.Id == work.Id); if (oldWork != null) { oldWork.LastName = work.LastName; oldWork.FirstName = work.FirstName; oldWork.Date = work.Date; oldWork.TypeOfCar = work.TypeOfCar; oldWork.CarLicencePlate = work.CarLicencePlate; oldWork.Issues = work.Issues; oldWork.StateOfWork = work.StateOfWork; } else { var newId = GetNewId(works); work.Id = newId; works.Add(work); } WorkRepository.StoreWorks(works); return(Ok()); }
public UserController(DatabaseContext context) { DbContext = context; UserRep = new UserRepository(context); PlaceRep = new PlaceRepository(context); WorkRep = new WorkRepository(context); FacilityRep = new FacilityRepository(context); }
public ShiftsController() { _context = new ApplicationDbContext(); _shiftRepository = new ShiftRepository(_context); _employeeRepository = new EmployeeRepository(_context); _departmentRepository = new DepartmentRepository(_context); _workRepository = new WorkRepository(_context); _shiftTypeRepository = new ShiftTypeRepository(_context); }
public ActionResult Post(Work work) { var works = WorkRepository.GetWorks(); work.Id = GetNewId(works); works.Add(work); WorkRepository.StoreWorks(works); return(Ok()); }
public ActionResult DeleteWork(long id) { Work work = WorkRepository.GetWork(id); if (work != null) { WorkRepository.DeleteWork(work); return(Ok()); } return(NotFound()); }
public ActionResult <Work> UpdateWork(Work work, long id) { Work dbWork = WorkRepository.GetWork(id); if (dbWork != null) { WorkRepository.UpdateWork(work); return(Ok()); } return(NotFound()); }
public FacilityController(DatabaseContext context) { DbContext = context; UserRep = new UserRepository(context); PlaceRep = new PlaceRepository(context); WorkRep = new WorkRepository(context); FacilityRep = new FacilityRepository(context); DiseaseRep = new DiseaseRepository(context); ScheduleRep = new ScheduleRepository(context); CheckoutRep = new CheckoutRepository(context); }
public ActionResult <Work> Get(long id) { var work = WorkRepository.GetWorks().FirstOrDefault(x => x.Id == id); if (work != null) { return(Ok(work)); } else { return(NotFound()); } }
public ActionResult Delete(long id) { var works = WorkRepository.GetWorks(); var work = works.FirstOrDefault(x => x.Id == id); if (work != null) { works.Remove(work); WorkRepository.StoreWorks(works); return(Ok()); } return(NotFound()); }
public ActionResult <Work> Get(long id) { var works = WorkRepository.GetWork(); var work = works.FirstOrDefault(i => i.WorkId == id); if (work != null) { return(work); } else { return(NotFound()); } }
public ActionResult Post(Work work) { var works = WorkRepository.GetWork(); var newId = GetNewId(works); //string Date = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); DateTime Date = DateTime.Now; work.WorkId = newId; work.Date = Date; works.Add(work); WorkRepository.StoreWork(works); return(Ok()); }
public static WorkDataLogProcessor InitialiseWorkDataLogProcessor(CloudTable workTable, CloudTable workRegistryTable, ICollector <string> ipfsImageProcesssinQueue) { var web3 = new Web3(ConfigurationSettings.GetEthereumRpcUrl()); var workSearchService = InitialiseWorkSearchService(); var workRepository = new WorkRepository(workTable); var workRegistryRepository = new WorkRegistryRepository(workRegistryTable); var ipfsQueue = new IpfsImageQueue(ipfsImageProcesssinQueue); Ujo.Repository.MappingBootstrapper.Initialise(); var musicRecordingService = new MusicRecordingService(new UnitOfWork(new UjoContext(ConfigurationSettings.GetRepositoryConnectionString()))); return(WorkDataLogProcessor.Create(web3, workRegistryRepository, ipfsQueue, workRepository, workSearchService, musicRecordingService)); }
public ActionResult Delete(long id) { var works = WorkRepository.GetWorks(); var workToRemove = works.FirstOrDefault(work => work.Id == id); if (workToRemove != null) { works.Remove(workToRemove); WorkRepository.StoreWorks(works); } else { return(NotFound()); } return(Ok()); }
public static WorkDataLogProcessor Create(Web3 web3, IStandardDataRegistry dataRegistry, IIpfsImageQueue imageQueue, WorkRepository workRepository, WorkSearchService workSearchService, MusicRecordingService musicRecordingService ) { var services = new List <IStandardDataProcessingService <MusicRecordingDTO> >(); services.Add(workRepository); services.Add(workSearchService); services.Add(new WorkIpfsImagesStandardDataProcessingService(imageQueue)); services.Add(musicRecordingService); return(new WorkDataLogProcessor(web3, dataRegistry, services)); }
public ActionResult ImportProject(ProjectImportPostData data) { var repo = _GetRepo(data); if (repo == null) { return(new HttpNotFoundResult()); } Repository sourceRepo = null; int courseId = data.SourceCourseId > 0 ? data.SourceCourseId : data.CourseId; if (data.SourceType == ImportableProjects.Types.PLAYGROUND) { string userName = String.IsNullOrWhiteSpace(data.SourceUserName) ? data.UserName : data.SourceUserName; sourceRepo = PlaygroundRepository.Get(courseId, userName, data.SourceRepositoryId); } else if (data.SourceType == ImportableProjects.Types.WORKSPACE) { sourceRepo = WorkRepository.Get(courseId, data.UserName, data.SourceRepositoryId); } else if (data.SourceType == ImportableProjects.Types.SUBMISSION) { sourceRepo = SubmissionRepository.Get(courseId, data.UserName, data.SourceRepositoryId); sourceRepo.Checkout(); } if (sourceRepo == null) { return(new HttpNotFoundResult()); } try { repo.Commit("Before Import Project"); repo.CopyFromRepository(sourceRepo); repo.Commit("After Import Project"); return(Json("success")); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
public ActionResult Put(Work work) { var works = WorkRepository.GetWorks(); var foundedWork = works.FirstOrDefault(innerWork => innerWork.Id == work.Id); if (foundedWork == null) { return(NotFound()); } else { foundedWork.CarLicensePlate = work.CarLicensePlate; foundedWork.NameOfCustomer = work.NameOfCustomer; foundedWork.StateOfWork = work.StateOfWork; foundedWork.DetailOfIssues = work.DetailOfIssues; foundedWork.RecordingDate = work.RecordingDate; foundedWork.TypeOfCar = work.TypeOfCar; } WorkRepository.StoreWorks(works); return(Ok()); }
public ActionResult Put(Work work) { var works = WorkRepository.GetWork(); var oldWork = works.FirstOrDefault(x => x.WorkId == work.WorkId); if (oldWork != null) { oldWork.ClientName = work.ClientName; oldWork.CarType = work.CarType; oldWork.LicensePlate = work.LicensePlate; oldWork.Problem = work.Problem; oldWork.State = work.State; } else { var newId = GetNewId(works); work.WorkId = newId; works.Add(work); } WorkRepository.StoreWork(works); return(Ok()); }
public WorkService(WorkRepository repository) { _repository = repository; }
public ActionResult BrowseUserWork(int courseId, string userName, int assignmentId, string pathInfo) { return(_Browse(WorkRepository.Get(courseId, userName, assignmentId).FilePath, pathInfo)); }
public WorkController(WorkRepository repository, WorkFile workFile) { this.repository = repository; this.workFile = workFile; }
public WorkFile(WorkRepository workRepository, SourceRepository sourceRepository, TargetRepository targetRepository) { this.workRepository = workRepository; this.sourceRepository = sourceRepository; this.targetRepository = targetRepository; }
public ActionResult CreateWork(Work work) { WorkRepository.AddWork(work); return(Ok()); }
public ActionResult GetImportableProjects(IDEPostData data) { Course course = _GetCourse(); if (course?.CourseId != data.CourseId) { return(new HttpNotFoundResult()); } if (User?.GetName()?.ToLowerInvariant() != data.UserName.ToLowerInvariant()) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, "Attempt to retrieve importable projects from another user.")); } try { var projects = new ImportableProjects(); var playgrounds = PlaygroundRepository.GetAllPlaygrounds(data.CourseId, data.UserName); foreach (var playground in playgrounds) { if (typeof(T) == typeof(PlaygroundRepository) && playground.PlaygroundId == data.RepositoryId) { continue; } projects.Playgrounds.Add(new ImportableProjects.ImportableProject() { Type = ImportableProjects.Types.PLAYGROUND, CourseId = playground.CourseId, RepositoryId = playground.PlaygroundId, Name = playground.Name }); } var assignments = _db.StudentAssignments .Include(sa => sa.Assignment.Course) .Where(sa => sa.Enrollment.UserName == data.UserName) // CASE INSENSITIVE .OrderByDescending(sa => sa.Assignment.DateCreated); foreach (var assignment in assignments) { var name = assignment.Assignment.AssignmentName; if (course.CourseId != assignment.Assignment.CourseId) { name += $" ({assignment.Assignment.Course.ShortName})"; } if (typeof(T) != typeof(WorkRepository) || assignment.AssignmentId.Value != data.RepositoryId) { if (WorkRepository.Exists(course.CourseId, data.UserName, data.RepositoryId)) { projects.AssignmentWorkspaces.Add(new ImportableProjects.ImportableProject() { Type = ImportableProjects.Types.WORKSPACE, CourseId = assignment.Assignment.CourseId, RepositoryId = assignment.AssignmentId.Value, Name = name }); } } if (assignment.HasSubmission) { if (typeof(T) != typeof(SubmissionRepository) || assignment.AssignmentId.Value != data.RepositoryId) { projects.AssignmentSubmissions.Add(new ImportableProjects.ImportableProject() { Type = ImportableProjects.Types.SUBMISSION, CourseId = assignment.Assignment.CourseId, RepositoryId = assignment.AssignmentId.Value, Name = name }); } } } return(new JsonNetResult(projects)); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message)); } }
public ActionResult <IEnumerable <Work> > Get() { var works = WorkRepository.GetWork(); return(Ok(works)); }
public WorkService(DbEntitiesContext context) { workRepository = new WorkRepository(context); }
public WorksController() { unitOfWork = new UnitOfWork(); workRepository = new WorkRepository(unitOfWork.Context); profileRepository = new ProfileRepository(unitOfWork.Context); }
public WorkService() : base() { workRepository = new WorkRepository(); }