コード例 #1
0
        public (User, string) Create()
        {
            AddUserView      addUserView      = new AddUserView();
            AddUserViewModel addUserViewModel = new AddUserViewModel();

            addUserView.DataContext = addUserViewModel;

            bool?result = addUserView.ShowDialog();

            if (result == true)
            {
                string userName = addUserViewModel.UserName;
                string password = addUserView.GetPassword();

                User user = new User()
                {
                    UserName = addUserViewModel.UserName,
                    FullName = addUserViewModel.Name,
                    Title    = addUserViewModel.Title,
                    EMail    = addUserViewModel.EMail,
                };

                return(user, password);
            }

            return(null, null);
        }
コード例 #2
0
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            AddUserView form2 = new AddUserView(UserController, this);

            form2.Show();
        }
コード例 #3
0
 public NavigationModel(ContentWindow contentWindow, Storage storage)
 {
     _contentWindow = contentWindow;
     _mainView      = new MainView(storage);
     _addUserView   = new AddUserView(storage);
     _editUserView  = new EditUserView(storage);
 }
コード例 #4
0
        public void Initialize()
        {
            InitExportCmd();
            InitDelUserCmd();
            this._MainViewModel.AddUserCmd = new RelayCommand(() =>
            {
                AddUserView view = new AddUserView(Common.Service, Common.SessionId);
                view.Owner = Common.MainWindow;
                view.ShowDialog();
            });

            this._MainViewModel.SaveUserCmd = new RelayCommand(() =>
            {
                if (_MainViewModel.UserView.CurrentItem == null) return;
                UserModel model = _MainViewModel.UserView.CurrentItem as UserModel;
                UpdateUserView view = new UpdateUserView(model, Common.Service, Common.SessionId);
                view.Owner = Common.MainWindow;
                view.ShowDialog();
            });

            this._MainViewModel.QueryFundCmd = new RelayCommand(() =>
            {
                FundManager.Default.LoadFundCode();
            });


        }
