Esempio n. 1
0
 public static List<TestEnvironment> GetAllEnvironments()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.TestEnvironments.ToList<TestEnvironment>();
     }
 }
Esempio n. 2
0
 public static Release GetReleaseById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Releases.Find(id);
     }
 }
Esempio n. 3
0
 public static Release GetReleaseByName(string name)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Releases.Where(r => r.Name.ToLower() == name.ToLower()).FirstOrDefault();
     }
 }
Esempio n. 4
0
 public static List<Project> GetAllProjects()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Projects.OrderBy(p => p.ProjectId).ToList();
     }
 }
Esempio n. 5
0
 public static Provider GetProviderById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Providers.Find(id);
     }
 }
Esempio n. 6
0
 public static ProjectEnvironmentMap GetProductEnvironmentMapById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.ProjectEnvironmentMaps.Find(id);
     }
 }
Esempio n. 7
0
 public static List<Product> GetAllProducts()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Products.ToList<Product>();
     }
 }
Esempio n. 8
0
 public static List<Ranking> GetAllRankings()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Rankings.OrderBy(r => r.Name).ToList<Ranking>();
     }
 }
Esempio n. 9
0
 public static Ranking GetRankingById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Rankings.Find(id);
     }
 }
Esempio n. 10
0
 public static SupportedEnvironment GetSupportedEnvironmentById(int environmentId)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.SupportedEnvironments.Find(environmentId);
     }
 }
Esempio n. 11
0
 public static List<SupportedEnvironment> GetSupportedEnvironments()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.SupportedEnvironments.ToList<SupportedEnvironment>();
     }
 }
Esempio n. 12
0
        public static SupportedEnvironment Add(SupportedEnvironment supportedEnvironment)
        {
            using (ES1AutomationEntities context = new ES1AutomationEntities())
            {
                int environmentId = 0;
                try
                {
                    environmentId = (from e in context.SupportedEnvironments select e.EnvironmentId).Max() + 1;
                }
                catch (Exception e)
                {
                    ATFEnvironment.Log.logger.Error(e);
                    environmentId = 1;
                }
                if (SupportedEnvironment.GetSupportedEnvironmentById(environmentId) != null)
                {
                    return null;
                }

                supportedEnvironment.EnvironmentId = environmentId;
                SupportedEnvironment supportEnvironmentAdded = context.SupportedEnvironments.Add(supportedEnvironment);
                context.SaveChanges();
                return supportEnvironmentAdded;
            }
        }
Esempio n. 13
0
 public static Subscriber GetSubscriberById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Subscribers.Find(id);
     }
 }
Esempio n. 14
0
 public static List<Subscriber> GetAllSubscribers()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Subscribers.ToList();
     }
 }
Esempio n. 15
0
File: User.cs Progetto: wangn6/rep2
 public static void Delete(int userId)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         Delete(GetUserById(userId));
     }
 }
Esempio n. 16
0
 public static List<Branch> GetAllBranches()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Branches.ToList<Branch>();
     }
 }
Esempio n. 17
0
 public static List<ProjectEnvironmentMap> GetAllProductEnvironmentMap()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.ProjectEnvironmentMaps.ToList<ProjectEnvironmentMap>();
     }
 }
Esempio n. 18
0
 public static Branch GetBranchById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Branches.Find(id);
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Get all the branches for the product
 /// </summary>
 /// <param name="productID">product ID</param>
 /// <returns>List<Build>List of branches</returns>
 public static List<Branch> GetAllBranchesForProduct(int productID, int type)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Branches.Where(b => b.ProductId == productID && b.Type== type).OrderBy(b => b.Name).ToList();
     }
 }
Esempio n. 20
0
 public static Branch GetBranchByName(string name)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Branches.Where(b => b.Name.ToLower() == name.ToLower()).FirstOrDefault();
     }
 }
Esempio n. 21
0
 /// <summary>
 /// Get all the releases for the product
 /// </summary>
 /// <param name="productID">product ID</param>
 /// <returns>List<Build>List of releases</returns>
 public static List<Release> GetAllReleasesForProduct(int productID, int type)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Releases.Where(r => r.ProductId == productID && r.Type == type).OrderBy(r => r.Name).ToList();
     }
 }
Esempio n. 22
0
 public static List<Release> GetAllReleases()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.Releases.ToList<Release>();
     }
 }
Esempio n. 23
0
        public static List<AutomationTask> GetLatestNAutomationTasksForProject(int projectId, int count)
        {
            using (ES1AutomationEntities context = new ES1AutomationEntities())
            {
                IList<AutomationTask> tasks = (from task in context.AutomationTasks
                                      from build in context.Builds
                                      where task.BuildId == build.BuildId &&
                                      task.ProjectId == projectId &&
                                          //task.NotifyStakeholders == true &&
                                      (task.Status == (int)TaskStatus.Complete || task.Status == (int)TaskStatus.End || task.Status == (int)TaskStatus.Failed) &&
                                      task.RecurrencePattern.Value == (int)RecurrencePattern.AtOnce
                                      orderby task.TaskId descending
                                      select task).ToList();
                IList<Build> builds = (from task in context.AutomationTasks
                                      from build in context.Builds
                                      where task.BuildId == build.BuildId &&
                                      task.ProjectId == projectId &&
                                          //task.NotifyStakeholders == true &&
                                      (task.Status == (int)TaskStatus.Complete || task.Status == (int)TaskStatus.End || task.Status == (int)TaskStatus.Failed) &&
                                      task.RecurrencePattern.Value == (int)RecurrencePattern.AtOnce
                                      orderby task.TaskId descending
                                      select build).ToList();
                int r;
                List<AutomationTask> nTasks = (from build in builds
                                               from task in tasks
                                               where build.BuildId == task.BuildId
                                               orderby (int.TryParse(build.Number, out r) ? r : 0) descending
                                               select task).Take(count).ToList();

                return nTasks;
            }
        }
Esempio n. 24
0
File: Build.cs Progetto: wangn6/rep2
 public static void Delete(int buildId)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         Delete(GetBuildById(buildId));
     }
 }
Esempio n. 25
0
 public static DiagnosticLog GetDiagnosticLogById(int id)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.DiagnosticLogs.Find(id);
     }
 }
Esempio n. 26
0
 public static void Delete(int environmentId)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         Delete(GetEnvironmentById(environmentId));
     }
 }
Esempio n. 27
0
 public static List<DiagnosticLog> GetAllDiagnosticLogs()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         return context.DiagnosticLogs.ToList();
     }
 }
Esempio n. 28
0
 public static void ClearDiagnosticLog()
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         context.DiagnosticLogs.RemoveRange(context.DiagnosticLogs);
         context.SaveChanges();
     }
 }
Esempio n. 29
0
 public static Build GetLatestBuildByProductBranchAndRelease(int productId, int branchId, int releaseId)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         IList<Build> builds = context.Builds.Where(b => b.ProductId == productId && b.BranchId == branchId && b.ReleaseId == releaseId).ToList();
         return builds.OrderByDescending(b => int.Parse(b.Number.Split(new string[] { "." }, StringSplitOptions.None)[b.Number.Split(new string[] { "." }, StringSplitOptions.None).Length - 1])).FirstOrDefault();
     }
 }
Esempio n. 30
0
 public static DiagnosticLog AddDiagnosticLog(DiagnosticLog log)
 {
     using (ES1AutomationEntities context = new ES1AutomationEntities())
     {
         context.DiagnosticLogs.Add(log);
         context.SaveChanges();
         return log;
     }
 }