public Member RetrieveMemberByCredentials(ATAEntities context, string userName, string password)
 {
     string currentUserHashedPassword = CreatePasswordHash(password);
     Member currentMember = context.Members.Where(m => m.UserName.Equals(userName) && m.Password.Equals(currentUserHashedPassword)).FirstOrDefault();
  
     return currentMember;
 }
 public void AddNew(ATAEntities context, string agentMachineName, string ip, string workingDir)
 {
     //try
     //{
         AgentMachine am = new AgentMachine()
         {
             Name = agentMachineName,
             Ip = ip,
             WorkingDirPath = workingDir
         };
         context.AgentMachines.Add(am);
         context.SaveChanges();
     //}
     //catch (DbEntityValidationException e)
     //{
     //    foreach (var eve in e.EntityValidationErrors)
     //    {
     //        StreamWriter sw = new StreamWriter("validationErros.txt");
     //        sw.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
     //            eve.Entry.Entity.GetType().Name, eve.Entry.State);
     //        foreach (var ve in eve.ValidationErrors)
     //        {
     //            sw.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
     //                ve.PropertyName, ve.ErrorMessage);
     //        }
     //        sw.Close();
     //    }
     //    throw;
     //}
 }
Example #3
0
        public List<Test> GetAllTestsByProjectName(ATAEntities context, string projectName)
        {
            ATADataModel.Project p = ATACore.Managers.ProjectManager.GetByName(context, projectName);
            List<Test> tests = p.Tests.Where(t => t.DeletionDate.Equals(DateTime.MinValue)).ToList();

            return tests;
        }
Example #4
0
 public void AddNewTest(ATAEntities context, int projectId, Test testToAdd)
 {
     ATADataModel.Project p = ATACore.Managers.ProjectManager.GetById(context, projectId);
     testToAdd.AdditionDate = DateTime.Now;
     p.Tests.Add(testToAdd);
     context.SaveChanges();
 }
 private static void AddTeamsToNewMember(ATAEntities context, List<string> teams, Member newMember)
 {
     teams.ForEach(t =>
     {
         Team currentTeam = ATACore.Managers.TeamManager.GetTeamByName(context, t);
         newMember.Teams.Add(currentTeam);
     });
 }
Example #6
0
 public List<Team> GetAllUserTeams(ATAEntities context, string userName)
 {
     Member member = ATACore.Managers.MemberManager.GetMemberByUserName(context, userName);
     if (member.UserMemberRole.Equals(MemberRoles.Admin))
         return context.Teams.ToList(); 
     else  
         return member.Teams.ToList();
 }
Example #7
0
 private static void AddProjectsToNewTeam(ATAEntities context, List<string> projects, Team team)
 {
     projects.ForEach(t =>
     {
         ATADataModel.Project currentProject = ATACore.Managers.ProjectManager.GetByName(context, t);
         team.Projects.Add(currentProject);
     });
 }
Example #8
0
 private static void AddAgentMachinesToNewTeam(ATAEntities context, List<string> agentMachines, Team team)
 {
     agentMachines.ForEach(t =>
     {
         ATADataModel.AgentMachine currentAgentMachine = ATACore.Managers.AgentMachineManager.GetByName(context, t);
         team.AgentMachines.Add(currentAgentMachine);
     });
 }
 private static void AddAdditionalPathsToNewProject(ATAEntities context, List<string> addiotionalPaths, ATADataModel.Project project)
 {
     addiotionalPaths.ForEach(t =>
     {
         ATADataModel.AdditionalPath currentAdditionalPath = ATACore.Managers.AdditionalPathManager.GetByName(context, t);
         project.AdditionalPaths.Add(currentAdditionalPath);
     });
 }
 public List<string> GetRoles()
 {
     if (Roles == null)
     {
         var context = new ATAEntities();
         Roles = context.MemberRoles.Select(x => x.Role).ToList();
     }
     return Roles;
 }
 public void AddNew(ATAEntities context, string tfsPath, string tfsUrl)
 {
     AdditionalPath ap = new AdditionalPath()
     {
         TfsPath = tfsPath,
         TfsUrl = tfsUrl
     };
     context.AdditionalPaths.Add(ap);
     context.SaveChanges();
 }
 public void ApproveUser(ATAEntities context, string userName, MemberRoles newMemberRole)
 {
     Member memberToBeApproved = context.Members.Where(x => x.UserName.Equals(userName)).FirstOrDefault();
     ActivationCode ac = GenerateNewActivationCode();
     memberToBeApproved.ActivationCodes.Add(ac);
     memberToBeApproved.UserMemberRole = newMemberRole;
     memberToBeApproved.StatusId = (int)Statuses.PendingActivation;
     SendActivationEmail(memberToBeApproved);
     context.SaveChanges();
 }
 public bool IsActivationCodeValid(string userName, string code)
 {
     bool isValid = true;
     using (ATAEntities context = new ATAEntities())
     {
         Member m = ATACore.Managers.MemberManager.GetMemberByUserName(context, userName);
         var query = m.ActivationCodes.Where(c => c.Code.Equals(code) && c.ExpirationDate > DateTime.Now);
         isValid = query.ToList().Count > 0 ? true : false;
     }
     return isValid;
 }
        public List<ExecutionResultRun> GetAllByTeams(ATAEntities context, List<Team> teams)
        {
            List<ExecutionResultRun> executionResultRuns = new List<ExecutionResultRun>();
            foreach (Team cTeam in teams)
	        {
		       var allExecutionResultRunsForTeam = context.ExecutionResultRuns.Where(e => e.Member.Teams.Where(t => t.TeamId.Equals(cTeam.TeamId)).Count() > 0);
               executionResultRuns.AddRange(allExecutionResultRunsForTeam.ToList());
	        }

            return executionResultRuns;
        }   
