public Account GetAuthenticatedAccount() { if (HttpContext.Current.Request["Authenticator"] != null && HttpContext.Current.Request["accountID"] != null) { SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current); string actID = ssoRequest.AccountID; if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID)) { Security.SetAccountID(actID); return(RemoteHelper.GetAccount(actID, null)); } else { return(null); } } else if (HttpContext.Current.Request["Authenticator"] == null) { SSORequest req = new SSORequest(); req.Action = "authenticate"; req.SiteID = SiteConfigs.GetConfig().SiteID; Authentication.CreateAppToken(req); Authentication.Post(req, SiteConfigs.GetConfig().PassportAuthPage); return(null); } else { return(null); } }
public void AdvancedPathSplitting() { const string path = "PLC.Modules.<Default>.OPCua_Axis:opc_Axis.StatusX.Homing"; string firstElement; var restOfPath = RemoteHelper.RestOfPath(path, out firstElement); Assert.IsTrue(firstElement == "PLC"); Assert.IsTrue(restOfPath == "Modules.<Default>.OPCua_Axis:opc_Axis.StatusX.Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "Modules"); Assert.IsTrue(restOfPath == "<Default>.OPCua_Axis:opc_Axis.StatusX.Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "<Default>"); Assert.IsTrue(restOfPath == "OPCua_Axis:opc_Axis.StatusX.Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "OPCua_Axis"); Assert.IsTrue(restOfPath == "opc_Axis.StatusX.Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "opc_Axis"); Assert.IsTrue(restOfPath == "StatusX.Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "StatusX"); Assert.IsTrue(restOfPath == "Homing"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "Homing"); Assert.IsTrue(restOfPath == ""); }
static void Main(string[] args) { { for (int i = 0; i < 5; i++) { List <Program> programs = DBHelper.Query <Program>(); if (CacheManager.Contains("DBHelper")) { List <Program> programList = DBHelper.Query <Program>(); CacheManager.Add("DBHelper", programList); } List <Program> programResult = CacheManager.GetData <List <Program> >("DBHelper"); List <Program> result = CacheManager.Get <List <Program> >("DBHelper", () => DBHelper.Query <Program>(), 30); } for (int i = 0; i < 5; i++) { List <Program> programs = FileHelper.Query <Program>(); } for (int i = 0; i < 5; i++) { List <Program> programs = RemoteHelper.Query <Program>(); } } Console.ReadKey(); }
/// <summary> /// Gets the client-side data as a <see cref="JToken"/> /// </summary> /// <returns></returns> JToken CreateNodeJObject(Document document) { Contract.Requires <ArgumentNullException>(document != null); // serialize document state to data field using (var wrt = new JTokenWriter()) { RemoteHelper.GetJson(wrt, document.Root); return(wrt.Token); } }
public List <Account> GetAccountList(List <string> ownerIds) { if (ownerIds == null || ownerIds.Count == 0) { return(null); } else { byte[] list = RemoteHelper.GetAccountList(ownerIds.ToArray()); return(We7Helper.BytesToObject(list) as List <Account>); } }
private void FrmMain_Load(object sender, EventArgs e) { using (FrmLogon vFrm = new FrmLogon()){ vFrm.ShowDialog(this); this.mServer = RemoteHelper.GetReferenceToServer(this.ServerLocation, vFrm.mDomain, vFrm.mLogin, vFrm.mPass); } if (mServer == null) { ShowMessage("Not found (-_-)\r\n" + ServerLocation); } else { ShowMessage("Found (^o^)/\r\n" + ServerLocation); } }
/// <summary> /// Invokes the given method. /// </summary> /// <param name="document"></param> /// <param name="nodeId"></param> /// <param name="interface"></param> /// <param name="method"></param> /// <param name="params"></param> void ClientInvoke(Document document, int nodeId, string @interface, string method, JObject @params) { Contract.Requires <ArgumentNullException>(document != null); Contract.Requires <ArgumentOutOfRangeException>(nodeId > 0); Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(@interface)); Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(method)); var node = (XNode)document.Xml.ResolveObjectId(nodeId); if (node == null) { return; } RemoteHelper.Invoke(node, @interface, method, @params); }
/// <summary> /// Updates the given property. /// </summary> /// <param name="document"></param> /// <param name="nodeId"></param> /// <param name="interface"></param> /// <param name="property"></param> /// <param name="value"></param> void ClientUpdate(Document document, int nodeId, string @interface, string property, JValue value) { Contract.Requires <ArgumentNullException>(document != null); Contract.Requires <ArgumentOutOfRangeException>(nodeId > 0); Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(@interface)); Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(property)); var node = (XNode)document.Xml.ResolveObjectId(nodeId); if (node == null) { return; } RemoteHelper.Update(node, @interface, property, value); }
public void PathSplitting() { const string path = "ServerConsole.BusinessLogic.JobStates"; string firstElement; var restOfPath = RemoteHelper.RestOfPath(path, out firstElement); Assert.IsTrue(firstElement == "ServerConsole"); Assert.IsTrue(restOfPath == "BusinessLogic.JobStates"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "BusinessLogic"); Assert.IsTrue(restOfPath == "JobStates"); restOfPath = RemoteHelper.RestOfPath(restOfPath, out firstElement); Assert.IsTrue(firstElement == "JobStates"); Assert.IsTrue(restOfPath == ""); }
private RemoteHelper GetHelper() { if (helper == null) { var assembly = typeof(AppDomainInvoker).GetTypeInfo().Assembly; appDomain = AppDomain.CreateDomain( typeof(AppDomainInvoker).FullName, null, new AppDomainSetup { ApplicationBase = Path.GetDirectoryName(assembly.Location), ConfigurationFile = assembly.Location + ".config" }); helper = (RemoteHelper)appDomain.CreateInstanceAndUnwrap(assembly.FullName, typeof(RemoteHelper).FullName); } return(helper); }
public Account GetAccount(string accountID, string[] fields) { if (accountID == We7Helper.EmptyGUID) { Account a = new Account(); a.LoginName = SiteConfigs.GetConfig().AdministratorName; a.LastName = "管理员"; a.ID = We7Helper.EmptyGUID; return(a); } else if (accountID == Security.CurrentAccountID) { if (HttpContext.Current.Session["$We7CurrentAccount"] == null) { HttpContext.Current.Session["$We7CurrentAccount"] = RemoteHelper.GetAccount(accountID, null); } return(HttpContext.Current.Session["$We7CurrentAccount"] as Account); } else { return(RemoteHelper.GetAccount(accountID, fields)); } }
public Account AddAccount(Account act) { return(RemoteHelper.AddAccount(act)); }
public bool ExistEmail(string email) { return(RemoteHelper.ExistEmail(email)); }
public List <Department> GetDepartments(string siteID, string parentID, string selectName, string[] fields) { byte[] list = RemoteHelper.GetDepartments(siteID, parentID, selectName, fields); return(We7Helper.BytesToObject(list) as List <Department>); }
public List <Department> GetDepartmentTree(string siteID, string parentId) { byte[] list = RemoteHelper.GetDepartmentTree(siteID, parentId); return(We7Helper.BytesToObject(list) as List <Department>); }
public List <Role> GetRoles(string siteID, int from, int count) { byte[] list = RemoteHelper.GetRoles(siteID, from, count); return(We7Helper.BytesToObject(list) as List <Role>); }
public Department GetDepartment(string departmentID, string[] fields) { return(RemoteHelper.GetDepartment(departmentID, fields)); }
public Department AddDepartment(Department dpt) { return(RemoteHelper.AddDepartment(dpt)); }
public void UpdateAccount(Account act, string[] fields) { RemoteHelper.UpdateAccount(act, fields); }
public List <string> GetAccountsOfRole(string roleID, int from, int count) { byte[] list = RemoteHelper.GetAccountsOfRole(roleID, from, count); return(We7Helper.BytesToObject(list) as List <string>); }
public int GetAccountCountOfRole(string roleID) { return(RemoteHelper.GetAccountCountOfRole(roleID)); }
public Role GetRoleBytitle(string title) { return(RemoteHelper.GetRoleBytitle(title)); }
public void DeleteAccountRole(string id) { RemoteHelper.DeleteAccountRole(id); }
public List <Role> GetRoles(string siteID, OwnerRank type, string key) { byte[] list = RemoteHelper.GetRoles(siteID, type, key); return(We7Helper.BytesToObject(list) as List <Role>); }
public bool ExistUserName(string userName) { return(RemoteHelper.ExistUserName(userName)); }
public void DeleteDepartment(string departmentID) { RemoteHelper.DeleteDepartment(departmentID); }
public void DeleteAccont(string accountID) { RemoteHelper.DeleteAccont(accountID); }
public void UpdateDepartment(Department dpt, string[] fields) { RemoteHelper.UpdateDepartment(dpt, fields); }
public List <string> GetRolesOfAccount(string accountID) { byte[] list = RemoteHelper.GetRolesOfAccount(accountID); return(We7Helper.BytesToObject(list) as List <string>); }
public int GetRoleCount(string siteID, OwnerRank type) { return(RemoteHelper.GetRoleCount(siteID, type)); }