|
|
|
@ -23,7 +23,12 @@ namespace ButcherFactory.BO.Utils |
|
|
|
var query = new DmoQuery(typeof(WpfUser)); |
|
|
|
var obj = session.ExecuteScalar(query); |
|
|
|
if (obj != null) |
|
|
|
return (WpfUser)obj; |
|
|
|
{ |
|
|
|
var user = (WpfUser)obj; |
|
|
|
if (!string.IsNullOrEmpty(user.Role)) |
|
|
|
user.RoleList.AddRange(user.Role.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)); |
|
|
|
return user; |
|
|
|
} |
|
|
|
} |
|
|
|
return new WpfUser(); |
|
|
|
} |
|
|
|
@ -76,6 +81,7 @@ namespace ButcherFactory.BO.Utils |
|
|
|
public static void Login(string userName, string pwd) |
|
|
|
{ |
|
|
|
RpcFacade.Login(userName, pwd); |
|
|
|
AppContext.User = new WpfUser(); |
|
|
|
AppContext.User.Login = true; |
|
|
|
AppContext.User.Name = userName; |
|
|
|
FillUserEmpInfo(userName); |
|
|
|
@ -119,15 +125,6 @@ namespace ButcherFactory.BO.Utils |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static void AddUserRole(string role) |
|
|
|
{ |
|
|
|
|
|
|
|
if (AppContext.User.RoleList.Contains(role)) |
|
|
|
return; |
|
|
|
AppContext.User.RoleList.Add(role); |
|
|
|
UpdateUserRole(); |
|
|
|
} |
|
|
|
|
|
|
|
public static bool TestConnection(int? millisecondsTimeout = null) |
|
|
|
{ |
|
|
|
var url = AppContext.ConnectInfo.ServerUrl; |
|
|
|
|