using BPASmart.Model;
using BPASmart.UserManagement.View;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BPASmart.UserManagement.ViewModel
{
partial class UserListViewModel:ObservableObject
{
///
/// 用户列表
///
public ObservableCollection userManagers { get; set; } = Json.Data.UserManagers;
///
/// 注册新用户
///
[RelayCommand]
private void RegisterNewUser()
{
ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser");
}
///
/// 修改密码
///
[RelayCommand]
private void ChangePassword(object o)
{
if (o == null) return;
if (o is UserManager user)
{
if(userManagers.Contains(user))
{
Globle.GlobleData.ChangeUser = user;
ActionManage.GetInstance.Send("ChangeMianContent", "ChangeUser");
}
}
}
///
/// 编辑权限
///
[RelayCommand]
private void EditUsetPower(object o)
{
if (o == null) return;
if (o is UserManager user)
{
if (userManagers.Contains(user))
{
Globle.GlobleData.EditUser = null;
Globle.GlobleData.EditUser = user;
ActionManage.GetInstance.Send("ChangeMianContent", "EditPower");
}
}
}
///
/// 删除用户
///
[RelayCommand]
private void DeleteUser(object o)
{
if (o == null) return;
if (o is UserManager user)
{
if (userManagers.Contains(user))
{
userManagers.Remove(user);
}
}
Json.Save();
}
public UserListViewModel()
{
}
}
}