예제 #1
0
        public AddPermissionViewModel(PermissionDTO permission)
        {
            Ranks       = RankService.GetAllBindableCollection();
            IsEdit      = true;
            ButtonLabel = "Edit";

            int i = 0;

            while (ActualRank == null)
            {
                if (Ranks[i].Id == permission.MinRankId)
                {
                    ActualRank = i;
                    break;
                }
                else
                {
                    i++;
                }
            }

            this.toEdit = permission;
            Name        = permission.Name;
            Description = permission.Description;
            NotifyOfPropertyChange(() => Name);
            NotifyOfPropertyChange(() => Description);
        }
예제 #2
0
 public AddEmployeeViewModel()
 {
     IsEdit           = false;
     ButtonLabel      = "Add";
     Ranks            = RankService.GetAllBindableCollection();
     Specializations  = SpecializationService.GetAllBindableCollection();
     DateOfEmployment = DateTime.Now;
     NotifyOfPropertyChange(() => DateOfEmployment);
 }
예제 #3
0
        public AddEmployeeViewModel(EmployeeDTO employee)
        {
            IsEdit          = true;
            ButtonLabel     = "Edit";
            Ranks           = RankService.GetAllBindableCollection();
            Specializations = SpecializationService.GetAllBindableCollection();
            int i = 0;

            if (employee.RankId != null)
            {
                while (ActualRank == null)
                {
                    if (Ranks[i].Id == employee.RankId)
                    {
                        ActualRank = i;
                        break;
                    }
                    else
                    {
                        i++;
                    }
                }
            }

            if (employee.SpecializationId != null)
            {
                int j = 0;
                while (ActualSpecialization == null)
                {
                    if (Specializations[j].Id == employee.SpecializationId)
                    {
                        ActualSpecialization = j;
                        break;
                    }
                    else
                    {
                        j++;
                    }
                }
            }

            this.toEdit      = employee;
            NationalId       = employee.NationalId;
            FirstName        = employee.FirstName;
            LastName         = employee.LastName;
            Salary           = employee.Salary;
            DateOfEmployment = employee.DateOfEmployment;
            NotifyOfPropertyChange(() => NationalId);
            NotifyOfPropertyChange(() => FirstName);
            NotifyOfPropertyChange(() => LastName);
            NotifyOfPropertyChange(() => Salary);
            NotifyOfPropertyChange(() => DateOfEmployment);
        }
예제 #4
0
 public AddPermissionViewModel()
 {
     IsEdit      = false;
     ButtonLabel = "Add";
     Ranks       = RankService.GetAllBindableCollection();
 }