コード例 #5
0
        private void UpdateModel(UserViewModel model)
        {
            if (model == null)
            {
                MessageBoxWPF.Show("Выберите заёмщика!", "Сообщение.", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            AddUserView view = new AddUserView(model.GetModel, repository)
            {
                ShowInTaskbar = false
            };

            view.ShowDialog();
            if (view.DialogResult != true)
            {
                return;
            }

            bool flag = repository.UpdateUser(model.GetModel);

            if (!flag)
            {
                MessageBoxWPF.Show(StringProject.ErrorUpdRecort, StringProject.ErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            model.RefreshModel();
        }
コード例 #6
0
        /// <summary>
        /// Sınıf Oluşturulğunda ilk Çalışan Metod
        /// </summary>
        public AddUserViewModel(AddUserView addUserView)
        {
            this.addUserView = addUserView;


            SelectImageUri = "/Presantation;component/image/profile.png";
        }
コード例 #7
0
 /// <summary>
 /// Kullanıcı Formunu Getiren Metod
 /// </summary>
 public void GotoUser()
 {
     using (AddUserView addUserView = new AddUserView())
     {
         addUserView.addUserViewModel.ProjectViewModel = this;
         addUserView.Show();
     }
 }
コード例 #8
0
        public void AddNewUser()
        {
            logHandler.LogManagerLogging(Enums.LOGTYPE.INFO, "Dialog for Add new User is opened.");
            Window w = new AddUserView();

            w.DataContext = new AddUserViewModel()
            {
                Window = w
            };
            w.ShowDialog();
        }
コード例 #9
0
        // Caliburn Micro: this method shares the x:Name of Button and occurs on a Click event
        public void BtnAddUser()
        {
            if (AddUserView == null)
            {
                return;
            }

            // TODO: rather than routing around this way, it seems like it would probably be better to use databinding
            // on the Text properties in the .xaml and utilize INotifyPropertyChanged.
            AddUserView.AddUserToDb();

            TryClose();
        }
コード例 #10
0
        public ResponseDto <object> AddUser(AddUserView view)
        {
            var result = new ResponseDto <object>()
            {
                code = ConstResponseCode.Failure,
            };

            if (string.IsNullOrEmpty(view.name))
            {
                result.message = "name can not  be empty";
                return(result);
            }
            if (string.IsNullOrEmpty(view.password))
            {
                result.message = "password can not be empty";
                return(result);
            }
            if (string.IsNullOrEmpty(view.email))
            {
                result.message = "email can not be empty";
                return(result);
            }
            var existsUser = _Context.User.Where(p => p.Email == view.email).FirstOrDefault();

            if (existsUser != null)
            {
                result.message = "the user is exists";
            }
            _Context.User.Add(new DiseaseEntity.User()
            {
                Id           = Guid.NewGuid(),
                Email        = view.email,
                Name         = view.name,
                Password     = view.password, //密码请加密吧!!
                Phone        = view.phone,
                Sex          = view.sex,
                Status       = 1,
                Enabled      = 1,
                Created      = DateTime.Now,
                LastModified = DateTime.Now,
            });
            _Context.SaveChanges();
            result.code    = ConstResponseCode.Success;
            result.message = "success";
            return(result);
        }
コード例 #11
0
        public UserViewModel(IUserRelatedRepository repo, IUserSession userSession)
        {
            Repository = repo;

            UserSession = userSession;

            SubscribeActionOnUserAddition(
                (user) => UsersToShow.Add(user)
                );

            _allUsersToShow = Repository.AllUsers.ToObservableCollection();

            RemoveUserCommand = RegisterCommandAction(
                (obj) =>
            {
                var userToRemove = Repository.FindUser(SelectedUser.Login);
                Repository.RemoveUser(userToRemove);
                Repository.SaveChanges();
                UsersToShow.Remove(SelectedUser);
            },
                (obj) =>
            {
                if (UserSession.IsAuthorizedUserAllowedTo(UserActions.RemoveUser))
                {
                    return(SelectedUser != null);
                }
                else
                {
                    return(false);
                }
            }
                );

            ShowAddUserViewCommand = RegisterCommandAction(
                (obj) =>
            {
                var addUserView         = new AddUserView();
                addUserView.DataContext = ResolveDependency <IAddUserViewModel>();
                addUserView.ShowDialog();
            },
                (obj) =>
                UserSession.IsAuthorizedUserAllowedTo(UserActions.AddUser)
                );
        }
コード例 #12
0
        private void AddUserCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var view = new AddUserView();

            view.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (view.ViewModel.User.HasErrors)
            {
                return;
            }

            IsBusy = true;

            var user = view.ViewModel.User;

            CopyPermissionsFromGroup(user.UserGroup.UserGroup, user.User);
            LoadUserPermissions(user);

            LoadAuthorisationPermissions(user);

            user.PropertyChanged += OnUserModelPropertyChanged;

            var firstOrDefault = UserGroups.FirstOrDefault(x => x.UserGroup.ID == user.User.UserGroupID);

            if (firstOrDefault != null)
            {
                firstOrDefault.Users.Add(user);
            }

            SelectedUser = user;

            IsBusy = false;
        }
コード例 #13
0
        public AddUserView AddUser(string name, string password)
        {
            Thread.Sleep(500);

            var gateway = Factory.GetGateway();


            var result = new AddUserView()
            {
                Success = true
            };

            if (gateway.IsExists(name))
            {
                result.Success = false;
                result.Message = string.Format("User with name '{0}' already exists", name);
            }
            else
            {
                gateway.AddUser(name, password);
            }

            return(result);
        }
コード例 #14
0
        /// <summary>
        /// The Command to show the Add User View.
        /// </summary>
        private void FuncShowAddUser(object parameter)
        {
            AddUserView addUserView = new AddUserView();

            addUserView.Show();
        }
コード例 #15
0
        private void AddUser()
        {
            var view = new AddUserView();

            DataContext = view;
        }
コード例 #16
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AddUserView v = new AddUserView();

            this.Content = v;
        }