Example #15
0
 public void AddNew(ATAEntities context, string teamName, List<string> projectNames, List<string> agentMachines)
 {
     Team team = new Team()
     {
         Name = teamName
     };
     AddProjectsToNewTeam(context, projectNames, team);
     AddAgentMachinesToNewTeam(context, agentMachines, team);
     context.Teams.Add(team);
     context.SaveChanges();
 }
 public void AddNew(ATAEntities context, string projectName, string tfsPath, string tfsUrl, List<string> addiotionalPaths)
 {
     ATADataModel.Project project = new ATADataModel.Project()
     {
         Name = projectName,
         TfsPath = tfsPath,
         TfsUrl = tfsUrl
     };
     AddAdditionalPathsToNewProject(context, addiotionalPaths, project);
     context.Projects.Add(project);
     context.SaveChanges();
 }
 public List<CheckedItem> GetTeams()
 {
     if (teams == null)
     {
         var context = new ATAEntities();
         var query = from x in context.Teams
                     select new CheckedItem
                     {
                         Description = x.Name,
                         Selected = false
                     };
         teams = query.ToList();           
     }
     return teams;
 }
  private void btnLogin_Click(object sender, RoutedEventArgs e)
  {
      ResetValidationMessage();
      MemberProxy.Password = tbPassword.Password;
      bool areFilled = MemberProxy.AreRequiredCredentialsFieldsFilled();
      if (!areFilled)
      {
          DisplayValidationMessage(RequiredFieldsValidationMessage);
          return;              
      }
 
      var context = new ATAEntities();
      Member currentMember = ATACore.Managers.MemberManager.RetrieveMemberByCredentials(ATACore.Managers.ContextManager.Context, this.tbMemberUserName.Text, tbPassword.Password);
      ATACore.Managers.ContextManager.Context.Dispose();
      if (currentMember != null)
          ResolveStatus(currentMember);
      else
          DisplayIncorrectUserCredentialsMessage();
   
  }
 public Member CreateUser(ATAEntities context, string userName, string password, string email, string tfsUserName, string role, List<string> teams, string comment)
 {
     string hashedPassword = CreatePasswordHash(password);
     MemberRole currentMemberRole = ATACore.Managers.MemberRoleManager.GetMemberRoleByRoleName(context, role);
     Member newMember = new Member()
     {
         UserName = userName,
         Password = hashedPassword,
         Email = email,
         Comment = comment,
         TfsUserName = tfsUserName,
         MemberRoleId = currentMemberRole.MemberRoleId
     };
     newMember.StatusId = (int)Statuses.ToBeApproved;
     AddTeamsToNewMember(context, teams, newMember);
     context.Members.Add(newMember);
     context.SaveChanges();
     
     return newMember;
 }
Example #20
0
 public void RemoveTest(ATAEntities context, int projectId, Test testToRemove)
 {
     ATADataModel.Project p = ATACore.Managers.ProjectManager.GetById(context, projectId);
     testToRemove.DeletionDate = DateTime.Now;
     context.SaveChanges();
 }
Example #21
0
        public Test GetTestByTestId(ATAEntities context, int testId)
        {
            Test test = context.Tests.Where(t => t.TestId.Equals(testId)).FirstOrDefault();

            return test;
        }
Example #22
0
        public Test GetTestByMethodId(ATAEntities context, string methodId)
        {
            Test test = context.Tests.Where(t => t.MethodId.Equals(methodId)).FirstOrDefault();

            return test;
        }
 public List<Member> GetAllMembersForApproval(ATAEntities context)
 {
     var query = context.Members.Where(m => m.StatusId.Equals(2));
     return query.ToList();
 }
 public string GetTfsUserNameByUserName(ATAEntities context, string currentUserName)
 {
     Member m = GetMemberByUserName(context, currentUserName);
     return m.TfsUserName;
 }
        public Member GetMemberByUserName(ATAEntities context, string userName)
        {
            Member member = context.Members.Where(x => x.UserName.Equals(userName)).FirstOrDefault();

            return member;
        }
Example #26
0
 public Team GetTeamByName(ATAEntities context, string name)
 {
     Team currentTeam = context.Teams.Where(x => x.Name.Equals(name)).FirstOrDefault();
     return currentTeam;
 }
 public AdditionalPath GetByName(ATAEntities context, string tfsPath)
 {
     return context.AdditionalPaths.Where(a => a.TfsPath.Equals(tfsPath)).FirstOrDefault();
 }
 public List<AdditionalPath> GetAll(ATAEntities context)
 {
     return context.AdditionalPaths.ToList();
 }
 public List<ATADataModel.AdditionalPath> GetAllAdditionalPathsByProjectId(ATAEntities context, int projectId)
 {
     IQueryable<ATADataModel.Project> projects = context.Projects.Where(p => p.ProjectId.Equals(projectId));
     var additionalPaths = projects.FirstOrDefault().AdditionalPaths;
     return additionalPaths.ToList();
 }
 public void ActivateUser(ATAEntities context, string userName)
 {
     Member memberToBeApproved = GetMemberByUserName(context, userName);
     memberToBeApproved.StatusId = (int)Statuses.Active;
     context.SaveChanges();
 }