using DeviceRepair.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using TsSFCDeivceClient.Model;
namespace TsSFCDeivceClient
{
public static class Runtime
{
public static string inParams;
public static UserInfo _CurrentUser;
///
/// TsSFC用户信息
///
public static UserInfo CurrentUser
{
get { return _CurrentUser; }
set { _UserAuths = null; _CurrentUser = value; }
}
private static List _UserAuths;
///
/// TsSFC用户权限
///
public static List UserAuths
{
get
{
if (_UserAuths == null)
{
if (CurrentUser != null || CurrentUser.GUID != Guid.Empty)
{
APIResponseData apiResponseData = Biz.CommonApi.Instance.GetTsSFCUserAuths(CurrentUser.GUID);
if (!apiResponseData.IsSuccess)
{
throw new Exception(apiResponseData.Message);
}
_UserAuths = apiResponseData.ToDeserializeObject>();
}
else
{
_UserAuths = new List();
}
}
return _UserAuths;
}
}
///
/// 是否包含指定权限
///
///
///
public static bool UserHasAuth(string AuthCode)
{
return UserAuths.Any(x => x.Contains(AuthCode));
}
}
}