public static object Login(string userID, string password) { string key = Guid.NewGuid().ToString(); string iV = Guid.NewGuid().ToString(); InvokeInfo info = new InvokeInfo("Decrypt", new object[] { key, iV, SymmetricCrypt.Encrypt(key, iV, userID) }); InvokeInfo info2 = new InvokeInfo("Decrypt", new object[] { key, iV, SymmetricCrypt.Encrypt(key, iV, password) }); return(Invoke("User.Login", new object[] { info, info2 })); }
private static object Invoke(InvokeInfo iInfo, int nReTry) { try { InvokeResult result; using (new OperationContextScope((IContextChannel)Service)) { HttpRequestMessageProperty property = new HttpRequestMessageProperty(); property.Headers["LHBISAuthCookie"] = UsrHeaderToken; OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, property); IAsyncResult result2 = Service.BeginInvoke(_clientID, iInfo, null, null); result = Service.EndInvoke(result2); } if (result.Error != null) { throw new ServiceException(result.Error.ClassFullName, result.Error.CustomErrorCode, result.Error.Parameters); } return(result.Result); } catch (ThreadAbortException) { } catch (ServiceException exception) { throw exception; } catch (TimeoutException) { if (nReTry <= 0) { throw new ServiceException("Error.LHBIS.FIC.Communication", "timeout", new string[] { iInfo.Name }); } return(Invoke(iInfo, nReTry - 1)); } catch (Exception exception2) { if (nReTry > 0) { return(Invoke(iInfo, nReTry - 1)); } StringBuilder builder = new StringBuilder(); builder.Append(exception2.Message).Append("\r\n").Append(exception2.StackTrace); if (exception2.InnerException != null) { builder.Append("\r\n").Append(exception2.InnerException.Message).Append("\r\n").Append(exception2.InnerException.StackTrace); } throw new ServiceException("Error.LHBIS.FIC.Communication", "unknown", exception2, new string[] { iInfo.Name, builder.ToString() }); } return(null); }
private static object Invoke(InvokeInfo iInfo, int nReTry) { try { InvokeResult result; using (new OperationContextScope((IContextChannel)Service)) { HttpRequestMessageProperty property = new HttpRequestMessageProperty(); property.Headers["LHBISAuthCookie"] = UsrHeaderToken; OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, property); IAsyncResult result2 = Service.BeginInvoke(_clientID, iInfo, null, null); result = Service.EndInvoke(result2); } if (result.Error != null) { throw new ServiceException(result.Error.ClassFullName, result.Error.CustomErrorCode, result.Error.Parameters); } return result.Result; } catch (ThreadAbortException) { } catch (ServiceException exception) { throw exception; } catch (TimeoutException) { if (nReTry <= 0) { throw new ServiceException("Error.LHBIS.FIC.Communication", "timeout", new string[] { iInfo.Name }); } return Invoke(iInfo, nReTry - 1); } catch (Exception exception2) { if (nReTry > 0) { return Invoke(iInfo, nReTry - 1); } StringBuilder builder = new StringBuilder(); builder.Append(exception2.Message).Append("\r\n").Append(exception2.StackTrace); if (exception2.InnerException != null) { builder.Append("\r\n").Append(exception2.InnerException.Message).Append("\r\n").Append(exception2.InnerException.StackTrace); } throw new ServiceException("Error.LHBIS.FIC.Communication", "unknown", exception2, new string[] { iInfo.Name, builder.ToString() }); } return null; }
public static object Login(string userID, string password) { string key = Guid.NewGuid().ToString(); string iV = Guid.NewGuid().ToString(); InvokeInfo info = new InvokeInfo("Decrypt", new object[] { key, iV, SymmetricCrypt.Encrypt(key, iV, userID) }); InvokeInfo info2 = new InvokeInfo("Decrypt", new object[] { key, iV, SymmetricCrypt.Encrypt(key, iV, password) }); return Invoke("User.Login", new object[] { info, info2 }); }
private static object Invoke(object site, object obj, string name, object[] parameters) { Type type; PropertyInfo property; FieldInfo field; if ((obj == null) || string.IsNullOrEmpty(name)) { throw new Exception("Parameter Error!"); } int index = name.IndexOf('.'); if (index < 0) { if (parameters != null) { int num2 = 0; int length = parameters.Length; while (num2 < length) { InvokeInfo info = parameters[num2] as InvokeInfo; if (info != null) { parameters[num2] = info.Invoke(site); } num2++; } } type = obj.GetType(); MethodInfo info2 = GetMethod(type, name, parameters); if ((info2 != null) && info2.IsPublic) { return(info2.Invoke(obj, parameters)); } property = type.GetProperty(name); if ((property != null) && property.CanRead) { return(property.GetValue(obj, parameters)); } if ((parameters == null) || (parameters.Length == 0)) { field = type.GetField(name); if ((field != null) && field.IsPublic) { return(field.GetValue(obj)); } } throw new Exception("Parameter Error,not find \"" + name + "\""); } if (index > 0) { type = obj.GetType(); string str = name.Substring(0, index); property = type.GetProperty(str); object obj2 = null; if ((property != null) && property.CanRead) { obj2 = property.GetValue(obj, null); } else { field = type.GetField(str); if ((field != null) && field.IsPublic) { obj2 = field.GetValue(obj); } } if (obj2 == null) { throw new Exception("Parameter Error,not find +\"" + name + "\""); } obj = obj2; } return(Invoke(site, obj, name.Substring(index + 1), parameters)); }