private void WIFI(bool ligar) { try { MostraCursor.CursorAguarde(true); ControleHardware wifi = new ControleHardware(); wifi.ControlarRadioWiFi(true); bool ligado = false; ligado = wifi.VerificarRadioWiFi(); if (ligado) { picWIFI.Image = ProjetoMobile.Properties.Resources.accept32; } else { picWIFI.Image = ProjetoMobile.Properties.Resources.remove32; } wifi = null; } catch (Exception) { } finally { MostraCursor.CursorAguarde(false); } }
private void frmFeedBackAlterado_Load(object sender, EventArgs e) { try { MostraCursor.CursorAguarde(true); chkAba1MR.Focus(); PopularCombos(); MostraCursor.CursorAguarde(false); if (Program.CodigoEntrevista > 0 && !Program.IncluirRegistro) { PreencheFeedBack(); } } catch (Exception ex) { LogErro.GravaLog("Erro no Load do feedback.", ex.Message); } finally { MostraCursor.CursorAguarde(false); } }
public frmSelFormulario() { InitializeComponent(); MostraCursor.CursorAguarde(true); FocusOn(); FocusOff(); KeyDownTecla(); KeyUpTecla(); ModeloGrid(); MostraCursor.CursorAguarde(false); }
private void btnExecutar_Click(object sender, EventArgs e) { try { MostraCursor.CursorAguarde(true); TestarConectividade(); ExecutarAtualizacao(); } catch (Exception) { } finally { MostraCursor.CursorAguarde(false); } }
private void ExecutarAtualizacao() { try { if (!string.IsNullOrEmpty(txtURL.Text)) { LerGravarXML.GravarValor("urlSincronizacao", txtURL.Text); if (!string.IsNullOrEmpty(txtFTP.Text)) { LerGravarXML.GravarValor("FTPEnderecoServidor", txtFTP.Text); } //Upload do Bando de Entrevista UploadBanco(); //Download do Banco de Entrevista DownloadBanco(); //Verificar e Atualizar Banco Correios CorreioBanco(); //Upload do Arquivo GPS UploadGPS(); //Verificar e Atualizar Versão Sistema VersaoSistema(false); //Resumo das Ações do Sincronismo ResumoSincronismo(); } else { CaixaMensagem.ExibirOk("URL do servidor não foi informado!"); } } catch (Exception ex) { //Verificar e Atualizar Versão Sistema VersaoSistema(true); MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirErro("Erro ao sincronizar com o servidor. Realize a sincronização novamente.", ex.Message); } }
private void TestarConectividade() { try { if (!string.IsNullOrEmpty(txtURL.Text)) { LerGravarXML.GravarValor("urlSincronizacao", txtURL.Text); Notificar("----------------------------"); Notificar("TESTE SERVIDOR"); Notificar("----------------------------"); Notificar("Verifica a conectividade."); DataHora.AcertaDataHora(new wsColetor.SyncColetor() { Url = txtURL.Text }.SetDateTime()); Notificar("Servidor conectado com sucesso."); Notificar("----------------------------"); Notificar("FIM TESTE SERVIDOR"); Notificar("----------------------------"); } else { CaixaMensagem.ExibirOk("URL do servidor não foi informado!"); } } catch (Exception ex) { MostraCursor.CursorAguarde(false); Notificar("Servidor não conectado."); Notificar("----------------------------"); Notificar("FIM TESTE SERVIDOR"); Notificar("----------------------------"); throw ex; } }
private void frmAtualizacao_Load(object sender, EventArgs e) { try { MostraCursor.CursorAguarde(true); this.Controle.NotificarInicioDownload += new Action <Int32>(Controle_NotificarInicioDownload); this.Controle.NotificarProgresso += new Action <Int32>(Controle_NotificarProgresso); this.Controle.NotificarTermino += new Action(Controle_NotificarTermino); this.Controle.NotificarFalha += new Action <String>(Controle_NotificarFalha); lblVersao.Text = "Versão Sistema:" + versao; lblCorreio.Text = "Versão Correio:" + LerGravarXML.ObterValor("VersaoCorreio", "0"); if (Program.SenhaConfiguracao == RespostaCaixaMensagem.Sim) { txtURL.Enabled = true; txtFTP.Enabled = true; txtURL.Focus(); btnDestravar.Text = "Travar"; } else { txtURL.Enabled = false; txtFTP.Enabled = false; btnExecutar.Focus(); btnDestravar.Text = "Destravar"; } WIFI(true); } catch (Exception ex) { LogErro.GravaLog("Erro Tela Atualização", ex.Message); } finally { MostraCursor.CursorAguarde(false); } }
private void tabFeedBack_SelectedIndexChanged(object sender, EventArgs e) { MostraCursor.CursorAguarde(true); if (AbaAnterior != tabFeedBack.SelectedIndex) { switch (AbaAnterior) { case 0: //espaço reservado para salvar por aba AcertarFocuCampos(); break; case 1: AcertarFocuCampos(); break; default: break; } } MostraCursor.CursorAguarde(false); }
private void btnSalvar_Click(object sender, EventArgs e) { try { if (Program.CodigoEntrevista > 0) { MostraCursor.CursorAguarde(true); ValidarCampos(); MapearCamposTResposta(); if (ControllerResposta.SalvarFeedBack(DadosTResposta)) { MapearCamposTEntrevista(); DadosTEntrevista.Completa = true; ControllerEntrevista.AtualizarEntrevista(dadosTEntrevista); MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Formulário concluído com sucesso!"); Program.CodigoEntrevista = 0; this.Close(); } else { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Erro ao salvar o FeedBack!"); } } } catch (Exception ex) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk(ex.Message); LogErro.GravaLog("Erro ao Salvar.", ex.Message); } }
private bool ValidarCelular() { if (!(txtAba3Celular.Text.Replace("_", "").Length == 13) && !(txtAba3Celular.Text.Replace("_", "").Length == 14)) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Celular não é válido!"); txtAba3Celular.Focus(); return(false); } try { int ddd = Convert.ToInt32(txtAba3Celular.Text.Substring(1, 2)); } catch (Exception) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Celular não é válido!"); txtAba3Celular.Focus(); return(false); } try { int telefone = Convert.ToInt32(txtAba3Celular.Text.Substring(4).Replace("-", "")); } catch (Exception) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Celular não é válido!"); txtAba3Celular.Focus(); return(false); } return(true); }
private bool ValidarTelefone() { if (txtAba3Telefone.Text.Replace("_", "").Length != 13) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Residencial não é válido!"); txtAba3Telefone.Focus(); return(false); } try { int ddd = Convert.ToInt32(txtAba3Telefone.Text.Substring(1, 2)); } catch (Exception) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Residencial não é válido!"); txtAba3Telefone.Focus(); return(false); } try { int telefone = Convert.ToInt32(txtAba3Telefone.Text.Substring(4).Replace("-", "")); } catch (Exception) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Residencial não é válido!"); txtAba3Telefone.Focus(); return(false); } return(true); }
private bool ValidarCamposAbaPessoal() { try { TextoNome = txtAba1Nome.Text; TextoEstadoCivil = cmbAba1EstadoCivil.SelectedValue.ToString(); TextoProfissao = cmbAba1Profissao.SelectedValue.ToString(); if (pAba1ConjugePanel.Visible) { TextoDataDiaConjuge = cmbAba1DataNascimentoDia.SelectedValue.ToString(); TextoDataMesConjuge = cmbAba1DataNascimentoMes.SelectedValue.ToString(); TextoDataAnoConjuge = cmbAba1DataNascimentoAno.SelectedValue.ToString(); TextoProfissaoConjuge = cmbAba1ConjugeProfissao.SelectedValue.ToString(); if (Convert.ToInt32(cmbAba1DataNascimentoDia.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Cônjuge Data de Nascimento (DIA) é obrigatório!"); cmbAba1DataNascimentoDia.Focus(); return(false); } if (Convert.ToInt32(cmbAba1DataNascimentoMes.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Cônjuge Data de Nascimento (MÊS) é obrigatório!"); cmbAba1DataNascimentoMes.Focus(); return(false); } if (Convert.ToInt32(cmbAba1DataNascimentoAno.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Cônjuge Data de Nascimento (ANO) é obrigatório!"); cmbAba1DataNascimentoAno.Focus(); return(false); } if (Convert.ToInt32(cmbAba1ConjugeProfissao.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Cônjuge Profissão é obrigatório!"); cmbAba1ConjugeProfissao.Focus(); return(false); } } if (string.IsNullOrEmpty(txtAba1Nome.Text)) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Nome é obrigatório!"); txtAba1Nome.Focus(); return(false); } if (Convert.ToInt32(cmbAba1EstadoCivil.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Estado Civil é obrigatório!"); cmbAba1EstadoCivil.Focus(); return(false); } if (Convert.ToInt32(cmbAba1Profissao.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Profissão é obrigatório!"); cmbAba1Profissao.Focus(); return(false); } return(true); } catch (Exception ex) { MostraCursor.CursorAguarde(false); LogErro.GravaLog("Erro ao validar Aba Pessoal.", ex.Message); CaixaMensagem.ExibirOk("Erro ao validar Aba Pessoal!"); return(false); } }
private void btnOk_Click(object sender, EventArgs e) { try { MostraCursor.CursorAguarde(true); if (txtUsuario.Text.Trim() == String.Empty) { throw new Exception("Os campos usuário é de preenchimento obrigatório!"); } if (txtSenha.Text.Trim() == String.Empty) { throw new Exception("Os campos senha é de preenchimento obrigatório!"); } if (!Convert.ToBoolean(LerGravarXML.ObterValor("ColetorAtivo", "false"))) { throw new Exception("O coletor está bloqueado. Favor Procurar uma filial."); } if (!ControllerUsuario.LoginVerificar(txtUsuario.Text.Trim())) { throw new Exception("O usuário não está associado ao coletor."); } if (!ControllerUsuario.LoginSistema(txtUsuario.Text.Trim(), txtSenha.Text.Trim())) { throw new Exception("Senha inválida."); } DataTable tableParametro = ControllerParametro.SelecioneParametros(); DateTime dataUltima = DateTime.ParseExact(LerGravarXML.ObterValor("UltimaAtualizacao", "01/01/01"), "dd/MM/yy", null); if (tableParametro.Rows.Count > 0) { int prazoSincronismo = Convert.ToInt32(tableParametro.Rows[0]["PrazoSincronismoDia"]); if (dataUltima.AddDays(prazoSincronismo) < DateTime.Now) { throw new Exception("O coletor está com prazo de dias sem sincronismo expirado. Favor Procurar uma filial."); } } if (DateTime.Now.Year > 2007) { DataHora.AcertaDataHora(DateTime.Now); } else { DataHora.AcertaDataHora(dataUltima); } MostraCursor.CursorAguarde(false); FileInfo bancoCorreio = new FileInfo(Program.ARQUIVO_CORREIO); if (!bancoCorreio.Exists) { if (CaixaMensagem.ExibirSimNao("Não foi identificado nenhum banco de correio, deseja continuar?") == RespostaCaixaMensagem.Nao) { return; } } Program.AbreForm <frmMenuAcesso>(); } catch (Exception ex) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirErro(ex.Message, "Erro Login"); } }
private bool ValidarCamposAbaDados(bool mudancaAba) { try { TextoCPF = txtAba3CPF.Text; TextoSexo = cmbAba3Sexo.SelectedValue.ToString(); TextoDataDia = cmbAba3DataNascimentoDia.SelectedValue.ToString(); TextoDataMes = cmbAba3DataNascimentoMes.SelectedValue.ToString(); TextoDataAno = cmbAba3DataNascimentoAno.SelectedValue.ToString(); TextoTelefone = txtAba3Telefone.Text; TextoCelular = txtAba3Celular.Text; TextoEmail = txtAba3Email.Text; if (!string.IsNullOrEmpty(txtAba3CPF.Text)) { string cpfsonumero = txtAba3CPF.Text.Replace(".", "").Replace("-", "").Trim(); if (!UtilValidacoes.isCPF(cpfsonumero)) { CaixaMensagem.ExibirOk("Campo CPF inválido!"); txtAba3CPF.Focus(); return(false); } if (ControllerEntrevistado.VerificarEntrevistadoCPF(Program.CodigoEntrevista, txtAba3CPF.Text)) { CaixaMensagem.ExibirOk("CPF já cadastrado na base de dados!"); txtAba3CPF.Focus(); return(false); } } //else //{ // CaixaMensagem.ExibirOk("Campo CPF obrigatório!"); // txtAba3CPF.Focus(); // return false; //} if (Convert.ToInt32(cmbAba3Sexo.SelectedIndex) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Sexo é obrigatório!"); cmbAba3Sexo.Focus(); return(false); } if (Convert.ToInt32(cmbAba3DataNascimentoDia.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Data de Nascimento (DIA) é obrigatório!"); cmbAba3DataNascimentoDia.Focus(); return(false); } if (Convert.ToInt32(cmbAba3DataNascimentoMes.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Data de Nascimento (MÊS) é obrigatório!"); cmbAba3DataNascimentoMes.Focus(); return(false); } if (Convert.ToInt32(cmbAba3DataNascimentoAno.SelectedValue) == 0) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Data de Nascimento (ANO) é obrigatório!"); cmbAba3DataNascimentoAno.Focus(); return(false); } string dataCompleta = cmbAba3DataNascimentoAno.Text + "-" + cmbAba3DataNascimentoMes.Text + "-" + cmbAba3DataNascimentoDia.Text; if ((int)Math.Floor((DateTime.Now - Convert.ToDateTime(dataCompleta)).TotalDays / 365.25) < 18) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Data de Nascimento deve ser maior que 18 anos!"); cmbAba3DataNascimentoDia.Focus(); return(false); } bool informouTelefoneFixo = txtAba3Telefone.Text.Replace("_", "").Length != 4; bool informouCelular = txtAba3Celular.Text.Replace("_", "").Length != 4; if (!informouTelefoneFixo && !informouCelular) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo Telefone Residencial ou Telefone Celular é obrigatório!"); txtAba3Telefone.Focus(); return(false); } if (informouTelefoneFixo && !informouCelular) { if (!ValidarTelefone()) { return(false); } } if (!informouTelefoneFixo && informouCelular) { if (!ValidarCelular()) { return(false); } } if (informouTelefoneFixo && informouCelular) { if (!ValidarTelefone() || !ValidarCelular()) { return(false); } } if (string.IsNullOrEmpty(txtAba3Email.Text) && mudancaAba) { MostraCursor.CursorAguarde(false); CaixaMensagem.ExibirOk("Campo E-Mail não foi preenchido!"); } else { if (!UtilValidacoes.ValidaEmail(txtAba3Email.Text) && mudancaAba) { CaixaMensagem.ExibirOk("Campo E-Mail inválido!"); txtAba3Email.Focus(); return(false); } } return(true); } catch (Exception ex) { MostraCursor.CursorAguarde(false); LogErro.GravaLog("Erro ao validar Aba Dados.", ex.Message); CaixaMensagem.ExibirOk("Erro ao validar Aba Dados!"); return(false); } }