private async void ObterJsonAsync(object sender, EventArgs e) { RootService RootService = new RootService(); ApiService apiService = new ApiService(); resultText.Text = "Carregando dados..."; var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Mensagem", connection.Message, "Ok"); return; } Response response = new Response(); response = await RootService.GetAllUrl(UrlApiEntry.Text); if (response.IsSuccess) { resultText.Text = response.Result.ToString(); } else { resultText.Text = response.Message.ToString(); } }
// GET: Root public ActionResult Index() { var service = new RootService(); var model = service.GetRoots(); return(View(model)); }
public void StartService(ServiceType serviceType) { // Start the services, lock (serverManagerLock) { IService service = serviceFactory.CreateService(address, serviceType, connector); if (service == null) { throw new ApplicationException("Unable to create service of tyoe " + serviceType); } service.Start(); if (serviceType == ServiceType.Manager) { manager = (ManagerService)service; } else if (serviceType == ServiceType.Root) { root = (RootService)service; } else if (serviceType == ServiceType.Block) { block = (BlockService)service; } } }
//Get Delete public ActionResult Delete(int id) { var service = new RootService(); var model = service.GetRootById(id); return(View(model)); }
public ImmuClient(string immudbUrl) { this.channel = GrpcChannel.ForAddress(immudbUrl); this.instance = new ImmuService.ImmuServiceClient(channel); this.rootService = new RootService(this.instance); this.rootService.Init(); }
private Service DoCreateService(IServiceAddress serviceAddress, ServiceType serviceType, IServiceConnector connector) { Service service = null; if (serviceType == ServiceType.Manager) { if (manager == null) { string npath = Path.Combine(basePath, "manager"); if (!Directory.Exists(npath)) { Directory.CreateDirectory(npath); } manager = new FileSystemManagerService(connector, basePath, npath, serviceAddress); } service = manager; } else if (serviceType == ServiceType.Root) { if (root == null) { string npath = Path.Combine(basePath, "root"); if (!Directory.Exists(npath)) { Directory.CreateDirectory(npath); } root = new FileSystemRootService(connector, serviceAddress, npath); } service = root; } else if (serviceType == ServiceType.Block) { if (block == null) { string npath = Path.Combine(basePath, "block"); if (!Directory.Exists(npath)) { Directory.CreateDirectory(npath); } block = new FileSystemBlockService(connector, npath); } service = block; } if (service != null) { service.Started += ServiceStarted; service.Stopped += ServiceStopped; } return(service); }
private async void LoadContaApagar() { RootService RootService = new RootService(); this.IsRefreshing = true; var connection = await this.apiService.CheckConnection(); if (!connection.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert("Mensagem", connection.Message, "Ok"); return; } if (this.service == "Contas a receber") { this.url = Application.Current.Resources["UrlAPI"].ToString(); this.urlPrefix = Application.Current.Resources["UrlPrefix"].ToString(); this.prefixControl = Application.Current.Resources["UrlPrefixControllerContaReceber"].ToString(); this.action = "emp=99&fil=01"; } else { this.url = Application.Current.Resources["UrlAPI"].ToString(); this.urlPrefix = Application.Current.Resources["UrlPrefix"].ToString(); this.prefixControl = Application.Current.Resources["UrlPrefixControllerContaApagar"].ToString(); this.action = "emp=99&fil=01"; } var response = await RootService.GetAll(this.url, this.urlPrefix, this.prefixControl, this.action); var test = await RootService.GetAll(this.url, this.urlPrefix, this.prefixControl, this.action); var list = (Root)response.Result; List <Root> ListRoot = new List <Root>(); ListRoot.Add(list); if (!response.IsSuccess) { this.IsRefreshing = false; await Application.Current.MainPage.DisplayAlert("Mensagem", "Tempo de resposta do servidor inesperado Tente novamente", "Ok"); return; } this.ContaApagar = new ObservableCollection <Root>(ListRoot); this.Titulo = list.titulo.ToString(); this.Dados = new ObservableCollection <Dados>(list.dados); this.Filtros = new ObservableCollection <string>(list.fitros.valores); this.IsRefreshing = false; }
private async void SelectItemDetalhe(object sender, ItemTappedEventArgs e) { var item = e.Item as Dados; try { if (item == null) { return; } else { RootService rootService = new RootService(); var response = await rootService.GetAllUrl(item.urlFilhos); var list = (Root)response.Result; this.Title = list.titulo; List <Dados> listDados = new List <Dados>(); if (list != null) { string fornecedor = ""; string empresa = ""; string periodo = ""; string prefixo = ""; List <Dados> dadosFiltro = new List <Dados>(); foreach (Dados dado in list.dados) { decimal total = Convert.ToDecimal(dado.total); dado.total = total.ToString("N2"); fornecedor = dado.fornecedor; empresa = dado.natureza; periodo = dado.id; prefixo = dado.prefixo; dadosFiltro.Add(dado); } if (prefixo == null) { await Navigation.PushAsync(new Teste(dadosFiltro, empresa, periodo)); } else { await Navigation.PushAsync(new DetalhePage(dadosFiltro, fornecedor, periodo, this.Title)); } ((ListView)sender).SelectedItem = null; } } } catch (Exception) { throw; } }
public ActionResult Create(RootCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new RootService(); service.CreateRoot(model); return(RedirectToAction("Index")); }
public static SafeGetResponse Call(ImmuService.ImmuServiceClient immuS, RootService rs, SafeGetOptions request) { var root = rs.GetRoot(); var index = new Immudb.Schema.Index { Index_ = root.Index }; var protoReq = new SafeGetOptions(request) { RootIndex = index }; var msg = immuS.SafeGet(protoReq); var verified = Proofs.Verify(msg.Proof, ItemUtils.GetHash(msg.Item), root); if (verified) { var toCache = new Root { Index = msg.Proof.At, Root_ = msg.Proof.Root }; try { rs.SetRoot(toCache); } catch (Exception e) { throw e; } } var i = msg.Item; var timestampBytes = i.Value.Take(8).ToArray(); if (BitConverter.IsLittleEndian) { Array.Reverse(timestampBytes); } return(new SafeGetResponse { Index = i.Index, Key = i.Key, Value = ByteString.CopyFrom(i.Value.Skip(8).ToArray()), Timestamp = BitConverter.ToInt64(timestampBytes), Verified = verified }); }
public ActionResult Edit(int id) { var service = new RootService(); var detail = service.GetRootById(id); var model = new RootListItem { Id = detail.Id, RootName = detail.RootName, NotesOnRoot = detail.NotesOnRoot }; return(View(model)); }
public ActionResult DeletePost(int id) { if (!ModelState.IsValid) { return(View()); } var service = new RootService(); service.DeleteRoot(id); TempData["SaveResult"] = "Your note was deleted"; return(RedirectToAction("Index")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAdvertiseServicesWhenAsked() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAdvertiseServicesWhenAsked() { UriInfo uriInfo = mock(typeof(UriInfo)); URI uri = new URI("http://example.org:7474/"); when(uriInfo.BaseUri).thenReturn(uri); RootService svc = new RootService(new CommunityNeoServer(Config.defaults(stringMap((new HttpConnector("http", HttpConnector.Encryption.NONE)).type.name(), "HTTP", (new HttpConnector("http", HttpConnector.Encryption.NONE)).enabled.name(), "true")), GraphDatabaseDependencies.newDependencies().userLogProvider(NullLogProvider.Instance).monitors(new Monitors()))); EntityOutputFormat output = new EntityOutputFormat(new JsonFormat(), null, null); Response serviceDefinition = svc.GetServiceDefinition(uriInfo, output); assertEquals(200, serviceDefinition.Status); IDictionary <string, object> result = (IDictionary <string, object>)output.ResultAsMap["services"]; assertThat(result["console"].ToString(), containsString(string.Format("{0}server/console", uri.ToString()))); assertThat(result["jmx"].ToString(), containsString(string.Format("{0}server/jmx", uri.ToString()))); }
public void StopService(ServiceType serviceType) { lock (serverManagerLock) { if (serviceType == ServiceType.Manager && manager != null) { manager.Stop(); manager = null; } else if (serviceType == ServiceType.Root && root != null) { root.Stop(); root = null; } else if (serviceType == ServiceType.Block && block != null) { block.Stop(); block = null; } } }
public PeriodoPage(Funcionalidade _func) { InitializeComponent(); BindingContext = new RootViewModel(_func.Nome);; this.func = _func; try { FlowListView.Init(); ObterRootRaiz = new Command <string>( async(string urlFilhos) => { if (urlFilhos != null) { RootService rootService = new RootService(); var response = await rootService.GetAllUrl(urlFilhos); var list = (Root)response.Result; List <Dados> listDados = new List <Dados>(); if (list != null) { string natureza = ""; string periodo = ""; List <Dados> dadosFiltro = new List <Dados>(); foreach (Dados dado in list.dados) { decimal total = Convert.ToDecimal(dado.total); dado.total = total.ToString("N2"); periodo = dado.id; dadosFiltro.Add(dado); dadosFiltro.Add(dado); } await Navigation.PushAsync(new Teste(dadosFiltro, natureza, periodo)); } } }); } catch (Exception e) { throw; } }
protected override void Dispose(bool disposing) { if (disposing) { if (manager != null) { manager.Dispose(); manager = null; } if (root != null) { root.Dispose(); root = null; } if (block != null) { block.Dispose(); block = null; } } base.Dispose(disposing); }
protected override void OnStop() { if (configTimer != null) { configTimer.Dispose(); configTimer = null; } if (manager != null) { manager.Dispose(); manager = null; } if (root != null) { root.Dispose(); root = null; } if (block != null) { block.Dispose(); block = null; } }
public ActionResult Edit(int id, RootListItem model) { if (!ModelState.IsValid) { return(View(model)); } if (model.Id != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = new RootService(); if (service.UpdateRoot(model)) { TempData["SaveResult"] = "Your note was updated."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Your note could not be updated."); return(View(model)); }
public async Task Greeting(IDialogContext context, LuisResult result) { await context.PostAsync(RootService.GetReply(RootReply.Greeting)); context.Wait(this.MessageReceived); }
public MemoryPathAccess(RootService service, string pathName) : base(service, pathName) { }
// Use this for initialization void Awake() { service = new RootService(); // lifeInsurance = new RootService.LifeInsurance(1000000); }
public static SafeSetResponse Call(ImmuService.ImmuServiceClient immuS, RootService rs, SafeSetOptions request) { var root = rs.GetRoot(); var index = new Immudb.Schema.Index { Index_ = root.Index }; var valueB = new byte[8 + request.Kv.Value.Length]; var buffTimestamp = BitConverter.GetBytes(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()); if (BitConverter.IsLittleEndian) { Array.Reverse(buffTimestamp); } buffTimestamp.CopyTo(valueB, 0); request.Kv.Value.CopyTo(valueB, 8); var sso = new SafeSetOptions { Kv = new KeyValue { Key = request.Kv.Key, Value = ByteString.CopyFrom(valueB) }, RootIndex = index }; var msg = immuS.SafeSet(sso); var item = new Item { Key = sso.Kv.Key, Value = sso.Kv.Value, Index = msg.Index }; if (!ItemUtils.GetHash(item).SequenceEqual(msg.Leaf.ToByteArray())) { throw new Exception("Proof does not match the given item."); } bool verified = Proofs.Verify(msg, msg.Leaf.ToByteArray(), root); if (verified) { var toCache = new Root { Index = msg.Index, Root_ = msg.Root }; try { rs.SetRoot(toCache); } catch (Exception e) { throw e; } } return(new SafeSetResponse { Index = msg.Index, Leaf = msg.Leaf, Root = msg.Root, At = msg.At, InclusionPath = msg.InclusionPath, ConsistencyPath = msg.ConsistencyPath, Verified = verified }); }