コード例 #1
0
 public ManagerLogedInViewModel(HotelUser manager, ManagerLogedInView managerLogedInViewOpen)
 {
     this.manager       = manager;
     managerLogedInView = managerLogedInViewOpen;
     ManagerFloor       = service.GetManagerFlorByUserId(manager.HotelUserId);
     WorkerList         = new ObservableCollection <vwWorker>(service.GetAllWorkersByFloor(ManagerFloor));
 }
        public void SaveExecute(object parametar)
        {
            Worker editWorker = new Worker();

            editWorker.WorkerId             = worker.WorkerId;
            editWorker.WorkExperience       = worker.WorkExperience;
            editWorker.QualificationLevelId = worker.QualificationLevelId;
            editWorker.GenderId             = worker.GenderId;
            decimal salary = Salary.SalaryCalculate(editWorker.WorkExperience, editWorker.QualificationLevelId, editWorker.GenderId, salaryInput);

            editWorker.Salary = salary;

            try
            {
                int userId = service.AddNewWorker(editWorker);
                if (userId != 0)
                {
                    MessageBox.Show("You have successfully added salary");
                    ManagerLogedInView managerView = new ManagerLogedInView(manager);
                    managerView.Show();
                    addSalaryOneWorker.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 public void QuitExecute()
 {
     try
     {
         ManagerLogedInView managerView = new ManagerLogedInView(manager);
         managerView.Show();
         addSalaryOneWorker.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #4
0
        private void LoginExecute(object parametar)
        {
            var passwordBox = parametar as PasswordBox;
            var password    = passwordBox.Password;

            try
            {
                if (OwnerLogIn.Login(username, password) == true)
                {
                    MessageBox.Show("Successful login");
                    OwnerView window = new OwnerView();
                    window.Show();
                    main.Close();
                }
                else if (OwnerLogIn.Login(username, password) == false)
                {
                    HotelUser user = service.LoginUser(username, password);
                    if (user != null)
                    {
                        if (user.RoleId == 1)
                        {
                            MessageBox.Show("Successful login");
                            WorkerLogedInView window = new WorkerLogedInView(user);
                            window.Show();
                            main.Close();
                        }
                        else if (user.RoleId == 2)
                        {
                            MessageBox.Show("Successful login");
                            ManagerLogedInView window = new ManagerLogedInView(user);
                            window.Show();
                            main.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong user or password credentials");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }