コード例 #1
0
        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;
            //}
        }
コード例 #2
0
        public void ActivateUser(ATAEntities context, string userName)
        {
            Member memberToBeApproved = GetMemberByUserName(context, userName);

            memberToBeApproved.StatusId = (int)Statuses.Active;
            context.SaveChanges();
        }
コード例 #3
0
ファイル: TestManager.cs プロジェクト: rohanbaraskar/Projects
 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();
 }
コード例 #4
0
        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();
        }
コード例 #5
0
        public void AddNew(ATAEntities context, string tfsPath, string tfsUrl)
        {
            AdditionalPath ap = new AdditionalPath()
            {
                TfsPath = tfsPath,
                TfsUrl  = tfsUrl
            };

            context.AdditionalPaths.Add(ap);
            context.SaveChanges();
        }
コード例 #6
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();
        }
コード例 #7
0
 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();
 }
コード例 #8
0
        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);
        }
コード例 #9
0
 public void Save(ATAEntities context, TestResultRun testResultRun)
 {
     context.TestResultRuns.Add(testResultRun);
     context.SaveChanges();
 }
コード例 #10
0
 public void Save(ATAEntities context, ExecutionResultRun executionResultRun)
 {
     context.ExecutionResultRuns.Add(executionResultRun);
     context.SaveChanges();
 }
コード例 #11
0
ファイル: TestManager.cs プロジェクト: rohanbaraskar/Projects
 public void RemoveTest(ATAEntities context, int projectId, Test testToRemove)
 {
     ATADataModel.Project p = ATACore.Managers.ProjectManager.GetById(context, projectId);
     testToRemove.DeletionDate = DateTime.Now;
     context.SaveChanges();
 }