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;
     //}
 }
Esempio n. 2
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);
     });
 }
 public AgentMachineViewModel(AgentMachine a)
 {
     base.Name = a.Name;
     base.Ip = a.Ip.Trim();
     base.WorkingDirPath = a.WorkingDirPath;
     base.AgentMachineId = a.AgentMachineId;
     IsWorking = false;
 }