private void CarregarListTabelas(string filtro) { string firstChar = filtro[0].ToString(); string lastChar = filtro[filtro.Length - 1].ToString(); string filtro_puro = filtro.Replace("*", ""); if (firstChar == "*" && lastChar == "*") { listTabelas.DataSource = Geral.ToListof <AgileE.Tabela>(agilee.getTabelas()).Where(x => x.TABLE_NAME.Contains(filtro_puro)).ToList(); } else if (firstChar == "*" && lastChar != "*") { listTabelas.DataSource = Geral.ToListof <AgileE.Tabela>(agilee.getTabelas()).Where(x => x.TABLE_NAME.EndsWith(filtro_puro)).ToList(); } else if (firstChar != "*" && lastChar == "*") { listTabelas.DataSource = Geral.ToListof <AgileE.Tabela>(agilee.getTabelas()).Where(x => x.TABLE_NAME.StartsWith(filtro_puro)).ToList(); } else { listTabelas.DataSource = Geral.ToListof <AgileE.Tabela>(agilee.getTabelas()).Where(x => x.TABLE_NAME == filtro_puro).ToList(); } listTabelas.ValueMember = "TABLE_NAME"; listTabelas.DisplayMember = "TABLE_NAME"; }
public static string GetConfigFromDataBase(string chave) { db banco = new db(Geral.BancoDadosPath()); var configuracao = banco.LerNoBanco <Configuracao>("Select * from Configuracao"); return(configuracao.Where(x => x.Chave == chave).FirstOrDefault().Valor); }
private void bgwAtualizaBancoDados_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { Geral.banco = new db(Geral.BancoDadosPath()); Geral.dicionario = new Dicionario(); Geral.dicionario.VerificaTabelas(); Geral.frmSplash.Close(); }
private void CarregarCamposTabelaERP() { listCampos.DataSource = Geral.ToListof <AgileE.Campo>(agilee.getCampos(listTabelas.SelectedValue.ToString())).OrderBy(x => x.ID).ToList(); listCampos.ValueMember = "COLUNA"; listCampos.DisplayMember = "COLUNA"; listCamposChave.DataSource = Geral.ToListof <AgileE.Campo>(agilee.getCampos(listTabelas.SelectedValue.ToString())).OrderBy(x => x.ID).ToList(); listCamposChave.ValueMember = "COLUNA"; listCamposChave.DisplayMember = "COLUNA"; }
public static void InstanciaApis() { Geral.harpiaapi = new AgileESync.HarpiaApi(Geral.HarpiaWMSConStr(Geral.frmconfiguracao.txtIP.Text, Geral.frmconfiguracao.txtPorta.Text, Geral.frmconfiguracao.txtInstancia.Text, Geral.frmconfiguracao.txtUsuario.Text, Geral.frmconfiguracao.txtSenha.Text)); Geral.agileapi = new AgileECommerceApi(Geral.frmconfiguracao.txtApiUrl.Text, Geral.frmconfiguracao.txtToken.Text, Geral.frmconfiguracao.txtAccessKeyId.Text, Geral.frmconfiguracao.txtSecretAccessKey.Text, Geral.frmconfiguracao.cmbRegionEndpoint.Text, Geral.frmconfiguracao.txtBucketName.Text); Geral.agilee = new AgileE(); //Testando conexao das Apis if (!Geral.harpiaapi.TestaConexao()) { MessageBox.Show("Não foi possivel conectar ao Harpia!"); } }
public static string getAppConStrEDI() { string constr = ""; //Verificando Arquivo de Configuração switch (Geral.frmconfiguracao.cmbERP.Text) { case "Harpia": constr = Geral.HarpiaWMSConStr(Geral.frmconfiguracao.txtIP.Text, Geral.frmconfiguracao.txtPorta.Text, Geral.frmconfiguracao.txtInstancia.Text, "ESTALO_EDI", "ESTALO_EDI"); break; } return(constr); }
public static void SetConfigToDataBase(string chave, String valor) { db banco = new db(Geral.BancoDadosPath()); var configuracao = banco.LerNoBanco <Configuracao>("Select * from Configuracao"); if (configuracao.Where(x => x.Chave == chave).Count() > 0) { banco.ExecutarComando("UPDATE Configuracao SET VALOR = '" + valor + "' WHERE Chave = '" + chave + "'"); } else { banco.ExecutarComando("INSERT INTO Configuracao (Chave, Valor) Values ('" + chave + "', '" + valor + "')"); } }
private void bgwSyncJob_DoWork(object sender, DoWorkEventArgs e) { AgileE agilee = new AgileE(); long count = 0; DataTable dtSyncJob = new DataTable(); List <AgileECommerceApi.AgileESyncJob> listSyncJob = new List <AgileECommerceApi.AgileESyncJob>(); while (!bgwSyncJob.CancellationPending) { dtSyncJob = agilee.getSyncJob(); listSyncJob = Geral.DataTableToSyncJob(dtSyncJob); bgwSyncJob.ReportProgress(1, "0 / " + listSyncJob.Count().ToString()); qtd_fail_loop_atual = 0; count = 0; foreach (var job in listSyncJob) { var job_done = agilee.doJob(job, ref bgwSyncJob); count++; bgwSyncJob.ReportProgress(1, count.ToString() + " / " + listSyncJob.Count().ToString()); if (job_done.Status == "E") { qtd_fail_loop_atual++; bgwSyncJob.ReportProgress(2, qtd_fail_loop_atual.ToString()); } if (bgwSyncJob.CancellationPending) { break; } } System.Threading.Thread.Sleep(10000); } if (bgwSyncJob.CancellationPending) { return; } }
private void frmPrincipal_Load(object sender, EventArgs e) { bgwTempoAtividade.RunWorkerAsync(); Geral.frmSplash.progressSplash.Minimum = 0; Geral.frmSplash.progressSplash.Maximum = 100; bgwAtualizaBancoDados.RunWorkerAsync(Geral.BancoDadosPath()); Geral.frmSplash.ShowDialog(); Geral.frmconfiguracao.CarregarConfiguracao(); if (Geral.frmconfiguracao.cmbERP.Text == "") { MessageBox.Show("Configuração não encontrada!"); Geral.frmconfiguracao.ShowDialog(); } else { //Verificando Arquivo de Configuração switch (Geral.frmconfiguracao.cmbERP.Text) { case "Harpia": Geral.erp = ERP.Harpia; Geral.InstanciaApis(); break; } } this.Text = "ApiSync - " + Geral.erp.ToString() + "ERP " + Application.ProductVersion.ToString(); //Start SyncJob //bgwSyncJob.RunWorkerAsync(); //Start getPedidosJob //bgwInternalizaPedidos.RunWorkerAsync(); }
private void CarregarListaTabelasERP() { listTabelas.ValueMember = "TABLE_NAME"; listTabelas.DisplayMember = "TABLE_NAME"; listTabelas.DataSource = Geral.ToListof <AgileE.Tabela>(agilee.getTabelas()).ToList(); }
public Dicionario() { banco = new db(Geral.BancoDadosPath()); }