123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace WebAPIBase.NetCore.BusinessCore
- {
- public class Info
- {
- private static GetCurrentUser gcu;
- private static Hashtable currentList = new Hashtable();
- public static GetCurrentUser GCU
- {
- set
- {
- gcu = value;
- }
- }
- public static CurrentInfo Current
- {
- get
- {
- int currentUserCode = gcu.GetCurrentUserCode();
- if (currentList.ContainsKey(currentUserCode))
- {
- return (CurrentInfo)currentList[currentUserCode];
- }
- CurrentInfo currentInfo = CurrentInfo.Instance(currentUserCode);
- try
- {
- currentList.Add(currentUserCode, currentInfo);
- }
- catch
- {
- }
- return currentInfo;
- }
- }
- public static void Clear()
- {
- currentList.Clear();
- }
- }
- public abstract class GetCurrentUser
- {
- public abstract int GetCurrentUserCode();
- }
- public class CurrentInfo
- {
- public int UserCode;
- public string UserName;
- public FdcUser fdcUser;
- private CurrentInfo()
- {
- }
- private CurrentInfo(int usercode)
- {
- init(usercode);
- }
- private void init(int usercode)
- {
- fdcUser = FdcUnitStructure.Instance.GetFdcUserByCode(usercode);
- if (fdcUser != null)
- {
- int.TryParse(fdcUser.UserCode, out UserCode);
- UserName = fdcUser.UserName;
- }
- else
- {
- UserCode = 0;
- UserName = "-";
- }
- }
- public static CurrentInfo Instance(int usercode)
- {
- return new CurrentInfo(usercode);
- }
- }
- public enum RightScope
- {
- 无,
- 个人,
- 部门
- }
- public class FdcFunctionUnit
- {
- public string FunctionCode;
- public FdcUnit unit;
- public int IsPerson;
- }
- }
|