public ActionResult PreparePublicationMail(int ReleaseID, int CPID, string base64string, bool isDraft) { string PublishCP; string ToEmail = ""; Release PublishRelease; PublicationMailDetails PubliactionMail = new PublicationMailDetails(); using (IReleaseRepository db = new ReleaseRepository()) { PublishRelease = db.WhereAndInclude(r => r.ReleaseID == ReleaseID, r => r.Account) .Include(r => r.ReleaseCPs.Select(cp => cp.CP)).FirstOrDefault(); PublishCP = PublishRelease.ReleaseCPs.FirstOrDefault(cp => cp.CPID == CPID).CP.Name; db.GetEmployeesMailAddress(ReleaseID, isDraft).ToList().ForEach(s => ToEmail += s + "; "); PubliactionMail.To = ToEmail; PubliactionMail.BCC = "*****@*****.**"; // PubliactionMail.CC = "*****@*****.**"; string MailTypeSubject = isDraft ? "Draft " : "Official "; PubliactionMail.Subject = PublishRelease.Account.Name + " - Release " + PublishRelease.Name + " - " + PublishCP + " (" + MailTypeSubject + " - PREP ID " + ReleaseID.ToString() + ")"; PubliactionMail.ReleaseID = ReleaseID; PubliactionMail.CPID = CPID; // upload status screenshot Files.UploadImage(base64string, "Status" + ReleaseID.ToString(), true); PubliactionMail.imagePath = VirtualPathUtility.ToAbsolute("~/Content/Images/ScoreImages") + "/Status" + ReleaseID.ToString() + ".png"; } return(PartialView("PopUpMail", PubliactionMail)); }
public void ShouldGetLastFiveReleases() { //given var releaseRepository = new ReleaseRepository(); var expectedReleaseDetailsModels = new List <Release> { new ReleaseBuilder().WithReleaseNumber("REL05").WithReleaseDate(DateTime.Today.AddDays(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL04").WithReleaseDate(DateTime.Today.AddMonths(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL03").WithReleaseDate(DateTime.Today.AddMonths(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL02").WithReleaseDate(DateTime.Today.AddMonths(-2).AddDays(2)).Build(), new ReleaseBuilder().WithReleaseNumber("REL01").WithReleaseDate(DateTime.Today.AddMonths(-2)).Build() }; var lastfiveReleases = new Release[expectedReleaseDetailsModels.Count]; expectedReleaseDetailsModels.CopyTo(lastfiveReleases); expectedReleaseDetailsModels.Add(new ReleaseBuilder().WithReleaseNumber("REL06").WithReleaseDate(DateTime.Today.AddMonths(-3).AddDays(-1)).Build()); //when foreach (Release expectedReleaseDetailsModel in expectedReleaseDetailsModels) { releaseRepository.SaveReleaseDetails(expectedReleaseDetailsModel); } // then IEnumerable <Release> releaseDetailsModels = releaseRepository.GetLastFiveReleases(); IEnumerable <Release> expectedReleases = lastfiveReleases.ToList(); Assert.That(releaseDetailsModels, Is.EqualTo(expectedReleases)); }
/// <summary> /// reset Current Release And Mode ,Sets CurrentTabIndex to 0 /// </summary> /// <param name="ReleaseId"></param> /// <param name="Mode">Add Edit or View </param> void SetCurrentRelease(int ReleaseId = 0, Mode Mode = Mode.ADD, int TabIndex = 0) { CurrentRelease currentRelease = new CurrentRelease(); using (ReleaseRepository db = new ReleaseRepository()) { currentRelease.ReleaseId = ReleaseId; currentRelease.Mode = Mode; if (Mode == Mode.ADD) { currentRelease.Release = db.GetNewReleseAndRelationships(); } else { currentRelease.Release = db.GetReleseAndRelationships(currentRelease.ReleaseId); } Session["CurrentRelease"] = currentRelease; currentRelease.Tabs = new ReleaseTabs { GeneralDetails = GetReleaseGeneralDetails(), ProductsInScope = GetProductsInScope(), ReleaseCharacteristic = GetReleaseCharacteristic(), ReleaseMilestones = GetReleaseMilestoneVM(), ReleaseStakeholders = GetReleaseStakeholder(), AreaOwners = GetReleaseAreaOwners(), CheckPointReviewMode = new List <ReleaseCPReviewMode>() { }, }; currentRelease.CurrentTabIndex = TabIndex; }; }
public void ShouldGetLastFiveReleases() { //given var releaseRepository = new ReleaseRepository(); var expectedReleaseDetailsModels = new List<Release> { new ReleaseBuilder().WithReleaseNumber("REL05").WithReleaseDate(DateTime.Today.AddDays(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL04").WithReleaseDate(DateTime.Today.AddMonths(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL03").WithReleaseDate(DateTime.Today.AddMonths(-1)).Build(), new ReleaseBuilder().WithReleaseNumber("REL02").WithReleaseDate(DateTime.Today.AddMonths(-2).AddDays(2)).Build(), new ReleaseBuilder().WithReleaseNumber("REL01").WithReleaseDate(DateTime.Today.AddMonths(-2)).Build() }; var lastfiveReleases = new Release[expectedReleaseDetailsModels.Count]; expectedReleaseDetailsModels.CopyTo(lastfiveReleases); expectedReleaseDetailsModels.Add(new ReleaseBuilder().WithReleaseNumber("REL06").WithReleaseDate(DateTime.Today.AddMonths(-3).AddDays(-1)).Build()); //when foreach (Release expectedReleaseDetailsModel in expectedReleaseDetailsModels) { releaseRepository.SaveReleaseDetails(expectedReleaseDetailsModel); } // then IEnumerable<Release> releaseDetailsModels = releaseRepository.GetLastFiveReleases(); IEnumerable<Release> expectedReleases = lastfiveReleases.ToList(); Assert.That(releaseDetailsModels, Is.EqualTo(expectedReleases)); }
public void Setup() { _artist = new Artist { Name = "Alien Ant Farm", Monitored = true, ForeignArtistId = "this is a fake id", Id = 1, Metadata = new ArtistMetadata { Id = 1 } }; _albumRepo = Mocker.Resolve <AlbumRepository>(); _releaseRepo = Mocker.Resolve <ReleaseRepository>(); _release = Builder <AlbumRelease> .CreateNew() .With(e => e.Id = 0) .With(e => e.ForeignReleaseId = "e00e40a3-5ed5-4ed3-9c22-0a8ff4119bdf") .With(e => e.Monitored = true) .Build(); _album = new Album { Title = "ANThology", ForeignAlbumId = "1", CleanTitle = "anthology", Artist = _artist, ArtistMetadataId = _artist.ArtistMetadataId, AlbumType = "", AlbumReleases = new List <AlbumRelease> { _release }, }; _albumRepo.Insert(_album); _release.AlbumId = _album.Id; _releaseRepo.Insert(_release); _albumRepo.Update(_album); _albumSpecial = new Album { Title = "+", ForeignAlbumId = "2", CleanTitle = "", Artist = _artist, ArtistMetadataId = _artist.ArtistMetadataId, AlbumType = "", AlbumReleases = new List <AlbumRelease> { new AlbumRelease { ForeignReleaseId = "fake id" } } }; _albumRepo.Insert(_albumSpecial); }
public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope repositoryScope = null) { Client = client; Scope = repositoryScope ?? RepositoryScope.Unspecified(); Accounts = new AccountRepository(this); ActionTemplates = new ActionTemplateRepository(this); Artifacts = new ArtifactRepository(this); Backups = new BackupRepository(this); BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(this); CertificateConfiguration = new CertificateConfigurationRepository(this); Certificates = new CertificateRepository(this); Channels = new ChannelRepository(this); CommunityActionTemplates = new CommunityActionTemplateRepository(this); Configuration = new ConfigurationRepository(this); DashboardConfigurations = new DashboardConfigurationRepository(this); Dashboards = new DashboardRepository(this); Defects = new DefectsRepository(this); DeploymentProcesses = new DeploymentProcessRepository(this); Deployments = new DeploymentRepository(this); Environments = new EnvironmentRepository(this); Events = new EventRepository(this); FeaturesConfiguration = new FeaturesConfigurationRepository(this); Feeds = new FeedRepository(this); Interruptions = new InterruptionRepository(this); LibraryVariableSets = new LibraryVariableSetRepository(this); Lifecycles = new LifecyclesRepository(this); MachinePolicies = new MachinePolicyRepository(this); MachineRoles = new MachineRoleRepository(this); Machines = new MachineRepository(this); Migrations = new MigrationRepository(this); OctopusServerNodes = new OctopusServerNodeRepository(this); PerformanceConfiguration = new PerformanceConfigurationRepository(this); PackageMetadataRepository = new PackageMetadataRepository(this); ProjectGroups = new ProjectGroupRepository(this); Projects = new ProjectRepository(this); ProjectTriggers = new ProjectTriggerRepository(this); Proxies = new ProxyRepository(this); Releases = new ReleaseRepository(this); RetentionPolicies = new RetentionPolicyRepository(this); Schedulers = new SchedulerRepository(this); ServerStatus = new ServerStatusRepository(this); Spaces = new SpaceRepository(this); Subscriptions = new SubscriptionRepository(this); TagSets = new TagSetRepository(this); Tasks = new TaskRepository(this); Teams = new TeamsRepository(this); Tenants = new TenantRepository(this); TenantVariables = new TenantVariablesRepository(this); UserInvites = new UserInvitesRepository(this); UserRoles = new UserRolesRepository(this); Users = new UserRepository(this); VariableSets = new VariableSetRepository(this); Workers = new WorkerRepository(this); WorkerPools = new WorkerPoolRepository(this); ScopedUserRoles = new ScopedUserRoleRepository(this); UserPermissions = new UserPermissionsRepository(this); loadRootResource = new Lazy <Task <RootResource> >(LoadRootDocumentInner, true); loadSpaceRootResource = new Lazy <Task <SpaceRootResource> >(LoadSpaceRootDocumentInner, true); }
public async Task <object> SaveRelease(int ReleaseID, ReleaseTabs UpdateRelease, IDictionary <string, bool> ListUpdated, bool IsInitiated = false) { int count = 0; Session["isExecuteAsyncTask"] = false; using (IReleaseRepository db = new ReleaseRepository()) { if (ReleaseID == 0) { count += await SaveNewRelease(ReleaseID, UpdateRelease); // return count; } else { count += await SaveEditRelease(ReleaseID, UpdateRelease, ListUpdated); if (IsInitiated) { count += await InitiateRelease(ReleaseID); } } } //after Save Update Current Release To null Session["currentRelease"] = null; return(Json(new { count = count, isExecuteAsyncTask = (bool)Session["isExecuteAsyncTask"] })); }
public OnDiskGitRepository(string repoPath, string releaseBranch, IFileSystem fileSystem) { Directory = fileSystem.Directory; var gitPath = FindGitPath(repoPath); var repoRef = new Repository(gitPath); _repository = new ReleaseRepository <IRepository>(gitPath, releaseBranch, repoRef); }
/// <summary> /// Initializes a new instance of the ReleaseService class. /// </summary> /// <param name="unitOfWork">UnitOfWork information</param> public ReleaseService(UnitOfWork unitOfWork) { if (unitOfWork == null) { throw new ArgumentNullException(UnitOfWorkConst); } this.unitOfWork = unitOfWork; this.releaseRepository = new ReleaseRepository(this.unitOfWork); this.projectArtifactService = new ProjectArtifactService(this.unitOfWork); }
public static void RegisterData() { using (EitanDbContext _db = new EitanDbContext()) { var relRepo = new ReleaseRepository(_db); //Static Genres Resource - lives in memory not in db... StaticCode.StaticClients = _db.Clients.Where(w => w.isDeleted == false).OrderBy(o => o.Title).ToDictionary(d => d.ID, d => d.Title); StaticCode.StaticProjectTypes = _db.ProjectTypes.Where(w => w.isDeleted == false).OrderBy(o => o.Title).ToDictionary(d => d.ID, d => d.Title); StaticCode.StaticGenres = _db.Genres.Where(w => w.isDeleted == false).OrderBy(o => o.Title).ToDictionary(d => d.ID, d => d.Title); StaticCode.StaticYears = relRepo.GetReleaseYears(); } }
public OctopusAsyncRepository(IOctopusAsyncClient client) { this.Client = client; Accounts = new AccountRepository(client); ActionTemplates = new ActionTemplateRepository(client); Artifacts = new ArtifactRepository(client); Backups = new BackupRepository(client); BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client); CertificateConfiguration = new CertificateConfigurationRepository(client); Certificates = new CertificateRepository(client); Channels = new ChannelRepository(client); CommunityActionTemplates = new CommunityActionTemplateRepository(client); Configuration = new ConfigurationRepository(client); DashboardConfigurations = new DashboardConfigurationRepository(client); Dashboards = new DashboardRepository(client); Defects = new DefectsRepository(client); DeploymentProcesses = new DeploymentProcessRepository(client); Deployments = new DeploymentRepository(client); Environments = new EnvironmentRepository(client); Events = new EventRepository(client); FeaturesConfiguration = new FeaturesConfigurationRepository(client); Feeds = new FeedRepository(client); Interruptions = new InterruptionRepository(client); LibraryVariableSets = new LibraryVariableSetRepository(client); Lifecycles = new LifecyclesRepository(client); MachinePolicies = new MachinePolicyRepository(client); MachineRoles = new MachineRoleRepository(client); Machines = new MachineRepository(client); Migrations = new MigrationRepository(client); OctopusServerNodes = new OctopusServerNodeRepository(client); PerformanceConfiguration = new PerformanceConfigurationRepository(client); ProjectGroups = new ProjectGroupRepository(client); Projects = new ProjectRepository(client); ProjectTriggers = new ProjectTriggerRepository(client); Proxies = new ProxyRepository(client); Releases = new ReleaseRepository(client); RetentionPolicies = new RetentionPolicyRepository(client); Schedulers = new SchedulerRepository(client); ServerStatus = new ServerStatusRepository(client); Subscriptions = new SubscriptionRepository(client); TagSets = new TagSetRepository(client); Tasks = new TaskRepository(client); Teams = new TeamsRepository(client); Tenants = new TenantRepository(client); TenantVariables = new TenantVariablesRepository(client); UserRoles = new UserRolesRepository(client); Users = new UserRepository(client); VariableSets = new VariableSetRepository(client); Workers = new WorkerRepository(client); WorkerPools = new WorkerPoolRepository(client); }
public UnitOfWork(ApplicationDbContext context, IMapper mapper) { Releases = new ReleaseRepository(context); Sites = new SiteRepository(context); Categories = new CategoryRepository(context, mapper); Words = new WordRepository(context, mapper); ComplexWords = new ComplexWordRepository(context, mapper); Packages = new PackageRepository(context); Enrollments = new EnrollmentRepository(context); PreDbs = new PreDbRepository(context); _context = context; Mapper = mapper; }
public ReleaseRepositoryTests() { var mockLabelSet = new Mock <DbSet <Release> >(); var releases = TestDataGraph.Releases.ReleasesRaw; var data = releases.AsQueryable(); SetupMockDbSet(mockLabelSet, data); SetupMockSetOnMockContext(mockLabelSet); _repository = new ReleaseRepository(MockContext.Object); }
/// <summary> /// Constructor /// </summary> /// <param name="releaseRepository">Document db repository</param> /// <param name="httpContextAccessor">IHttpContextAccessor</param> /// <param name="azureDevOpsBuildClient">IAzureDevOpsBuildClient</param> /// <param name="azureDevOpsOptions">IOptionsMonitor of Type AzureDevOpsSettings</param> public ReleaseService( ReleaseRepository releaseRepository, IHttpContextAccessor httpContextAccessor, IAzureDevOpsBuildClient azureDevOpsBuildClient, IOptionsMonitor <AzureDevOpsSettings> azureDevOpsOptions) { _azureDevOpsSettings = azureDevOpsOptions.CurrentValue; _releaseRepository = releaseRepository; _azureDevOpsBuildClient = azureDevOpsBuildClient; _httpContext = httpContextAccessor.HttpContext; _org = _httpContext.GetRouteValue("org")?.ToString(); _app = _httpContext.GetRouteValue("app")?.ToString(); }
public void ShouldGetPrePatEmailFile() { //given var releaseRepository = new ReleaseRepository(); Stream expectedFile = File.OpenRead(TestPrePatEmail); //when using (FileStream file = (FileStream)releaseRepository.GetPrePatEmailFile(TestPrePatEmail)) { //then Assert.That(file, Is.EqualTo(expectedFile)); Assert.That(file.Name, Is.EqualTo(ToAbsolutePath(TestPrePatEmail))); } }
public void GetLatestPublishedRelease_PublicationIdNotFound() { var builder = new DbContextOptionsBuilder <StatisticsDbContext>(); builder.UseInMemoryDatabase(Guid.NewGuid().ToString()); var options = builder.Options; using (var context = new StatisticsDbContext(options, null)) { var repository = new ReleaseRepository(context); var result = repository.GetLatestPublishedRelease(Guid.NewGuid()); Assert.Null(result); } }
public void ShouldSaveReleaseData() { //given var releaseRepository = new ReleaseRepository(); //todo: put this inside the builder (for instante on the Build method as default) var expectedReleaseDetailsModel = new ReleaseBuilder().WithReleaseNumber("REL01").Build(); //when releaseRepository.SaveReleaseDetails(expectedReleaseDetailsModel); //then Release release = releaseRepository.GetReleaseDetails("REL01"); Assert.That(release, Is.EqualTo(expectedReleaseDetailsModel)); }
/// <summary> /// Constructor /// </summary> public DeploymentService( IOptionsMonitor <AzureDevOpsSettings> azureDevOpsOptions, IAzureDevOpsBuildClient azureDevOpsBuildClient, IHttpContextAccessor httpContextAccessor, ReleaseRepository releaseRepository, DeploymentRepository deploymentRepository, IApplicationInformationService applicationInformationService) { _azureDevOpsBuildClient = azureDevOpsBuildClient; _releaseRepository = releaseRepository; _deploymentRepository = deploymentRepository; _applicationInformationService = applicationInformationService; _azureDevOpsSettings = azureDevOpsOptions.CurrentValue; _httpContext = httpContextAccessor.HttpContext; _org = _httpContext.GetRouteValue("org")?.ToString(); _app = _httpContext.GetRouteValue("app")?.ToString(); }
public async Task <int> InitiateRelease(int ReleaseID) { int count = 0; Release currentRelease; using (IReleaseRepository db = new ReleaseRepository()) { currentRelease = db.getReleaseForInitiateCheckList(ReleaseID); } using (IVendorRepository DB = new VendorRepository()) { Vendor currentVendor = new VendorRepository().Where(v => v.Name == "Amdocs").Include(v => v.ReleaseVendors).FirstOrDefault(); var Areas = currentRelease.ReleaseAreaOwners.Where(a => a.IsChecked == true).ToList(); List <VendorAreas> newVendorAreas = new List <VendorAreas>(); List <ReleaseVendor> ReleaseVendors = new List <ReleaseVendor>(); Areas.ForEach(r => { var newObj = new VendorAreas() { VendorID = currentVendor.VendorID, AreaID = r.AreaID, IsChecked = true }; newVendorAreas.Add(newObj); }); currentVendor.VendorAreass = newVendorAreas; var currentReleaseVendor = currentVendor.ReleaseVendors.FirstOrDefault(v => v.ReleaseID == ReleaseID); if (currentReleaseVendor == null) { currentVendor.ReleaseVendors = new List <ReleaseVendor>() { new ReleaseVendor() { ReleaseID = ReleaseID, VendorID = currentVendor.VendorID, IsFullTrack = true } } } ; count += await DB.EditVendor(currentVendor, currentRelease, (WindowsPrincipal)User); } return(count); }
public static void SetSesionReleaseID(int ReleaseID) { if (ReleaseID == 0) { System.Web.HttpContext.Current.Session["ReleaseID"] = null; System.Web.HttpContext.Current.Session["ReleaseName"] = null; return; } if (System.Web.HttpContext.Current.Session["ReleaseID"] == null || System.Web.HttpContext.Current.Session["ReleaseName"] == null || (int)System.Web.HttpContext.Current.Session["ReleaseID"] != ReleaseID) { using (IReleaseRepository db = new ReleaseRepository()) { System.Web.HttpContext.Current.Session["ReleaseName"] = db.GetSelect(r => r.ReleaseID == ReleaseID, r => new { r.Name }).FirstOrDefault().Name; System.Web.HttpContext.Current.Session["ReleaseID"] = ReleaseID; } } }
public PartialViewResult _ViewStatusHeader(int releaseId) {//need to delete this view from releases using (ReleaseProductRepository db = new ReleaseProductRepository()) { ViewBag.productsName = db.GetAllFamilyProductsNamesByRealeaseId(releaseId); } using (ReleaseRepository db = new ReleaseRepository()) { var release = db.GetReleseForStatus(releaseId); status.Details = new ReleaseGeneralDetails(); status.Details.AccountName = release.Account.Name; status.Details.Name = release.Name; status.Details.Size = release.Size; status.Details.LOB = release.LOB; status.Details.ReleaseID = release.ReleaseID; } return(PartialView(status.Details)); }
public OctopusRepository(IOctopusClient client) { this.Client = client; Feeds = new FeedRepository(client); Backups = new BackupRepository(client); Machines = new MachineRepository(client); MachineRoles = new MachineRoleRepository(client); MachinePolicies = new MachinePolicyRepository(client); Subscriptions = new SubscriptionRepository(client); Environments = new EnvironmentRepository(client); Events = new EventRepository(client); FeaturesConfiguration = new FeaturesConfigurationRepository(client); ProjectGroups = new ProjectGroupRepository(client); Projects = new ProjectRepository(client); Proxies = new ProxyRepository(client); Tasks = new TaskRepository(client); Users = new UserRepository(client); VariableSets = new VariableSetRepository(client); LibraryVariableSets = new LibraryVariableSetRepository(client); DeploymentProcesses = new DeploymentProcessRepository(client); Releases = new ReleaseRepository(client); Deployments = new DeploymentRepository(client); Certificates = new CertificateRepository(client); Dashboards = new DashboardRepository(client); DashboardConfigurations = new DashboardConfigurationRepository(client); Artifacts = new ArtifactRepository(client); Interruptions = new InterruptionRepository(client); ServerStatus = new ServerStatusRepository(client); UserRoles = new UserRolesRepository(client); Teams = new TeamsRepository(client); RetentionPolicies = new RetentionPolicyRepository(client); Accounts = new AccountRepository(client); Defects = new DefectsRepository(client); Lifecycles = new LifecyclesRepository(client); OctopusServerNodes = new OctopusServerNodeRepository(client); Channels = new ChannelRepository(client); ProjectTriggers = new ProjectTriggerRepository(client); Schedulers = new SchedulerRepository(client); Tenants = new TenantRepository(client); TagSets = new TagSetRepository(client); BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client); ActionTemplates = new ActionTemplateRepository(client); CommunityActionTemplates = new CommunityActionTemplateRepository(client); }
// fill the view model-Releases public ActionResult AjaxHandler(jQueryDataTableParamModel param) { List <ReleaseView> Releases = new List <ReleaseView>(); int CountRecord = 0; using (IReleaseRepository Db = new ReleaseRepository()) { Releases = Db.GetByFiltering(param.iDisplayStart, param.iDisplayLength, param.SortBy, param.sSearch, out CountRecord).ToList(); } return(Json(new { sEcho = param.sEcho, iTotalRecords = CountRecord, iTotalDisplayRecords = CountRecord, aaData = Releases }, JsonRequestBehavior.AllowGet)); }
public ActionResult Autocomplete(String term = null) { // List<Releases> Releases = new List<Releases>(); // using (ReleaseRepository Db = new ReleaseRepository()) // { // Db.GetReleaseJoinAccount().ToList().ForEach(ra => Releases.Add(new Releases(ra))); // } // Releases.Where(r => (r.ReleaseID.ToString().Contains(term) // || r.AccountName.Contains(term) // || r.PrepFPName.Contains(term) // || r.ReleaseName.Contains(term) // || r.SPNameEmployee.Contains(term) // || r.ProgramMeEmployee.Contains(term) // || r.ProductionStartDate.Contains(term) //) // ); // Releases= Releases.Skip(10).ToList(); // return Json(Releases, JsonRequestBehavior.AllowGet); using (IReleaseRepository db = new ReleaseRepository()) { List <String> filteredItems = new List <String>(); var filter = db.GetReleaseJoinAccountBySearch(term); if (filter == null) { return(null); } filter.ToList().ForEach( item => filteredItems.Add(item.Name) ); //foreach (var item in collection) //{ //} // var filteredItems = items.Where( //item => item.IndexOf(term, StringComparison.InvariantCultureIgnoreCase) >= 0 //); return(Json(filteredItems, JsonRequestBehavior.AllowGet)); } }
static async Task Main(string[] args) { var releaseRepository = new ReleaseRepository(); var taskItemRepository = new TaskItemRepository(); var taskItemList = await taskItemRepository.GetTaskItemListAsync( new DateTimeOffset(new DateTime(2015, 1, 1), TimeSpan.Zero), DateTimeOffset.Now); var newTaskItemList = new List <TaskItem>(); foreach (var taskItem in taskItemList) { taskItem.Release = await releaseRepository.GetFirstReleaseBeforeDateAsync(taskItem.FinishTime); newTaskItemList.Add(taskItem); Console.WriteLine($"Determined Task {taskItem.Id}'s Release is {taskItem.Release.Id}."); } await taskItemRepository.InsertTaskItemListAsync(newTaskItemList); }
public void ShouldSavePrePatEmailFile() { //given Stream expectedStream = File.OpenRead(TestPrePatEmail); var releaseRepository = new ReleaseRepository(); string filename = TestPrePatEmail + DateTime.Now.ToString("-yy-MM-dd-HH-mm-ss") + ".msg"; //when releaseRepository.SavePrePatEmailFile(filename, expectedStream); string actualFilename = ToAbsolutePath(filename); using (FileStream file = File.OpenRead(actualFilename)) { Assert.That(file, Is.EqualTo(expectedStream)); Assert.That(file.Name, Is.EqualTo(actualFilename)); } //TearDown File.Delete(actualFilename); }
public void ShouldGetAllReleases() { //given var releaseRepository = new ReleaseRepository(); var expectedReleaseDetailsModels = new List<Release> { new ReleaseBuilder().WithReleaseNumber("REL01").Build(), new ReleaseBuilder().WithReleaseNumber("REL02").Build(), new ReleaseBuilder().Build(), new ReleaseBuilder().WithReleaseNumber("REL1234").Build() }; //when foreach (Release expectedReleaseDetailsModel in expectedReleaseDetailsModels) { releaseRepository.SaveReleaseDetails(expectedReleaseDetailsModel); } // then IEnumerable<Release> releaseDetailsModels = releaseRepository.GetReleases(); Assert.That(releaseDetailsModels, Is.EqualTo(expectedReleaseDetailsModels)); }
public PartialViewResult _ReleaseFooter(int releaseId) { Release releaseFooter; //if after Save if (CurrentRelease == null || CurrentRelease.ReleaseId != releaseId) { if (releaseId == 0) { return(PartialView()); } else { using (IReleaseRepository db = new ReleaseRepository()) { releaseFooter = db.GetReleaseCPData(releaseId); } } } else { releaseFooter = CurrentRelease.Release; } if (releaseFooter != null && releaseId != 0) { foreach (var rm in releaseFooter.ReleaseMilestones) { ViewData[rm.Milestone.Name] = String.Format("{0:d-MMM-yyyy}", rm.MilestoneDate); } ReleaseCPView rcpview; foreach (var rcp in releaseFooter.ReleaseCPs) { rcpview = new ReleaseCPView(rcp, releaseFooter.Account.Name); ViewData[rcpview.CPName.Trim().Replace(" ", String.Empty)] = rcpview.PlannedDate != null ? "(" + String.Format("{0:d-MMM-yyyy}", rcpview.PlannedDate) + ")" : String.Empty; ViewData[rcpview.CPName.Trim().Replace(" ", String.Empty) + "id"] = rcpview.ReleaseCPID; } } return(PartialView()); }
public void ShouldGetAllReleases() { //given var releaseRepository = new ReleaseRepository(); var expectedReleaseDetailsModels = new List <Release> { new ReleaseBuilder().WithReleaseNumber("REL01").Build(), new ReleaseBuilder().WithReleaseNumber("REL02").Build(), new ReleaseBuilder().Build(), new ReleaseBuilder().WithReleaseNumber("REL1234").Build() }; //when foreach (Release expectedReleaseDetailsModel in expectedReleaseDetailsModels) { releaseRepository.SaveReleaseDetails(expectedReleaseDetailsModel); } // then IEnumerable <Release> releaseDetailsModels = releaseRepository.GetReleases(); Assert.That(releaseDetailsModels, Is.EqualTo(expectedReleaseDetailsModels)); }
public GitHubSourcePublisher(ISourceRepositoryProvider repositoryProvider) { _repoRef = repositoryProvider.RepositoryRef as ReleaseRepository <IRepository>; this.repo = _repoRef.GetRepositoryReference(); }
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); }
public void GetLatestPublishedRelease() { var builder = new DbContextOptionsBuilder <StatisticsDbContext>(); builder.UseInMemoryDatabase(Guid.NewGuid().ToString()); var options = builder.Options; using (var context = new StatisticsDbContext(options, null)) { var publicationAId = Guid.NewGuid(); var publicationBId = Guid.NewGuid(); var publicationARelease1 = new Release { Id = Guid.NewGuid(), PublicationId = publicationAId, Published = DateTime.UtcNow, Slug = "publication-a-release-1", TimeIdentifier = AcademicYearQ1, Year = 2018 }; var publicationARelease2 = new Release { Id = Guid.NewGuid(), PublicationId = publicationAId, Published = DateTime.UtcNow, Slug = "publication-a-release-2", TimeIdentifier = AcademicYearQ4, Year = 2017 }; var publicationARelease3 = new Release { Id = Guid.NewGuid(), PublicationId = publicationAId, Published = null, Slug = "publication-a-release-3", TimeIdentifier = AcademicYearQ2, Year = 2018 }; var publicationBRelease1 = new Release { Id = Guid.NewGuid(), PublicationId = publicationBId, Published = DateTime.UtcNow, Slug = "publication-b-release-1", TimeIdentifier = AcademicYearQ1, Year = 2018 }; context.AddRange(new List <Release> { publicationARelease1, publicationARelease2, publicationARelease3, publicationBRelease1 }); context.SaveChanges(); var repository = new ReleaseRepository(context); var result = repository.GetLatestPublishedRelease(publicationAId); Assert.Equal(publicationARelease1, result); } }
public async Task <int> SaveNewRelease(int ReleaseID, ReleaseTabs UpdateRelease) { Release ReleaseTemp = null; int count = 0; try { using (IReleaseRepository db = new ReleaseRepository()) { ReleaseTemp = new Release() { AccountID = UpdateRelease.GeneralDetails.AccountID, Name = UpdateRelease.GeneralDetails.Name, Size = UpdateRelease.GeneralDetails.Size, LOB = UpdateRelease.GeneralDetails.LOB, AdditionalProducts = UpdateRelease.ProductsInScope.Release.AdditionalProducts, ReleaseStakeholders = new List <ReleaseStakeholder>(), ReleaseAreaOwners = new List <ReleaseAreaOwner>(), ReleaseFamilyProducts = new List <ReleaseFamilyProduct>(), ReleaseProducts = new List <ReleaseProduct>(), ReleaseMilestones = new List <ReleaseMilestone>(), ReleaseCharacteristics = new List <ReleaseCharacteristic>() }; UpdateRelease.ReleaseMilestones.ToList().ForEach( prop => ReleaseTemp.ReleaseMilestones.Add(new ReleaseMilestone() { MilestoneID = prop.MilestoneID, MilestoneDate = prop.MilestoneDate }) ); UpdateRelease.ReleaseStakeholders.ToList().ForEach( prop => ReleaseTemp.ReleaseStakeholders.Add(new ReleaseStakeholder() { StakeholderID = prop.StakeholderID, EmployeeID1 = prop.EmployeeID1, EmployeeID2 = prop.EmployeeID2 }) ); UpdateRelease.AreaOwners.ToList().ForEach( prop => ReleaseTemp.ReleaseAreaOwners.Add(new ReleaseAreaOwner() { AreaID = prop.AreaID, AmdocsFocalPoint1ID = prop.AmdocsFocalPoint1ID, AmdocsFocalPoint2ID = prop.AmdocsFocalPoint2ID, IsChecked = prop.IsChecked, CustomerFocalpoint1 = prop.CustomerFocalPoint1, CustomerFocalPoint2 = prop.CustomerFocalPoint2, Resposibility = prop.Resposibility }) ); UpdateRelease.ReleaseCharacteristic.ToList().ForEach( prop => ReleaseTemp.ReleaseCharacteristics.Add(new ReleaseCharacteristic() { CharacteristicID = prop.CharacteristicID, IsChecked = prop.IsChecked }) ); UpdateRelease.ProductsInScope.FamilyProducts.ToList().ForEach(prop => { ReleaseTemp.ReleaseFamilyProducts.Add(new ReleaseFamilyProduct() { FamilyProductID = prop.ID, IsChecked = prop.IsChecked }); prop.Products.ToList().ForEach(rp => ReleaseTemp.ReleaseProducts.Add(new ReleaseProduct() { ProductID = rp.ID, IsChecked = rp.IsChecked }) ); }); //ReleaseTemp.ReleaseCharacteristics = new List<ReleaseCharacteristic>(); //using (IReleaseRepository db = new ReleaseRepository()) //{ // using (var transactionScope = new TransactionScope()) // { // db.Add(ReleaseTemp); // await db.SaveAsync((WindowsPrincipal)User); // transactionScope.Complete(); // } //} db.Add(ReleaseTemp); count += await db.SaveAsync((WindowsPrincipal)User); await AddCPs(ReleaseTemp.ReleaseID); } } catch (Exception ex) { count = -1; } return(count > 0 ? ReleaseTemp.ReleaseID : count); }
public ReleaseLogic(ReleaseRepository releaseRepository) { this.releaseRepository = releaseRepository; }
public void ShouldGetPrePatEmailFile() { //given var releaseRepository = new ReleaseRepository(); Stream expectedFile = File.OpenRead(TestPrePatEmail); //when using (FileStream file = (FileStream) releaseRepository.GetPrePatEmailFile(TestPrePatEmail)) { //then Assert.That(file, Is.EqualTo(expectedFile)); Assert.That(file.Name, Is.EqualTo(ToAbsolutePath(TestPrePatEmail))); } }