public void SaveExecute(object parametar)
        {
            try
            {
                if (User.UserId == 0)
                {
                    var passwordBox = parametar as PasswordBox;
                    var password    = passwordBox.Password;
                    User.Password        = password;
                    User.GenderId        = selectedGender.GenderId;
                    User.MaritalStatusId = selectedMaritalStatus.MaritalStatusId;
                    User.RoleId          = 2;

                    MessageBoxResult result = MessageBox.Show("Are you sure you want to save the new Administrator", "Add New Admin", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        bool uniqueUser       = service.CheckUsernameUser(User.Username);
                        bool uniqueUserMaster = service.CheckUsernameMasterUser(User.Username);
                        if (!uniqueUser && !uniqueUserMaster)
                        {
                            int userId = service.AddCompanyUser(User);
                            if (userId != 0)
                            {
                                Admin.CompanyUserId       = userId;
                                Admin.AdministratorTypeId = selectedType.AdministratorTypeId;
                                Admin.ExpirationDate      = DateTime.Now.AddDays(7);

                                if (service.AddAdminUser(Admin) != 0)
                                {
                                    MessageBox.Show("You have successfully added new administrator");
                                    Logging.LoggAction("AddNewAdmnViewModel", "Info", "Succesfull add new Admin");
                                    MasterAdminView masterView = new MasterAdminView();
                                    masterView.Show();
                                    addNewAdminView.Close();
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("User name is not unique!");
                        }
                    }
                    else
                    {
                        MasterAdminView masterView = new MasterAdminView();
                        masterView.Show();
                        addNewAdminView.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void LoginExecute(object parametar)
        {
            var passwordBox = parametar as PasswordBox;
            var password    = passwordBox.Password;

            try
            {
                if (service.LoginMaster(username, password) != null)
                {
                    MessageBox.Show("Successful login");
                    MasterAdminView window = new MasterAdminView();
                    window.Show();
                    main.Close();
                }
                else if (service.LoginUserPass(username, password) != null)
                {
                    if (ServiceCode.CurrentUser.RoleId == 1)
                    {
                        Menager menager = service.GetMenagerByUserId(ServiceCode.CurrentUser.UserId);
                        if (menager.LevelOfResponsibility == 4)
                        {
                            MessageBox.Show("Your account is not yet available.\nWait for the admin to assign you \na level of responsibility ");
                        }
                        else
                        {
                            ManagerView managerView = new ManagerView(menager);
                            managerView.Show();
                            main.Close();
                        }
                    }
                    else if (ServiceCode.CurrentUser.RoleId == 2)
                    {
                        Administrator admin = service.GetAdminByUserId(ServiceCode.CurrentUser.UserId);
                        if (admin.ExpirationDate < DateTime.Now)
                        {
                            MessageBox.Show("You need to contact company's menagment\nTo extend your access to acount!");
                        }
                        else
                        {
                            AdminView adminView = new AdminView();
                            adminView.Show();
                            main.Close();
                        }
                    }
                    else if (ServiceCode.CurrentUser.RoleId == 3)
                    {
                        WorkerView workerView = new WorkerView();
                        workerView.Show();
                        main.Close();
                    }
                }
                else if (service.LoginManagerBackUpPass(username, password) != null)
                {
                    Menager menager = service.GetMenagerByUserId(ServiceCode.CurrentUser.UserId);
                    if (menager.LevelOfResponsibility == 4)
                    {
                        MessageBox.Show("Your account is not yet available.\nWait for the admin to assign you \na level of responsibility ");
                    }
                    else
                    {
                        ManagerView managerView = new ManagerView(menager);
                        managerView.Show();
                        main.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Wrong credentials");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void LoginExecute(object parametar)
        {
            var passwordBox = parametar as PasswordBox;
            var password    = passwordBox.Password;

            try
            {
                if (MasterLogin.Login(username, password) == true)
                {
                    MessageBox.Show("Successful login");
                    MasterAdminView window = new MasterAdminView();
                    window.Show();
                    main.Close();
                }
                else if (MasterLogin.Login(username, password) == false)
                {
                    ClinicUser user = service.LoginUser(username, password);
                    if (user != null)
                    {
                        if (user.RoleId == 1)
                        {
                            if (service.FindeInstitutionByUser(user.ClinicUserId) == false)
                            {
                                MessageBox.Show("Successful login");
                                AddInstitutionView window = new AddInstitutionView(user, new Institution(), false);
                                window.Show();
                                main.Close();
                            }
                            else
                            {
                                MessageBox.Show("Successful login");
                                AdministratorView window = new AdministratorView(user);
                                window.Show();
                                main.Close();
                            }
                        }
                        else if (user.RoleId == 2)
                        {
                            MessageBox.Show("Successful login maintainanc");
                        }
                        else if (user.RoleId == 3)
                        {
                            MessageBox.Show("Successful login manager");
                        }
                        else if (user.RoleId == 4)
                        {
                            MessageBox.Show("Successful login doctor");
                        }
                        else if (user.RoleId == 5)
                        {
                            MessageBox.Show("Successful login patient");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Wrong user or password credentials");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }