Exemplo n.º 1
0
 public void Add()
 {
     if (!IsEdit)
     {
         string x = TeamTypeService.Add(Type);
         if (x == null)
         {
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
     else
     {
         toEdit.Name = Type;
         string x = TeamTypeService.Edit(toEdit);
         if (x == null)
         {
             TryClose();
         }
         else
         {
             Error = x;
         }
     }
 }
Exemplo n.º 2
0
        public AddTeamViewModel(TeamDTO team)
        {
            IsEdit             = true;
            ButtonLabel        = "Edit";
            TeamTypes          = TeamTypeService.GetAllBindableCollection();
            AvailableEmployees = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == null).ToList());
            ActualEmployees    = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == team.Id).ToList());
            int i = 0;

            while (ActualType == null)
            {
                if (TeamTypes[i].Id == team.TeamTypeId)
                {
                    ActualType = i;
                    break;
                }
                else
                {
                    i++;
                }
            }

            this.toEdit      = team;
            Name             = toEdit.Name;
            Responsibilities = toEdit.Responsibilities;
        }
Exemplo n.º 3
0
 public AddTeamViewModel()
 {
     IsEdit             = false;
     ButtonLabel        = "Add";
     TeamTypes          = TeamTypeService.GetAllBindableCollection();
     AvailableEmployees = new BindableCollection <EmployeeDTO>(EmployeeService.GetAll().Where(x => x.TeamId == null && x.IsSelected == false).ToList());
     ActualEmployees    = new BindableCollection <EmployeeDTO>();
 }
Exemplo n.º 4
0
        public void Delete(TeamTypeDTO teamType)
        {
            IWindowManager manager             = new WindowManager();
            DeleteConfirmationViewModel modify = new DeleteConfirmationViewModel();
            bool?showDialogResult = manager.ShowDialog(modify, null, null);

            if (showDialogResult != null && showDialogResult == true)
            {
                TeamTypeService.Delete(teamType);
            }
            Reload();
        }
Exemplo n.º 5
0
 public void Reload()
 {
     TeamTypes = TeamTypeService.GetAll();
     NotifyOfPropertyChange(() => TeamTypes);
 }