/// <summary> /// Get interface paramter. /// </summary> /// <returns>interface paramter</returns> public InterfaceInfo GetInterfaceParamter() { try { InterfaceInfo parm = null; using (var conn = new SQLiteConnection(registryConnectionString)) { conn.SetPassword(dbPassword); conn.Open(); using (var command = new SQLiteCommand(SQLiteText.Registry_Get_Interface, conn)) { using (var rdr = command.ExecuteReader(CommandBehavior.CloseConnection)) { if (rdr.Read()) { parm = new InterfaceInfo(); parm.UniqueID = ComUtility.DBNullGuidHandler(rdr["unique_id"]); parm.InterfaceIP = ComUtility.DBNullStringHandler(rdr["interface_ip"]); parm.InterfacePort = ComUtility.DBNullInt32Handler(rdr["interface_port"]); parm.InterfaceUser = ComUtility.DBNullStringHandler(rdr["interface_user"]); parm.InterfacePwd = ComUtility.DBNullStringHandler(rdr["interface_pwd"]); parm.InterfaceDetect = ComUtility.DBNullInt32Handler(rdr["interface_detect"]); parm.InterfaceInterrupt = ComUtility.DBNullInt32Handler(rdr["interface_interrupt"]); parm.InterfaceSyncTime = ComUtility.DBNullBooleanHandler(rdr["interface_synctime"]); parm.UpdateTime = ComUtility.DBNullDateTimeHandler(rdr["update_time"]); } } } } return(parm); } catch { throw; } }
protected InterfaceInfo LoadInterfaceFromType(TypeDefinition type) { if (type == null) { return(null); } var inferfaceInfo = default(InterfaceInfo); if ((_interfaceContainer.ContainsKey(type.FullName))) { inferfaceInfo = _interfaceContainer[type.FullName]; } else { inferfaceInfo = new InterfaceInfo() { Name = type.Name, FullName = type.FullName }; foreach (var interfaceType in type.Interfaces) { if (IsDirectBaseInterface(interfaceType, type.Interfaces)) { var baseintInfo = LoadInterfaceFromType(interfaceType as TypeDefinition); if (baseintInfo != null) { inferfaceInfo.BaseInterfaceInfos.Add(baseintInfo); } } } _interfaceContainer.Add(type.FullName, inferfaceInfo); } return(inferfaceInfo); }
/// <summary> /// Calls the appropriate GetInterfaceInfo method depending on whether we are dealing with an implicit or explicit service type and /// returns the a dictionary of Inteface and Event info exposed by either service type /// </summary> /// <param name="grainType"></param> /// <returns></returns> internal static GrainInterfaceInfo GetInterfaceInfo(Type grainType) { var result = new GrainInterfaceInfo(); Dictionary <int, Type> interfaces = GrainInterfaceData.GetRemoteInterfaces(grainType); if (interfaces.Keys.Count == 0) { // Should never happen! Debug.Fail("Could not find any service interfaces for type=" + grainType.Name); } IEqualityComparer <InterfaceInfo> ifaceComparer = new InterfaceInfoComparer(); foreach (var interfaceId in interfaces.Keys) { Type interfaceType = interfaces[interfaceId]; var interfaceInfo = new InterfaceInfo(interfaceType); if (!result.Interfaces.Values.Contains(interfaceInfo, ifaceComparer)) { result.Interfaces.Add(GrainInterfaceData.GetGrainInterfaceId(interfaceType), interfaceInfo); } } return(result); }
public bool CardManagementAccountLookup(int issuerId, int productId, int cardIssueReasonId, string accountNumber, AuditInfo auditInfo, AccountDetails accountDetails, out string responseMessage) { _log.Trace(t => t("Looking up account in Card Management System.")); Veneka.Indigo.Integration.Config.IConfig cmsconfig; ExternalSystemFields externalFields; _integration.CardManagementSystem(productId, InterfaceArea.ISSUING, out externalFields, out cmsconfig); InterfaceInfo cmsinterfaceInfo = new InterfaceInfo { Config = cmsconfig, InterfaceGuid = cmsconfig.InterfaceGuid.ToString() }; //Do lookup in CMS var cmsresponse = _comsCore.AccountLookup(issuerId, productId, cardIssueReasonId, accountNumber, accountDetails, externalFields, cmsinterfaceInfo, auditInfo); if (cmsresponse.ResponseCode == 0) { // Sanity check that integration has actually returned an AccountDetails Object if (accountDetails == null) { throw new Exception("Card Management Interface responded successfuly but AccountDetail is null."); } _log.Trace(t => t("Account successfully found in Card Management System.")); //Validate returned account return(ValidateAccount(productId, accountDetails, out responseMessage)); } responseMessage = cmsresponse.ResponseCode + " " + cmsresponse.ResponseMessage; return(false); }
private bool ExecutePrepaidAccountCredit(FundsLoadListModel fundsLoad) { IntegrationController _integration = IntegrationController.Instance; Veneka.Indigo.Integration.Config.IConfig config; Veneka.Indigo.Integration.External.ExternalSystemFields externalFields; _integration.FundsLoadPrepaidSystem(fundsLoad.ProductId, out externalFields, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = config.InterfaceGuid.ToString() }; log.Debug("calling CreditPrepaidAccount"); AuditInfo auditInfo = new AuditInfo(); var cbsResponse = _comsPrepaid.CreditPrepaidAccount(fundsLoad.Amount, fundsLoad.PrepaidAccountNo, externalFields, interfaceInfo, auditInfo); if (cbsResponse.ResponseCode == 0) { return(true); } return(false); }
public static void WriteInterfaceLine([Claims] InterfaceInfo ifInfo, string !ifName) { bool found = false; delete ifInfo.driverName; delete ifInfo.driverVersion; InterfaceIPInfo[] in ExHeap ipConfigs = ifInfo.ipConfigs; if (ipConfigs != null) { for (int i = 0; i < ipConfigs.Length; i++) { InterfaceIPInfo ipc = ipConfigs[i]; IPv4 ipv4 = new IPv4(ipc.address); Console.WriteLine("TESTUTIL:IPAddress: {0,-14}", ipv4); DebugStub.WriteLine("TESTUTIL:IPAddress:{0}:", __arglist(ipv4.ToString())); found |= true; } delete ipConfigs; } if (found == false) { DebugStub.WriteLine("TESTUTIL:IPAddress: Not available."); } }
private static void RegisterHelper(InterfaceInfo reg) { var layerId = GetLayerForCreateInfo(reg.info); if (!m_interfaceStacks.ContainsKey(layerId)) { m_interfaceStacks.Add(layerId, new List <InterfaceInfo>()); } var theStack = m_interfaceStacks[layerId]; if (theStack.Contains(reg)) { return; } int idx = theStack.Count; for (int i = 0; i < theStack.Count; ++i) { if (theStack[i].xface.Camera.depth > reg.xface.Camera.depth) { idx = i; break; } } theStack.Insert(idx, reg); }
private KeyValuePair <string, TSAliasDescription> ToTypeAlias(InterfaceInfo ii) { var ret = new TSAliasDescription { TargetType = GetTypeName(ii.ResolvedType) }; ret.JsDoc.Add("", ii.HelpString); return(KVP($"{ii.Parent.Name}.{ ii.Name}", ret)); }
public DomainInterfaceInfo(InterfaceInfo interfaceInfo) { this.pdbId = interfaceInfo.pdbId; this.interfaceId = interfaceInfo.interfaceId; this.firstSymOpString = interfaceInfo.firstSymOpString; this.secondSymOpString = interfaceInfo.secondSymOpString; this.entityId1 = interfaceInfo.entityId1; this.entityId2 = interfaceInfo.entityId2; }
public override InterfaceInfo CreateInterfaceInfo(Type instanceType) { var ret = new InterfaceInfo { InterfaceInit = InterfaceInit, InterfaceFinalize = InterfaceFinalize, }; return(ret); }
protected override string GetOrleansGetMethodNameImpl(Type grainType, GrainInterfaceInfo grainInterfaceInfo) { if (grainInterfaceInfo.Interfaces.Keys.Count == 0) { // No public method is implemented in this grain type for orleans messages var nullInvokeMethod = @" Throw New NotImplementedException() "; return(nullInvokeMethod); } var interfaces = new Dictionary <int, InterfaceInfo>(grainInterfaceInfo.Interfaces); // Copy, as we may alter the original collection in the loop below var interfaceSwitchBody = String.Empty; foreach (var kv in interfaces) { var methodSwitchBody = String.Empty; int interfaceId = kv.Key; InterfaceInfo interfaceInfo = kv.Value; foreach (int methodId in interfaceInfo.Methods.Keys) { var methodInfo = interfaceInfo.Methods[methodId]; //add return type assembly and namespace in GetGenericTypeName(methodInfo.ReturnType); var invokeGrainMethod = string.Format("Return \"{0}\"", methodInfo.Name); methodSwitchBody += string.Format( @"Case {0} {1} " , methodId, invokeGrainMethod); } interfaceSwitchBody += String.Format(@" Case {0} ' {1} Select methodId {2} Case Else Throw New NotImplementedException(""interfaceId=""+interfaceId+"",methodId=""+methodId) End Select ", interfaceId, interfaceInfo.InterfaceType.Name, methodSwitchBody); } // End for each interface return(string.Format(@" Select interfaceId {0} Case Else Throw New System.InvalidCastException(""interfaceId=""+interfaceId) End Select", interfaceSwitchBody)); }
/// <summary> /// 重置选中的接口参数 /// </summary> /// <param name="info"></param> private void DoReSetParameterCommand(InterfaceInfo info) { ParameterEditor patameterEditor = new ParameterEditor(info.ParameterFileName, this.curentBrokerType); bool? dil = patameterEditor.ShowDialog(); if (dil.HasValue && dil.Value) { //重新加载配置 } }
internal Response <PrepaidAccountDetail> CheckPrepaidAccountDetails(int productId, string cardNumber, int mbr) { try { IntegrationController _integration = IntegrationController.Instance; Veneka.Indigo.Integration.Config.IConfig config; Veneka.Indigo.Integration.External.ExternalSystemFields externalFields; _integration.FundsLoadPrepaidSystem(productId, out externalFields, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = config.InterfaceGuid.ToString() }; log.Debug("calling GetPrepaidAccountDetail"); AuditInfo auditInfo = new AuditInfo(); var cbsResponse = _comsPrepaid.GetPrepaidAccountDetail(cardNumber, mbr, externalFields, interfaceInfo, auditInfo); if (cbsResponse.ResponseCode == 0) { // Sanity check that integration has actually returned an AccountDetails Object if (cbsResponse.Value == null) { throw new Exception("Prepaid Interface responded successfully but AccountDetail is null."); } log.Trace(t => t("Call to Prepaid System returned ResponseCode==0 and cbsResponse.Value!=null.")); if (cbsResponse.ResponseCode == 0) { var accountDetails = cbsResponse.Value; if (string.IsNullOrEmpty(accountDetails.AccountNumber)) { return(new Response <PrepaidAccountDetail>(null, ResponseType.UNSUCCESSFUL, "Prepaid Account Number is empty.", "Prepaid Interface responded successfully with object but account number is empty.")); } return(new Response <PrepaidAccountDetail>(accountDetails, ResponseType.SUCCESSFUL, cbsResponse.ResponseMessage, "")); } } else { log.Trace(t => t("Account NOT found in Prepaid System.")); } return(new Response <PrepaidAccountDetail>(null, ResponseType.UNSUCCESSFUL, cbsResponse.ResponseMessage, "")); } catch (Exception exp) { return(new Response <PrepaidAccountDetail>(null, ResponseType.UNSUCCESSFUL, "Error checking prepaid account", exp.Message)); } }
internal void ProceedInterface(string componentKey, XmlNode interfacesNode, InterfaceInfo itemInterface) { string interfaceName = itemInterface.Name; XmlNode faceNode = LookForInterfaceNode(interfacesNode, interfaceName); if (faceNode == null) { faceNode = CreateInterfaceNode(itemInterface, interfacesNode, interfaceName); } AddComponentKeyToInterfaceNode(faceNode, componentKey); AddInterfaceInfo(componentKey, faceNode, itemInterface); }
protected override string GetInvokerImpl( GrainInterfaceData si, CodeTypeDeclaration invokerClass, Type grainType, GrainInterfaceInfo grainInterfaceInfo, bool isClient) { //No public method is implemented in this grain type for orleans messages if (grainInterfaceInfo.Interfaces.Count == 0) { return(string.Format(@" var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(new NotImplementedException(""No grain interfaces for type {0}"")); return t.Task; ", TypeUtils.GetFullName(grainType, Language.CSharp))); } var builder = new StringBuilder(); builder.AppendFormat(@" try {{"); var interfaceSwitchBody = String.Empty; foreach (int interfaceId in grainInterfaceInfo.Interfaces.Keys) { InterfaceInfo interfaceInfo = grainInterfaceInfo.Interfaces[interfaceId]; interfaceSwitchBody += GetMethodDispatchSwitchForInterface(interfaceId, interfaceInfo); } builder.AppendFormat( @" if (grain == null) throw new System.ArgumentNullException(""grain""); switch (interfaceId) {{ {0} default: {1}; }}", interfaceSwitchBody, "throw new System.InvalidCastException(\"interfaceId=\"+interfaceId)"); builder.AppendFormat(@" }} catch(Exception ex) {{ var t = new System.Threading.Tasks.TaskCompletionSource<object>(); t.SetException(ex); return t.Task; }}"); return(builder.ToString()); }
Result?CreateResult(IDynamicAssembly assembly, IActivityMonitor monitor) { Result r = new Result(); bool hasNameError = false; foreach (var signature in _result) { var cInfo = CreateClassInfo(assembly, monitor, signature); if (cInfo == null) { return(null); } r.Roots.Add(cInfo); foreach (var i in signature) { Type iCreate = typeof(IPocoFactory <>).MakeGenericType(i); var iInfo = new InterfaceInfo(cInfo, i, iCreate); cInfo.Interfaces.Add(iInfo); r.AllInterfaces.Add(i, iInfo); } cInfo.OtherInterfaces.Remove(typeof(IPoco)); cInfo.OtherInterfaces.Remove(typeof(IClosedPoco)); foreach (var t in signature) { cInfo.OtherInterfaces.Remove(t); } foreach (var e in cInfo.OtherInterfaces) { IReadOnlyList <IPocoRootInfo>?value; if (r.OtherInterfaces.TryGetValue(e, out value)) { ((List <PocoRootInfo>)value).Add(cInfo); } else { r.OtherInterfaces.Add(e, new List <PocoRootInfo>() { cInfo }); } } hasNameError |= !cInfo.InitializeNames(monitor); } return(hasNameError || !r.CheckPropertiesVarianceAndInstantiationCycleError(monitor) || !r.BuildNameIndex(monitor) ? null : r); }
private bool CMSUpload(long pinBatchId, int languageId, long auditUserId, string auditWorkstation, out string responseMessage) { //Locking this process so that only one thread can run it at a time. //this is because we're generating unique card numbers and dont want to threads to try generate the same card numbers lock (_lockObject) { var cardObjects = FetchCardObjectsForPinBatch(pinBatchId, languageId, auditUserId, auditWorkstation); IntegrationController _integration = IntegrationController.Instance; Veneka.Indigo.Integration.Config.IConfig config; Veneka.Indigo.Integration.External.ExternalSystemFields externalFields; try { _integration.CardManagementSystem(cardObjects[0].IssuerId, InterfaceArea.PRODUCTION, out externalFields, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = "" }; AuditInfo auditInfo = new AuditInfo { AuditUserId = auditUserId, AuditWorkStation = auditWorkstation, LanguageId = languageId }; var response = COMSController.ComsCore.UploadGeneratedCards(cardObjects, externalFields, interfaceInfo, auditInfo); responseMessage = response.ResponseMessage; if (response.ResponseCode == 0) { return(true); } return(false); //return _integration.CardManagementSystem(cardObjects[0].IssuerId, InterfaceArea.PRODUCTION, out externalFields, out config).UploadGeneratedCards(cardObjects, externalFields, config, languageId, auditUserId, auditWorkstation, out responseMessage); } catch (NotImplementedException nie) { log.Warn("UploadGeneratedCards() method in CMS module not implemented.", nie); responseMessage = "CMS module not implemented."; return(false); } } }
public static void ResgiteStartupCode() { foreach (var i in SysAppConfig.Interfaces) { i.InterfaceType = Type.GetType(i.InterfaceTypeName); i.ImplementType = Type.GetType(i.ImplementTypeName); } StartupInterface = SysAppConfig.Interfaces.FirstOrDefault(p => p.Name == SysAppConfig.StarupKey); if (StartupInterface == null) { return; } //builder.RegisterInstance(StartupInterface.InterfaceType ).As(StartupInterface.ImplementType); }
internal static InterfaceInfo StartBuild(Type iType) { var ret = new InterfaceInfo(); ret.Name = iType.Name; ret.Description = GetDescription(iType); ret.Functions = BuildFuncInfoColl(iType); ret.ThrowsExceptionInfo = BuildExceptionInfo(iType); ret.Properties = BuildPropInfoCol(iType); ret.Structs = StructCollector.Structs; return(ret); }
private bool ExecuteBankAccountDebit(FundsLoadListModel fundsLoad, CustomerDetails customerDetails, long auditUserId, string auditWorkstation, int languageId) { try { log.Trace(t => t("ExecuteBankAccountDebit")); Veneka.Indigo.Integration.Config.IConfig config; Veneka.Indigo.Integration.External.ExternalSystemFields externalFields; IntegrationController _integration = IntegrationController.Instance; customerDetails.TotalCharged = customerDetails.FeeCharge.GetValueOrDefault(); customerDetails.AccountNumber = fundsLoad.BankAccountNo; _integration.FundsLoadCoreBankingSystem(customerDetails.ProductId, out externalFields, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = config.InterfaceGuid.ToString() }; log.Trace(config.ToString()); AuditInfo auditInfo = new AuditInfo { AuditUserId = auditUserId, AuditWorkStation = auditWorkstation, LanguageId = languageId }; FeeChargeLogic feelogic = new FeeChargeLogic(_cardManService, _comsCore, _integration); BaseResponse feeresponse = feelogic.ChargeAmount(customerDetails, auditInfo, config, externalFields); log.Trace(t => t("ExecuteBankAccountDebit:After feelogic.FeeCharge")); if (feeresponse.ResponseType != ResponseType.SUCCESSFUL) { log.Trace($"ExecuteBankAccountDebit: feeresponse.ResponseType != ResponseType.SUCCESSFUL || {feeresponse.ResponseMessage}"); return(false); } else { log.Trace($"ExecuteBankAccountDebit: feeresponse.ResponseType == ResponseType.SUCCESSFUL"); return(true); } } catch (Exception exp) { log.Trace($"ExecuteBankAccountDebit: Exception Occurred := {exp.Message}"); throw; } }
private void AddInterfaceInfo(string componentKey, XmlNode interfaceNode, InterfaceInfo interfaceInfo) { foreach (TLI.MemberInfo itemMember in interfaceInfo.Members) { if (true == IsInterfaceMethod(itemMember)) { AddMethod(interfaceNode, itemMember, componentKey); } else if (true == IsInterfaceProperty(itemMember)) { AddProperty(interfaceNode, itemMember, componentKey); } Marshal.ReleaseComObject(itemMember); } }
public void Write(BinaryWriter Writer) { Common.WriteWord(Writer, FMaxItems + 1); int count = 0; // goes from 1 -> interfacecount - 1 while (count <= FMaxItems) { InterfaceInfo ii = (InterfaceInfo)FItems[count]; ii.Write(Writer); count++; } }
protected void LoadInterfaceSubType(InterfaceInfo baseInterface) { foreach (var key in _interfaceContainer.Keys) { var itemType = this._interfaceContainer[key]; if (itemType.BaseInterfaceInfos.Contains(baseInterface)) { if (!baseInterface.SubType.Contains(itemType)) { baseInterface.SubType.Add(itemType); LoadInterfaceSubType(itemType); } } } }
private bool PrintPins(long pinBatchId, int languageId, long auditUserId, string auditWorkstation, out string responseMessage) { //Only allow one batch to be printed at a time. lock (_lockPinPrinting) { var cardObjects = FetchCardObjectsForPinBatch(pinBatchId, languageId, auditUserId, auditWorkstation); IntegrationController _integration = IntegrationController.Instance; Veneka.Indigo.Integration.Config.IConfig config; try { _integration.HardwareSecurityModule(cardObjects[0].IssuerId, InterfaceArea.PRODUCTION, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = "" }; AuditInfo auditInfo = new AuditInfo { AuditUserId = auditUserId, AuditWorkStation = auditWorkstation, LanguageId = languageId }; var response = COMSController.ComsCore.PrintPins(cardObjects, interfaceInfo, auditInfo); responseMessage = response.ResponseMessage; if (response.ResponseCode == 0) { return(true); } return(false); //return _integration.HardwareSecurityModule(cardObjects[0].IssuerId, InterfaceArea.PRODUCTION, out config).PrintPins(ref cardObjects, config, languageId, auditUserId, auditWorkstation, out responseMessage); } catch (NotImplementedException nie) { log.Warn("PrintPins() method in HSM module not implemented.", nie); responseMessage = "CMS module not implemented."; return(false); } } }
private void ServiceSwitch(InterfaceInfo intfInfo) { List <ServiceInfo> serviceInfoList = new List <ServiceInfo>(); ServiceInfo serviceInfo = intfInfo.ServiceDetail; serviceInfo.LogAction = UICmd; serviceInfoList.Add(serviceInfo); if (!intfInfo.ServiceStatus) { ServiceManager.Instance.CloseService(serviceInfoList); } else { ServiceManager.Instance.OpenService(serviceInfoList); } }
private void Form_DeviceSetting_Load(object sender, EventArgs e) { listBox1.Items.Clear(); if (SIManager != null) { SIManager.Reset(); for (int i = 0; i < SIManager.InterfaceCount; i++) { InterfaceInfo SIInfo = SIManager.GetInterfaceInfo(i); listBox1.Items.Add(SIInfo.ToString()); for (int j = 0; j < SIInfo.SoundChipCount; j++) { } } } }
internal void ProceedInterface(string componentKey, XmlNode dispatchesNode, InterfaceInfo itemInterface) { string interfaceName = itemInterface.Name; if (interfaceName.Substring(0, 1) != "_") { XmlNode faceNode = LookForInterfaceNode(dispatchesNode, interfaceName); if (faceNode == null) { faceNode = CreateInterfaceNode(itemInterface, dispatchesNode, interfaceName); } AddComponentKeyToInterfaceNode(faceNode, componentKey); AddInterfaceInfo(componentKey, faceNode, itemInterface); } }
private static void DumpInterface(SoundInterface soundInterface, InterfaceInfo info, int number) { Console.WriteLine("\t#{0} [{1}] ----------", number, info.Name); Console.WriteLine("\tDelay: {0} ms", soundInterface.Delay); Console.WriteLine("\tLowLevelAPI: {0}support", soundInterface.IsSupportingLowLevelApi ? "" : "not "); Console.WriteLine("\tChip Count: {0}", soundInterface.SoundChipCount); var chipCount = soundInterface.SoundChipCount; for (var i = 0; i < chipCount; i++) { using (var chip = soundInterface.GetSoundChip(i)) DumpChip(chip, i); } Console.WriteLine(); }
static void DumpInterface(SoundInterface soundInterface, InterfaceInfo info, int number) { Console.WriteLine("\t#{0} [{1}] ----------", number, info.Name); Console.WriteLine("\tDelay: {0} ms", soundInterface.Delay); Console.WriteLine("\tLowLevelAPI: {0}support", soundInterface.IsSupportingLowLevelApi ? "" : "not "); Console.WriteLine("\tChip Count: {0}", soundInterface.SoundChipCount); var chipCount = soundInterface.SoundChipCount; for (int i = 0; i < chipCount; i++) { using (var chip = soundInterface.GetSoundChip(i)) DumpChip(chip, i); } Console.WriteLine(); }
public TInterfaces(BinaryReader Reader, TConstantPool ConstantPool) { FReader = Reader; FMaxItems = Common.ReadWord(FReader) - 1; FItems = new ArrayList(); int count = 0; // goes from 1 -> interfacecount - 1 while (count <= FMaxItems) { InterfaceInfo ii = new InterfaceInfo(FReader, ConstantPool); FItems.Add(ii); count++; } }
private bool CheckAccountBalance(CustomerDetails customerDetails, int languageId, long auditUserId, string auditWorkstation, out string responseMessage) { log.Trace(t => t("CheckAccountBalance: New Path.")); responseMessage = String.Empty; //work out total customerDetails.TotalCharged = customerDetails.FeeCharge.GetValueOrDefault(); Veneka.Indigo.Integration.Config.IConfig config; Veneka.Indigo.Integration.External.ExternalSystemFields externalFields; IntegrationController _integration = IntegrationController.Instance; _integration.FundsLoadCoreBankingSystem(customerDetails.ProductId, out externalFields, out config); InterfaceInfo interfaceInfo = new InterfaceInfo { Config = config, InterfaceGuid = config.InterfaceGuid.ToString() }; log.Trace(config.ToString()); AuditInfo auditInfo = new AuditInfo { AuditUserId = auditUserId, AuditWorkStation = auditWorkstation, LanguageId = languageId }; log.Trace(t => t("Calling ComsCore.CheckBalance.")); var response = COMS.COMSController.ComsCore.CheckBalance(customerDetails, externalFields, interfaceInfo, auditInfo); log.Trace(t => t($"ComsCore.CheckBalance Response = {response.ResponseCode} {response.ResponseMessage}")); if (response.ResponseCode == 0) { return(true); } else { responseMessage = response.ResponseMessage; log.Trace(responseMessage); return(false); } }
private string GetMethodDispatchSwitchForInterface(int interfaceId, InterfaceInfo interfaceInfo) { string methodSwitchBody = String.Empty; foreach (int methodId in interfaceInfo.Methods.Keys) { MethodInfo methodInfo = interfaceInfo.Methods[methodId]; var returnType = methodInfo.ReturnType; GetGenericTypeName(returnType); // Adds return type assembly and namespace to import / library lists if necessary var invokeGrainArgs = string.Empty; ParameterInfo[] paramInfoArray = methodInfo.GetParameters(); for (int count = 0; count < paramInfoArray.Length; count++) { invokeGrainArgs += string.Format("({0})arguments[{1}]", GetGenericTypeName(paramInfoArray[count].ParameterType), count); if (count < paramInfoArray.Length - 1) invokeGrainArgs += ", "; } // TODO: parameters for indexed properties string grainTypeName = GetGenericTypeName(interfaceInfo.InterfaceType); string methodName = methodInfo.Name; string invokeGrainMethod; if (!methodInfo.IsSpecialName) { invokeGrainMethod = string.Format("(({0})grain).{1}({2})", grainTypeName, methodName, invokeGrainArgs); } else if (methodInfo.Name.StartsWith("get_")) { invokeGrainMethod = string.Format("(({0})grain).{1}", grainTypeName, methodName.Substring(4)); } else if (methodInfo.Name.StartsWith("set_")) { invokeGrainMethod = string.Format("(({0})grain).{1} = {2}", grainTypeName, methodName.Substring(4), invokeGrainArgs); } else { // Should never happen throw new InvalidOperationException("Don't know how to handle method " + methodInfo); } string caseBodyStatements; if (returnType == typeof(void)) { caseBodyStatements = string.Format( @"{0}; return System.Threading.Tasks.Task.FromResult((object)true); ", invokeGrainMethod); } else if (GrainInterfaceData.IsTaskType(returnType)) { if (returnType != typeof(Task)) GetGenericTypeName(returnType.GetGenericArguments()[0]); if (returnType == typeof(Task)) { caseBodyStatements = string.Format( @"return {0}.ContinueWith(t => {{if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)null; }}); ", invokeGrainMethod); } else caseBodyStatements = string.Format( @"return {0}.ContinueWith(t => {{if (t.Status == System.Threading.Tasks.TaskStatus.Faulted) throw t.Exception; return (object)t.Result; }}); ", invokeGrainMethod); } else { // Should never happen throw new InvalidOperationException(string.Format( "Don't know how to create invoker for method {0} with Id={1} of returnType={2}", methodInfo, methodId, returnType)); } methodSwitchBody += string.Format(@" case {0}: {1}", methodId, caseBodyStatements); } const string defaultCase = @"default: throw new NotImplementedException(""interfaceId=""+interfaceId+"",methodId=""+methodId);"; return String.Format(@"case {0}: // {1} switch (methodId) {{ {2} {3} }}", interfaceId, interfaceInfo.InterfaceType.Name, methodSwitchBody, defaultCase); }
private string GetMethodDispatchSwitchForInterface(int interfaceId, InterfaceInfo interfaceInfo) { var methodSwitchBody = String.Empty; foreach (int methodId in interfaceInfo.Methods.Keys) { var methodInfo = interfaceInfo.Methods[methodId]; var returnType = methodInfo.ReturnType; GetGenericTypeName(returnType); // Adds return type assembly and namespace to import / library lists if necessary var invokeGrainArgs = string.Empty; ParameterInfo[] paramInfoArray = methodInfo.GetParameters(); for (int count = 0; count < paramInfoArray.Length; count++) { invokeGrainArgs += string.Format("CType(arguments({1}),{0})", GetGenericTypeName(paramInfoArray[count].ParameterType), count); if (count < paramInfoArray.Length - 1) invokeGrainArgs += ", "; } // todo: parameters for indexed properties var grainTypeName = GetGenericTypeName(interfaceInfo.InterfaceType); var methodName = methodInfo.Name; string invokeGrainMethod; if (!methodInfo.IsSpecialName) { invokeGrainMethod = string.Format("CType(grain,{0}).{1}({2})", grainTypeName, methodName, invokeGrainArgs); } else if (methodInfo.Name.StartsWith("get_")) { invokeGrainMethod = string.Format("CType(grain,{0}).{1}", grainTypeName, methodName.Substring(4)); } else if (methodInfo.Name.StartsWith("set_")) { invokeGrainMethod = string.Format("CType(grain,{0}).{1} = {2}", grainTypeName, methodName.Substring(4), invokeGrainArgs); } else { // Should never happen throw new InvalidOperationException("Don't know how to handle method " + methodInfo); } string caseBodyStatements; if (returnType == typeof(void)) { caseBodyStatements = string.Format( @"{0} Return System.Threading.Tasks.Task.FromResult(CObj(True)) ", invokeGrainMethod); } else if (GrainInterfaceData.IsTaskType(returnType)) { if (returnType == typeof(Task)) { caseBodyStatements = string.Format( @" Return {0}.ContinueWith(Function(t) If t.Status = System.Threading.Tasks.TaskStatus.Faulted Then : Throw t.Exception : End If Return Nothing End Function) ", invokeGrainMethod); } else caseBodyStatements = string.Format( @"Return {0}.ContinueWith(Function(t) CObj(t.Result)) ", invokeGrainMethod); } else { // Should never happen throw new InvalidOperationException(string.Format( "Don't know how to create invoker for method {0} with Id={1} of returnType={2}", methodInfo, methodId, returnType)); } methodSwitchBody += string.Format(@" Case {0} {1}", methodId, caseBodyStatements); } var defaultCase = @" Case Else Throw New NotImplementedException(""interfaceId=""+interfaceId+"",methodId=""+methodId)"; return String.Format(@"Case {0} ' {1} Select Case methodId {2} {3} End Select ", interfaceId, interfaceInfo.InterfaceType.Name, methodSwitchBody, defaultCase); }