Exemplo n.º 1
0
 public AddManagerViewModel(AddManagerView addManagerViewOpen)
 {
     addManagerView         = addManagerViewOpen;
     QualificationLevelList = new ObservableCollection <QualificationLevel>(service.GetAllQualificationLevel());
     User        = new HotelUser();
     UserManager = new Manager();
 }
 private void ConfirmCommandExecute(object obj)
 {
     try
     {
         string password     = (obj as PasswordBox).Password;
         string filePassword = RandomPasswordGenerator.ReadManagerPassword();
         if (password.Equals(filePassword))
         {
             AddManagerView managerView = new AddManagerView();
             managerPasswordEnterView.Close();
             registration.Close();
             managerView.Show();
             return;
         }
         else
         {
             if (retryCounter == 0)
             {
                 MessageBox.Show("You have exeeded maximum number of tries.\nReturning to registration screen.");
                 RegistrationView registrationView = new RegistrationView(retryCounter);
                 managerPasswordEnterView.Close();
                 registration.Close();
                 registrationView.Show();
             }
             else
             {
                 MessageBox.Show($"Wrong password. Remaining number of tries: {--retryCounter}");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public void EditManager()
        {
            try
            {
                ClinicUser clinicUser = new ClinicUser();
                clinicUser.ClinicUserId = selectedManager.ClinicUserId;
                clinicUser.FullName     = selectedManager.FullName;
                clinicUser.DateOfBirth  = selectedManager.DateOfBirth;
                clinicUser.IDNumber     = selectedManager.IDNumber;
                clinicUser.GenderId     = selectedManager.GenderId;
                clinicUser.Citizenship  = selectedManager.Citizenship;
                clinicUser.Username     = selectedManager.Username;
                clinicUser.Password     = selectedManager.Password;

                ClinicManager clinicManager = new ClinicManager();
                clinicManager.ClinicManagerId           = selectedManager.ClinicManagerId;
                clinicManager.ClinicUserId              = selectedManager.ClinicUserId;
                clinicManager.ClinicFloor               = selectedManager.ClinicFloor;
                clinicManager.MaxNumOfDoctorsSupervised = selectedManager.MaxNumOfDoctorsSupervised;
                clinicManager.MinNumOfRoomSupervised    = selectedManager.MinNumOfRoomSupervised;
                clinicManager.NumberOfMistake           = selectedManager.NumberOfMistake;

                AddManagerView addManagerView = new AddManagerView(User, clinicUser, clinicManager, true);
                addManagerView.Show();
                managerView.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 4
0
 private void AddNewManagerExecute()
 {
     try
     {
         AddManagerView addManager = new AddManagerView();
         addManager.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 5
0
 public void GoToAddManagerExecute()
 {
     try
     {
         AddManagerView main = new AddManagerView();
         main.Show();
         ownerView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public AddManagerViewModel(ClinicUser userAdmin, ClinicUser user, ClinicManager clinicManager, AddManagerView addManagerViewOpen, bool isForEdit)
 {
     this.userAdmin   = userAdmin;
     this.userManager = clinicManager;
     this.user        = user;
     this.isForEdit   = isForEdit;
     addManagerView   = addManagerViewOpen;
     GenderList       = new ObservableCollection <Gender>(service.GetAllGender());
     SelectedGender   = GenderList.FirstOrDefault(p => p.GenderId == user.GenderId);
     FloorList        = new ObservableCollection <int>(service.ListOfFreeFloors());
     FloorList.Add(userManager.ClinicFloor);
     SelectedFloor = userManager.ClinicFloor;
 }
 /// <summary>
 /// This method invokes method for opening a window for adding manager.
 /// </summary>
 public void AddExecute()
 {
     try
     {
         AddManagerView form = new AddManagerView();
         form.ShowDialog();
         ManagerList = managers.GetAllManagers();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public void AddNewMenagerExecute()
 {
     try
     {
         AddManagerView addManagerView = new AddManagerView(User, new ClinicUser(), new ClinicManager(), false);
         addManagerView.Show();
         managerView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private async void addBtn_Click(object sender, RoutedEventArgs e)
        {
            Log("Adding item...");

            var view = new AddManagerView(_persons, onSubmit: manager =>
            {
                using (var uow = _uowFactory.CreateNew())
                {
                    uow.Managers.Add(manager);
                    uow.SaveChanges();
                }
            });

            view.ShowDialog();

            await RefreshAsync();
        }
 public AddManagerViewModel(AddManagerView managerView)
 {
     this.managerView = managerView;
     ClinicManager    = new vwClinicManager();
     GenderList       = genders.GetGenders();
 }
 public AddManagerViewModel(AddManagerView view)
 {
     this.view   = view;
     manager     = new vwManager();
     ManagerList = service.GetAllManagerView().ToList();
 }
Exemplo n.º 12
0
 public AddManagerViewModel(AddManagerView addManagerOpen)
 {
     addManager = addManagerOpen;
     manager    = new vwManager();
 }
Exemplo n.º 13
0
        public void AddManagerExecute()
        {
            AddManagerView managerView = new AddManagerView();

            managerView.ShowDialog();
        }
Exemplo n.º 14
0
 public AddManagerViewModel(AddManagerView viewManager)
 {
     managerView = viewManager;
     manager     = new vwManager();
 }
 public AddManagerViewModel(AddManagerView managerView)
 {
     this.managerView    = managerView;
     Manager             = new vwManager();
     EducationDegreeList = levels.GetEducationDegree();
 }
 public AddManagerViewModel(AddManagerView viewManager)
 {
     manager = viewManager;
 }