public UserUpdatePwdWindow(UserManageViewModel userManageViewModel)
 {
     InitializeComponent();
     viewModel           = userManageViewModel;
     viewModel.EditModel = GloableUserInfo.LoginUser;
     this.DataContext    = viewModel;
 }
Esempio n. 2
0
 public UserManageWindow(UserManageViewModel userManageViewModel)
 {
     InitializeComponent();
     viewModel           = userManageViewModel;
     this.DataContext    = viewModel;
     treeView1.IsEnabled = true;
     #region  新建用户
     CommandBindings.Add(new CommandBinding(
                             ApplicationCommands.New,
                             (s, e) =>
     {
         viewModel.EditModel  = new SystemUser();
         UserCreateWindow win = new UserCreateWindow(userManageViewModel);
         win.Topmost          = true;
         win.Show();
     },
                             (s, e) =>
     {
         e.CanExecute = SelectedNode != null && GloableUserInfo.LoginUser.user_type >= (int)UserType.Manager;
     }));
     #endregion
     #region  编辑用户 修改信息
     CommandBindings.Add(new CommandBinding(
                             ApplicationCommands.Properties,
                             (s, e) =>
     {
         try
         {
             viewModel.EditModel  = viewModel.SelectModel;
             UserCreateWindow win = new UserCreateWindow(userManageViewModel);
             win.Show();
         }
         catch (Exception ex)
         {
             MessageBox.Show("数据保存失败!");
         }
     },
                             (s, e) =>
     {
         e.CanExecute = viewModel.SelectModel != null && GloableUserInfo.LoginUser.user_type >= (int)UserType.Manager;
     }));
     #endregion
     #region   除用户
     CommandBindings.Add(new CommandBinding(
                             ApplicationCommands.Delete,
                             (s, e) =>
     {
         if (System.Windows.MessageBox.Show("确认删除该用户?", "警告", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
         {
             viewModel.Remove(viewModel.SelectModel);
             viewModel.SelectModel = null;
         }
     },
                             (s, e) =>
     {
         e.CanExecute = viewModel.SelectModel != null && GloableUserInfo.LoginUser.user_type >= (int)UserType.Manager;
     }));
     #endregion
 }
Esempio n. 3
0
 public UserCreateWindow(UserManageViewModel userManageViewModel)
 {
     InitializeComponent();
     viewModel        = userManageViewModel;
     this.DataContext = viewModel;
     foreach (var item in viewModel.TypeList)//直接给值不行
     {
         cmb.Items.Add(item);
     }
 }