public String CheckPayooAccount(String username) { String result = ""; try { Credential credential = new Credential(); credential.APIUsername = ConfigurationManager.AppSettings["APIUsername"]; credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"]; credential.APISignature = ConfigurationManager.AppSettings["APISignature"]; Caller caller = new Caller(); caller.InitCall(ConfigurationManager.AppSettings["PayooBusinessAPI"], credential, Server.MapPath(@"..\App_Data\Certificates\biz_pkcs12.p12"), "alpe", Server.MapPath(@"..\App_Data\Certificates\payoo_public_cert.pem")); CheckPayooAccountRequestType req = new CheckPayooAccountRequestType(); req.AccountID = username; // agentb2 ; vimp71 | [email protected] CheckPayooAccountResponseType res = (CheckPayooAccountResponseType)caller.Call("CheckPayooAccount", req); if (res.Ack == AckCodeType.Success) { result = "Valid"; } else { result = "InValid Account"; } } catch (Exception ex) { result = "False"; throw ex; } return result; }
public async Task TestLogin() { Caller api = new Caller(info); Assert.IsNotNull(api); await api.Login(); Assert.IsTrue(api.hasSessionId); }
void run() { if (director_primitives.PrintDebug) Console.WriteLine("------------ Start ------------ "); Caller myCaller = new Caller(); // test C++ base class using (Base myBase = new Base(100.0)) { makeCalls(myCaller, myBase); } if (director_primitives.PrintDebug) Console.WriteLine("--------------------------------"); // test vanilla C++ wrapped derived class using (Base myBase = new Derived(200.0)) { makeCalls(myCaller, myBase); } if (director_primitives.PrintDebug) Console.WriteLine("--------------------------------"); // test director / C# derived class using (Base myBase = new CSharpDerived(300.0)) { makeCalls(myCaller, myBase); } if (director_primitives.PrintDebug) Console.WriteLine("------------ Finish ------------ "); }
static void Main() { Console.WriteLine("Adding and calling a normal C++ callback"); Console.WriteLine("----------------------------------------"); Caller caller = new Caller(); using (Callback callback = new Callback()) { caller.setCallback(callback); caller.call(); caller.resetCallback(); } Console.WriteLine(); Console.WriteLine("Adding and calling a C# callback"); Console.WriteLine("------------------------------------"); using (Callback callback = new CSharpCallback()) { caller.setCallback(callback); caller.call(); caller.resetCallback(); } Console.WriteLine(); Console.WriteLine("C# exit"); }
public RemotingManagementSession(Caller caller) { if (caller == null) throw new ArgumentNullException("caller"); this.caller = caller; user = new User { Company = caller.Company, Name = caller.Name }; }
public User Validate(Caller caller) { var partialCaller = Find(caller); if (partialCaller == null) return null; return new User(); }
public IManagementSession Create(Caller caller) { var partialCaller = Find(caller); if (partialCaller == null) throw new Exception(string.Format("No session registered for caller {0}", caller)); return sessionFactories[partialCaller](caller); }
public async Task TestGetVersion() { Caller api = new Caller(info); Assert.IsNotNull(api); Assert.IsFalse(api.hasSessionId); var level = await api.GetVersion(); Assert.IsTrue(api.hasSessionId); Assert.AreEqual(level.Status, 0); Assert.IsTrue(level.Content.Version.Length != 0); }
public async Task TestLogout() { Caller api = new Caller(info); Assert.IsNotNull(api); await api.Login(); Assert.IsTrue(api.hasSessionId); var logout = await api.Logout(); Assert.IsFalse(api.hasSessionId); Assert.AreEqual(logout.Status, 0); }
public static IManagementSession Create(this IManagementSessionFactory factory, string company, string name, string keyType, string keyValue) { var caller = new Caller { Company = company, Name = name, KeyType = keyType, KeyValue = keyValue, }; return factory.Create(caller); }
private Caller Find(Caller caller) { foreach (var partialGenerator in partialGenerators) { var partialCaller = partialGenerator(caller); if (sessionFactories.ContainsKey(partialCaller)) return partialCaller; } return null; }
void run() { Caller caller = new Caller(); { DirectorVoidPointer dvp = new DirectorVoidPointer(5); int x = caller.callVirtualIn(dvp, 6); if (x != 106) throw new Exception("Fail1 should be 106, got " + x); global::System.IntPtr ptr = dvp.nonVirtualVoidPtrOut(); x = Caller.VoidToInt(ptr); if (x != 106) throw new Exception("Fail2 should be 106, got " + x); x = Caller.VoidToInt(dvp.voidPtrOut()); if (x != 106) throw new Exception("Fail3 should be 106, got " + x); } { DirectorVoidPointer dvp = new director_void_VoidPointer(5); int x = caller.callVirtualIn(dvp, 6); if (x != 12) throw new Exception("Fail1 should be 12, got " + x); global::System.IntPtr ptr = dvp.nonVirtualVoidPtrOut(); x = Caller.VoidToInt(ptr); if (x != 25) throw new Exception("Fail2 should be 25, got " + x); x = Caller.VoidToInt(dvp.voidPtrOut()); if (x != 1234) throw new Exception("Fail3 should be 1234, got " + x); } { DirectorVoidPointer dvp = new DirectorVoidPointer(10); int x = caller.callVirtualOut(dvp); if (x != 10) throw new Exception("Bad1 should be 10, got " + x); global::System.IntPtr ptr = dvp.nonVirtualVoidPtrOut(); x = dvp.nonVirtualVoidPtrIn(ptr); if (x != 110) throw new Exception("Bad2 should be 110, got " + x); } { DirectorVoidPointer dvp = new director_void_VoidPointer(10); int x = caller.callVirtualOut(dvp); if (x != 1234) throw new Exception("Bad3 should be 1234, got " + x); global::System.IntPtr ptr = dvp.nonVirtualVoidPtrOut(); x = dvp.nonVirtualVoidPtrIn(ptr); if (x != 1334) throw new Exception("Bad4 should be 1334, got " + x); } }
static void Main(string[] args) { var caller = new Caller(); var result1 = caller.CallOp1(10, 5); Console.WriteLine("Op1 result is {0}", result1); var result2 = caller.CallOp2(10, 5); Console.WriteLine("Op2 result is {0}", result2); var result3 = caller.CallOp3(10, 5); Console.WriteLine("Op3 result is {0}", result3); }
public void SendCall_SendResult_Completed() { Callee callee = new Callee { Result = CallResult.Completed }; int target = _runtime.AddActor (callee); Caller caller = new Caller { History = _history, Finished = _finishTest, Target = target }; int callerId = _runtime.AddActor (caller); _runtime.SendMessage (callerId, Start, null, 0); _finishTest.WaitOne (); CollectionAssert.AreEquivalent ( new string[] { "Completed 2 hi" }, _history ); }
public Func<Caller, RemotingManagementSession> this[Caller caller] { get { return sessionFactories[caller]; } set { if (value == null) sessionFactories.Remove(caller); else sessionFactories[caller] = value; } }
void run() { Caller caller = new Caller(); caller.call_virtualMethod(new director_pass_by_value_Derived()); { int countdown = 5; while (true) { WaitForGC(); if (--countdown == 0) break; }; } // bug was the passByVal 'global' object was destroyed after the call to virtualMethod had finished. int ret = runme.passByVal.getVal(); if (ret != 0x12345678) throw new Exception("Bad return value, got " + ret.ToString("x")); }
public Boolean GetCallerId(int nChannel, ref Caller callerInfo) { StringBuilder szCallerIDBuffer = new StringBuilder(128); StringBuilder szName = new StringBuilder(128); StringBuilder szTime = new StringBuilder(128); int retVal = AD101NativeMethods.AD101_GetCallerID(nChannel, szCallerIDBuffer, szName, szTime); callerInfo.CallerId = szCallerIDBuffer.ToString(); callerInfo.ChannelId = nChannel; callerInfo.Name = szName.ToString(); //callerInfo.CalledTime = szTime.ToString(); return (retVal == OK); }
void makeCalls(Caller myCaller, Base myBase) { myCaller.set(myBase); myCaller.NoParmsMethodCall(); if (myCaller.BoolMethodCall(true) != true) throw new Exception("failed"); if (myCaller.BoolMethodCall(false) != false) throw new Exception("failed"); if (myCaller.IntMethodCall(-123) != -123) throw new Exception("failed"); if (myCaller.UIntMethodCall(123) != 123) throw new Exception("failed"); if (myCaller.FloatMethodCall((float)-123.456) != (float)-123.456) throw new Exception("failed"); if (myCaller.CharPtrMethodCall("test string") != "test string") throw new Exception("failed"); if (myCaller.ConstCharPtrMethodCall("another string") != "another string") throw new Exception("failed"); if (myCaller.EnumMethodCall(HShadowMode.HShadowHard) != HShadowMode.HShadowHard) throw new Exception("failed"); myCaller.ManyParmsMethodCall(true, -123, 123, (float)123.456, "test string", "another string", HShadowMode.HShadowHard); myCaller.NotOverriddenMethodCall(); myCaller.reset(); }
public void AutoRegister(Castle.Windsor.IWindsorContainer container, Assembly assembly) { this._container = container; container.Register( AllTypes .FromAssembly(assembly) .Where(type => typeof(IHandles).IsAssignableFrom(type) ) .Configure(registration => { registration.LifeStyle.Is(LifestyleType.Transient); registration.Named(registration.Implementation.Name); var c = new Caller(); c.Theclass = registration.Implementation; //Get type of first parameter of function Handle var method = Enumerable.First<MethodInfo>(registration.Implementation.GetMethods().Where(r => r.Name == "Handle")); ParameterInfo[] i = method.GetParameters(); c.Message = i[0].ParameterType; Callers.Add(c); }) ); }
public async Task <int> UpdateApprenticeship(IDbConnection connection, IDbTransaction trans, Apprenticeship apprenticeship, Caller caller) { var parameters = GetApprenticeshipUpdateCreateParameters(apprenticeship); parameters.Add("@id", apprenticeship.Id, DbType.Int64); var refItem = caller.CallerType == CallerType.Employer ? "EmployerRef = @employerRef" : "ProviderRef = @providerRef"; var returnCode = await connection.ExecuteAsync( sql : "UPDATE [dbo].[Apprenticeship] " + "SET CommitmentId = @commitmentId, FirstName = @firstName, LastName = @lastName, DateOfBirth = @dateOfBirth, NINUmber = @niNumber, " + "ULN = @uln, TrainingType = @trainingType, TrainingCode = @trainingCode, TrainingName = @trainingName, Cost = @cost, " + "StartDate = @startDate, EndDate = @endDate, PaymentStatus = @paymentStatus, AgreementStatus = @agreementStatus, " + $"{refItem} WHERE Id = @id;", param : parameters, transaction : trans, commandType : CommandType.Text); return(returnCode); }
public PrepareEventArgs(PrepareStatus status, Caller caller) : base() { this.status = status; this.caller = caller; }
public void PrepareExerciseWeb(string s) { RaiseEvent(OnPrepareExerciseStart, PrepareStatus.Preparing); PrepareExerciseWebParams pwp = JsonConvert.DeserializeObject<PrepareExerciseWebParams>(s); Exercise e = (pwp.Exercise) as Exercise; this.prepareCaller = (Caller)(pwp.Caller); //Exercise e = JsonConvert.DeserializeObject<Exercise>(s); behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb); if (behaviour == null) { DebugLifeware.LogAllDevelopers("Importante: Behaviour no encontrado"); RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.NotFound); return; } behaviour.RepetitionEnd += behaviour_PrepareEndWeb; timeSinceStartPrepareWeb = Time.time; behaviour.PrepareWeb(); CurrentExercise = e; }
public WebServiceManagementSession(IWebServiceManagementConfiguration configuration, Caller caller) { service = new ConfigurableWebService(configuration); this.caller = caller; }
public string RefundAll(int IdDuan) { string result = "false"; var dautu = db.EntityDauTus.Where(g => g.IdDuAn == IdDuan).ToList(); foreach (var item in dautu) { Credential credential = new Credential(); credential.APIUsername = ConfigurationManager.AppSettings["APIUsername"]; credential.APIPassword = ConfigurationManager.AppSettings["APIPassword"]; credential.APISignature = ConfigurationManager.AppSettings["APISignature"]; Caller caller = new Caller(); caller.InitCall(ConfigurationManager.AppSettings["PayooBusinessAPI"], credential, Server.MapPath(@"..\App_Data\Certificates\biz_pkcs12.p12"), "alpe", Server.MapPath(@"..\App_Data\Certificates\payoo_public_cert.pem")); UpdateOrderStatusRequestType request = new UpdateOrderStatusRequestType(); request.NewStatus = OrderStatus.Cancelled; request.ShopID = long.Parse(ConfigurationManager.AppSettings["ShopID"]); request.UpdateLog = "Dự án kết thúc thất bại."; request.OrderID = item.OrderID_Payoo; UpdateOrderStatusResponseType response = (UpdateOrderStatusResponseType)caller.Call("UpdateOrderStatus", request); if (response.Ack == AckCodeType.Success || response.Ack == AckCodeType.SuccessWithWarning) { result = "Refund success"; } else { return "Fail"; } } return result; }
public static void WriteLine(string message, Types type, Caller caller) { WriteLine(message, type, caller, string.Empty); }
public void StartVoidCall_Failed() { Caller actor = new Caller { History = _history, Finished = _finishTest }; int actorId = _runtime.AddActorToThread("T1", actor); _runtime.StartVoidCall(async () => { await Task.Delay(50); throw new Exception("oi"); }, actorId); _finishTest.WaitOne(); CollectionAssert.AreEquivalent( new string[] { "Failure 1" }, _history ); }
public PrepareExerciseWebParams(Exercise e, Caller c) { this.Exercise = e; this.Caller = c; }
//开启时间同步 void StartTimeSync() { var t = new Thread(() => { var destr = new Caller().InvokeTPPost<UltraDbEntity.T_ERP_User>( new UltraDbEntity.T_ERP_User { }, new LoginController(), "ServerTime"); TimeSync.Default.StartSync(destr.CreateDate); }); t.Start(); }
public void StartCall_Completed() { Caller actor = new Caller { History = _history, Finished = _finishTest }; int actorId = _runtime.AddActorToThread("T1", actor); _runtime.StartCall(async () => { await Task.Delay(50); return 77; }, actorId); _finishTest.WaitOne(); CollectionAssert.AreEquivalent( new string[] { "Completed 1 77" }, _history ); }
public void StartCall_Failed() { Caller actor = new Caller { History = _history, Finished = _finishTest }; int actorId = _runtime.AddActorToThread("T1", actor); _runtime.StartCall(Fail, actorId); _finishTest.WaitOne(); CollectionAssert.AreEquivalent( new string[] { "Failure 1" }, _history ); }
public static void WriteLine(string message, Types type, Caller caller, string convertedValue) { WriteLine(new Message(message, type, caller, convertedValue)); }