public static Service StartService(string ip, string portstr) { MMOChannelService mmochannelService = new MMOChannelService(); ServiceInvoker.StartService(ip, portstr, mmochannelService); MMOChannelService.StartReporting(mmochannelService); return(mmochannelService); }
public async Task <IActionResult> Search([FromQuery] string searchParams = "") { return(await ServiceInvoker.AsyncOk(async() => { var people = await _personRepository.Search(searchParams); return people.Select(x => Mapper.Map <PersonVm>(x)); })); }
private void AdjustSelectedInvoice(AdjustInputDetails adjustInputDetails) { BaseValidator validator = new BaseValidator(); if (!validator.AdjustInvoice(adjustInputDetails)) { ShowError(validator.ClientException, AdjustInvoiceError); return; } MessageBoxResult msgResult = MessageBox.Show("Are you sure you want to adjust this invoice?", "Adjustment Confirmation", MessageBoxButton.OKCancel); if (msgResult == MessageBoxResult.Cancel) { EnableApplicationBar(); return; } PageInProgress = true; this.ProgressBar.Show(); string postData = JsonConvert.SerializeObject(adjustInputDetails); try { ServiceInvoker.InvokeServiceUsingPost("api/t360/Invoice/AdjustInvoice", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { Deployment.Current.Dispatcher.BeginInvoke(() => { EnableApplicationBar(); this.ProgressBar.Hide(); PageInProgress = false; NavigationService.GoBack(); }); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), AdjustInvoiceError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } } }); } catch (Exception ex) { ShowError((AppException)ex); } }
public static UnifiedNetwork.Entity.Service StartService(string ip, string portstr) { DSService.Instance = new DSService(); ServiceInvoker.StartService(ip, portstr, DSService.Instance); if (FeatureMatrix.IsEnable("ServiceReporter")) { DSService.StartReporting(DSService.Instance); } return(DSService.Instance); }
private void RejectSelectedInvoice(RejectInput rejectInputDetails, string postData) { try { if (Source == Model.Base.Source.INVOICE_MULTI_REJECT_CONFIRMATION) { ServiceInvoker.InvokeServiceUsingPost("/api/t360/Invoice/RejectMultipleInvoice", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } else { handleRejectError(result.ErrorDetails, Constants.RejectInvoiceError); } }); } else if (Source == Model.Base.Source.INVOICE_SINGLE_REJECT) { ServiceInvoker.InvokeServiceUsingPost("/api/t360/Invoice/RejectInvoice", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { Deployment.Current.Dispatcher.BeginInvoke(() => { NavigationService.RemoveBackEntry(); NavigationService.GoBack(); }); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), Constants.RejectInvoiceError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } } }); } } catch (Exception ex) { ShowError((AppException)ex); } }
MainViewModel( [Import] ServiceInvoker invoker, [ImportMany] IRequestInfo[] requestInfos, [Import] MyXmlListener xmlListener, [Import] MyListListener listListener) { _invoker = invoker; XmlListener = xmlListener; ListListener = listListener; RequestInfos = new CollectionView(requestInfos); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async(context) => { await ServiceInvoker.Invoke(DotNetCoreRadiumPlugin.KernalInstance, new Messsaging.DCRadiumContext(context)); }); }
public static string GetAfmInfo(string afm) { RgWsBasStoixEpitRtUser result = ServiceInvoker.InvokeggpsService2(afm.Trim()); JavaScriptSerializer jss = new JavaScriptSerializer(); string json = jss.Serialize(result); //fix date serialization in Json json = json.Replace("\"\\/Date(", "new Date(").Replace(")\\/\"", ")"); return(json); }
private void GotoLineItemAdjustPage() { string postData = JsonConvert.SerializeObject(new ReasonCodeMultipleInput() { Action = "AdjustSelectedLineItems", InvoiceId = LineItemInputDetails.InvoiceId, SelectedLineItemIds = LineItemInputDetails.SelectedLineItemIds }); try { ServiceInvoker.InvokeServiceUsingPost("/api/t360/Invoice/GetReasonCodes", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { LineItemInputDetails.Reasons = JsonConvert.DeserializeObject <List <ReasonCode> >(result.Output); Deployment.Current.Dispatcher.BeginInvoke(() => { this.ProgressBar.Show(); PageInProgress = true; string url = string.Format("/Tymetrix.T360.Mobile.Client.AppWP8;component/Invoice/AdjustPage.xaml"); NavigationService.Navigate(new Uri(url, UriKind.Relative)); this.ProgressBar.Hide(); }); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), ConfirmationError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { this.ProgressBar.Hide(); PageInProgress = false; RedirectToInvoiceList(); }); } else { EnableApplicationBar(); } } PageInProgress = false; }); } catch (Exception ex) { ShowError((AppException)ex); EnableApplicationBar(); } }
public void Transfer(string fromAccountId, string toAccountId, double amount) { try { ServiceInvoker.Invoke <IWithdrawService>(proxy => proxy.Withdraw(fromAccountId, amount), "withdrawservice"); ServiceInvoker.Invoke <IDepositService>(proxy => proxy.Deposit(toAccountId, amount), "depositservice"); } catch (Exception ex) { throw new FaultException(new FaultReason(ex.Message)); } }
public void Handle(HttpContext context) { Kernel kernel = RadiumAspService.Kernel; if (kernel == null) { kernel = new Kernel(Assembly.GetCallingAssembly()); RadiumAspService.Kernel = kernel; } ServiceInvoker.Invoke(kernel, new Messaging.ASPRadiumContext(context)); }
static void Main(string[] args) { string fromAccountId = "123456789"; string toAccountId = "987654321"; double amount = 1000; using (TransactionScope transactionScope = new TransactionScope()) { ServiceInvoker.Invoke <IWithdrawService>(proxy => proxy.Withdraw(fromAccountId, amount), "withdrawservice"); ServiceInvoker.Invoke <IDepositService>(proxy => proxy.Deposit(toAccountId, amount), "depositservice"); transactionScope.Complete(); } }
public static void LogOff() { ServiceInvoker.InvokeServiceUsingGet("api/t360/Security/DoLogOff", delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; }, false); PhoneApplicationService.Current.State.Clear(); UserData.Instance.Clear(); Credential.Instance.Clear(); UserActivity.Instance.StopTimer(); ServiceInvoker.ClearCookies(); }
public IEnumerable <Recipe> GetRecipeById(int Id) { if (Id.Equals(0)) { return(GetAllRecipes()); } else { string response = ServiceInvoker.GetServiceResults("http://localhost:8000/api/Recipes/" + Id); return(GenerateRecipesList(response)); } }
public async Task <UserSessionInfo> Code2Session(WeiXinAppInfo appInfo, string jsCode) { var request = new AuthorizeCode2SessionRequest { AppId = appInfo.AppId, Secret = appInfo.AppSecret, JSCode = jsCode }; var response = await ServiceInvoker.RequestService <AuthorizeCode2SessionResponse>(request); return(response); }
} /// <summary> bool InvokePrinter(string ServiceUrl, byte[] bytes, string pPrinter) { string m = string.Empty; try { string _service = string.Empty; ServiceInvoker invoker = new ServiceInvoker(new Uri(ServiceUrl)); foreach (string service in invoker.AvailableServices) { _service = service; break; } List <string> methods = invoker.EnumerateServiceMethods(_service); foreach (string p in methods) { m += p + " || "; } string method = "PrintReceipt"; byte[] args = bytes; string[] argsPrinterName = new[] { pPrinter }; bool? result = invoker.InvokeMethod <bool?>(_service, method, args); if ((result != null)) { if ((result.Value == true)) { return(true); } else { PrintingsServiceClient printError = new PrintingsServiceClient(new Utilitys().Protocole(), new Utilitys().EndPoint()); printError.SetErrorsFromSilverlightWebPrinting(new Utilitys().GetCurrentMethod(), m + " service : " + _service); throw new Exception("Erreur dans l'appel du service d'impression"); } } return(true); //throw new Exception("Erreur dans l'appel du service d'impression"); } catch (Exception ex) { PrintingsServiceClient printError = new PrintingsServiceClient(new Utilitys().Protocole(), new Utilitys().EndPoint()); printError.SetErrorsFromSilverlightWebPrinting(new Utilitys().GetCurrentMethod(), ex.Message); throw ex; } }
private void GetInvoiceSummary(object sender, ServiceEventArgs se) { ServiceResponse result = se.Result; if (result.Status) { InvoiceSummaryDetails = JsonConvert.DeserializeObject <InvoiceSummary>(result.Output); Deployment.Current.Dispatcher.BeginInvoke(() => { try { InvoiceModel invoiceModel = (InvoiceModel)lbInvoice.SelectedItem; ServiceInvoker.InvokeServiceUsingGet("/api/t360/networks/invoices/" + invoiceModel.InvoiceId + "/lineitem", GetLineItemList, false); } catch (Exception ex) { if (ex is AppException) { ShowError((AppException)ex); } else { ShowError(new AppException(T360ErrorCodes.UNKNOWN)); } } }); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), Constants.InvoiceListError); Deployment.Current.Dispatcher.BeginInvoke(() => { lbInvoice.SelectionChanged -= lbInvoice_SelectionChanged; lbInvoice.SelectedIndex = -1; lbInvoice.SelectionChanged += lbInvoice_SelectionChanged; }); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { LoadInvoiceList(); }); } } }
public void InitServer() { var activator = new ServiceActivator(); var invoker = new ServiceInvoker(); var logger = new RedisLogger(new Uri("test")); var queue = new DefaultQueue(); var handler = new CfHandler(activator, invoker, logger, queue); var configurationProvider = new DefaultConfigurationProvider(); configurationProvider.BaseAddress = "http://localhost:8090"; var bus = new CfServiceBus(handler, logger, configurationProvider); bus.Host <IPingPongService>(new PingPongService()); bus.Start(); }
public void Start() { this.RegisterMessageBroker(); this._globalScope = new FluorineFx.Messaging.GlobalScope(); this._globalScope.Name = "default"; ScopeResolver scopeResolver = new ScopeResolver(this._globalScope); IClientRegistry clientRegistry = this._clientManager; ServiceInvoker serviceInvoker = new ServiceInvoker(); ScopeContext context = new ScopeContext("/", clientRegistry, scopeResolver, serviceInvoker, null); CoreHandler handler = new CoreHandler(); this._globalScope.Context = context; this._globalScope.Handler = handler; this._globalScope.Register(); this.StartServices(); this.StartEndpoints(); }
private void GotoAdjustPage() { string postData = JsonConvert.SerializeObject(new ReasonCodeMultipleInput() { Action = "AdjustSelectedLineItems", InvoiceId = rejectMultiple.InvoiceId, SelectedLineItemIds = lstLineItems.Select <InvoiceLineItemsInfo, string>(delegate(InvoiceLineItemsInfo info) { return(info.LineItemId); }).ToList() }); try { ServiceInvoker.InvokeServiceUsingPost("/api/t360/Invoice/GetReasonCodes", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { AdjustInput = JsonConvert.DeserializeObject <List <ReasonCode> >(result.Output); Deployment.Current.Dispatcher.BeginInvoke(() => { string adjustMultipleLineitems = JsonConvert.SerializeObject(rejectMultiple); string url = string.Format("/Tymetrix.T360.Mobile.Client.AppWP7;component/Invoice/AdjustLineItem.xaml?MultipleItems={0}", adjustMultipleLineitems); NavigationService.Navigate(new Uri(url, UriKind.Relative)); }); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), InvoiceReasonsError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } } PageInProgress = false; }); } catch (Exception ex) { ShowError((AppException)ex); } }
private void LoadTotalNetAmount() { InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice]; rejectMultiple.InvoiceId = invoiceSummary.InvoiceId; rejectMultiple.SelectedLineItemIds = new List <string>(); for (int i = 0; i < lstLineItems.Count; i++) { rejectMultiple.SelectedLineItemIds.Add(lstLineItems[i].LineItemId); } string postData = JsonConvert.SerializeObject(rejectMultiple); try { ServiceInvoker.InvokeServiceUsingPost("/api/t360/LineItem/CalculateLineItemNetAmount", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { MultipleLineItemsInputDetails rejectMultipleitem = JsonConvert.DeserializeObject <MultipleLineItemsInputDetails>(result.Output); rejectMultipleitem.InvoiceId = rejectMultiple.InvoiceId; rejectMultipleitem.SelectedLineItemIds = rejectMultiple.SelectedLineItemIds; PopulateRejectionData(rejectMultipleitem); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), LineItemReasonError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } } PageInProgress = false; }); } catch (Exception ex) { ShowError((AppException)ex); } }
static void Main(string[] args) { var activator = new ServiceActivator(); var invoker = new ServiceInvoker(); var logger = new ConsoleLogger(); var queue = new DefaultQueue(); var handler = new CfHandler(activator, invoker, logger, queue); var configurationProvider = new DefaultConfigurationProvider(); configurationProvider.BaseAddress = "http://localhost:8090"; configurationProvider.QueuePath = "SchedulerQueue"; var bus = new CfServiceBus(handler, logger, configurationProvider); bus.Host <IPingService>(new PingService()); bus.Start(); Console.ReadLine(); }
static void Main(string[] args) { ILogger logger = new ConsoleLogger(); IServiceActivator activator = new ServiceActivator(); IServiceInvoker invoker = new ServiceInvoker(); IQueue queue = new DefaultQueue(); ICfHandler handler = new CfHandler(activator, invoker, logger, queue); IConfigurationProvider configurationProvider = new DefaultConfigurationProvider(); configurationProvider.BaseAddress = "http://localhost:8088"; configurationProvider.QueuePath = "CustumerMessageQueue"; ICfBus bus = new CfServiceBus(handler, logger, configurationProvider); bus.Host <ICustomerService>(new CustomerService(new CashierProxy("http://localhost:8089"))); bus.Start(); logger.Write("Customer cashierService has started"); Console.ReadLine(); }
private void LoadInvoiceList() { try { PageInProgress = true; ProgressBar.Show(); ServiceInvoker.InvokeServiceUsingGet("/api/t360/Invoice/GetAwaitingInvoiceList", GetAwaitingInvoiceList, false); } catch (Exception ex) { if (ex is AppException) { ShowError((AppException)ex); } else { ShowError(new AppException(T360ErrorCodes.UNKNOWN)); } } }
public async Task <IActionResult> Login([FromBody] LoginVm parameters) { return(await ServiceInvoker.AsyncOk(async() => { var user = await _securityService.Login(parameters.Email, parameters.Password); if (user != null) { var result = new LoginResultVm(); var tokenRequest = await BuildTokenRequest(user); result.CurrentUser = Mapper.Map <UserVm>(user); result.AuthToken = tokenRequest.Token; return result; } throw new ApiException <string>("Invalid Credentials"); })); }
/// <summary>Gets the business sector of a phone number.</summary> /// <param name="phoneData">The phone data with its number.</param> /// <returns>Phone data with its correponding business sector.</returns> public PhoneData GetSectorByPhoneNumber(PhoneCoreData phoneCoreData) { var phoneResult = new PhoneData { Prefix = phoneCoreData.Prefix, Number = phoneCoreData.Number }; // Service invocation var serviceInvoker = new ServiceInvoker(_externalUrl); var result = serviceInvoker.GetRequest(phoneCoreData.Number); if (result.Result?.IsSuccessStatusCode == true) { phoneResult.Sector = JsonConvert.DeserializeObject <PhoneData>(result.Result.ContentResult)?.Sector; } else { phoneResult.Sector = null; } return(phoneResult); }
private void doneButton_Click(object sender, EventArgs e) { try { if (!Constants.Warning.ToUpper().Equals((InvoiceDetails.PageType.ToUpper()))) { ReturnToInvoiceListPage(); return; } if (!ServiceInvoker.IsConnected) { ShowError(new AppException(T360ErrorCodes.UnableToConnectServer)); return; } List <InvoiceModel> selectedInvoices = InvoiceDetails.InvoiceBasicDetails; List <string> selectedIds = new List <string>(); selectedInvoices.ForEach(x => { selectedIds.Add(x.InvoiceId.ToString()); }); Dictionary <string, object> selectedInvoiceIds = new Dictionary <string, object>(); selectedInvoiceIds.Add(Constants.SelectedInvoiceIds, selectedIds); selectedInvoiceIds.Add(Constants.ForceApprove, true); ServiceInvoker.InvokeServiceUsingPost("api/t360/Invoice/ApproveMultipleInvoice", JsonConvert.SerializeObject(selectedInvoiceIds), false, InvoiceMultiApproveHandler); } catch (Exception ex) { if (ex is AppException) { ShowError((AppException)ex); } else { ShowError(new AppException(T360ErrorCodes.UNKNOWN)); } } }
private void LoadReasons(string action) { string postData = JsonConvert.SerializeObject(new ReasonCodeInputDetails() { Action = action }); try { ServiceInvoker.InvokeServiceUsingPost("/api/t360/Invoice/GetReasonCodes", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (result.Status) { Reasons = JsonConvert.DeserializeObject <List <ReasonCode> >(result.Output); LoadReasons(); } else { List <Error> resultError = result.ErrorDetails; ShowError(new AppException(resultError), InvoiceReasonsError); if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code) { Deployment.Current.Dispatcher.BeginInvoke(() => { RedirectToInvoiceList(); }); } } PageInProgress = false; }); } catch (Exception ex) { ShowError((AppException)ex); } }
private void preferredCurrencyToggleSwitch_Unchecked(object sender, RoutedEventArgs e) { if (!ServiceInvoker.IsConnected) { DisableEvents(); preferredCurrencyToggleSwitch.IsChecked = true; EnableEvents(); ShowError(new AppException(T360ErrorCodes.UnableToConnectServer)); return; } string postData = JsonConvert.SerializeObject(new UserSettings() { IsPreferenceCurrencyEnabled = false }); ServiceInvoker.InvokeServiceUsingPost("/api/t360/Settings/UpdateSettings", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs) { ServiceResponse result = serviceEventArgs.Result; if (!result.Status) { ShowError(new AppException(result.ErrorDetails), SettingsError); } }); }
private void RetrieveLineItemSummary(int index) { try { string lineItemId = LineItemList[index].LineItemId.ToString(); PageInProgress = true; this.ProgressBar.Show(); DisableApplicationBar(); ServiceInvoker.InvokeServiceUsingGet("/api/t360/networks/invoices/" + HeaderDetails.InvoiceId + "/lineitem/" + lineItemId, GetLineItemDetails, false); } catch (Exception ex) { if (ex is AppException) { ShowError((AppException)ex); } else { ShowError(new AppException(T360ErrorCodes.UNKNOWN)); } } }
public ServiceConsumer(ServiceInvoker<ICalculator> serviceInvoker) { this.serviceInvoker = serviceInvoker; }