/// <summary> /// Carrega listbox com os nomes dos arquivos. /// </summary> private void loadArquivos() { try { var nomes = new List <String>(); lstArquivo.Items.Clear(); int i; foreach (var item in Directory.GetFiles(PastaArqUpLoad, "*.*")) { i = item.LastIndexOf('\\'); nomes.Add(item.Substring(i + 1, (item.Length - i - 1))); } if (nomes != null && nomes.Count > 0) { this.lstArquivo.DataSource = nomes; this.lstArquivo.DataBind(); this.lstArquivo.SelectedIndex = 0; CarregaDadosArquivo(); } } catch (System.IO.FileNotFoundException ex) { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, ex.Message.ToString()); } catch (System.IO.IOException ex) { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, ex.Message.ToString()); } }
protected void lnkExcluir_Click(object sender, EventArgs e) { try { LinkButton lnkExcluir = sender as LinkButton; GridViewRow gvrow = (GridViewRow)lnkExcluir.NamingContainer; ViewState["cmpIdEquipamentoObra"] = lnkExcluir.CommandArgument.ToString(); tblEquipamentoObra table = new tblEquipamentoObra(); table.cmpIdEquipamentoObra = ViewState["cmpIdEquipamentoObra"].ToString(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario; if (table.Delete(Global.GetConnection())) { grdPesquisa.DataSource = pesquisa(); grdPesquisa.DataBind(); CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Equipamento excluído com sucesso!!!"); } } catch (Exception ex) { // CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Não é possível excluir o registro. Equipamento vinculado a uma obra!"); } }
protected void btnSaveRepro_Click(object sender, EventArgs e) { if (ValidarReprogramacao()) { try { tblPreventivaAgenda table = new tblPreventivaAgenda(); table.cmpIdPreventivaAgenda = ViewState["cmpIdPreventivaAgenda"].ToString(); table.cmpDtReprogramacaoPreventivaAgenda = this.TxtDtReprogramar.Text.ToString(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario; if ((table.Save(Global.GetConnection()))) { grdPreventivaPesq.DataSource = pesquisaPreventiva(); grdPreventivaPesq.DataBind(); this.ModalPopupExtender2.Hide(); CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Preventiva reprogramada com sucesso."); } this.TxtDtConfirmacao.Text = null; this.txtFuncionario.Text = null; this.TxtGestor.Text = null; this.txtObservacao.Text = null; this.rdbState.ClearSelection(); } catch (Exception ex) { Global.ShowError(Global.Title, ex); } } else { btnPesquisar_Click(sender, e); } }
/// <summary> /// Grava uma ordem de serviço. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { if (this.GravarOS()) { CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Dados cadastrados com sucesso."); } }
/// <summary> /// Validar confirmação da agenda preventiva. /// </summary> private bool ValidarConfirmacao() { bool ret = true; string msg = ""; if (TxtDtConfirmacao.Text == "") { msg += "Data de confirmação da preventiva em branco! <br />"; } else if (DateTime.Compare(DateTime.Parse(TxtDtConfirmacao.Text.ToString()), DateTime.Parse(txtDtAgenda.Text.ToString())) < 0) { msg += "Data confirmação menor que data agendada! <br />"; } else if (DateTime.Compare(DateTime.Parse(TxtDtConfirmacao.Text.ToString()), DateTime.Parse(txtLimiteConfirma.Text.ToString())) > 0) { msg += "Data confirmação maior que data limite para confirmação! <br />"; } if (TxtGestor.Text == "") { msg += "Nome do gestor em branco! <br />"; } if (txtFuncionario.Text == "") { msg += "Nome do funcionario em branco! <br />"; } if (msg != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, msg); ret = false; } return(ret); }
/// <summary> /// Grava envio da O.S para aprovação. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnviarAprovacao_Click(object sender, EventArgs e) { try { if (ViewState["cmpIdOS"].ToString() == "0") { this.GravarOS(); } tblOS table = null; table = new tblOS(); table.cmpIdOS = ViewState["cmpIdOS"].ToString(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario; if (table.GravarEnviarAprovacaoOS(Global.GetConnection())) { CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Ordem de serviço enviada para aprovação."); } controlaSituacaoOS("G"); } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }
protected void btnPesqMaterial_Click(object sender, EventArgs e) { try { if (txtItemMaterial.Text.Length >= 3) { ViewState["ItemMaterial"] = txtItemMaterial.Text; DataTable tbl = PesquisaMaterial(); if (tbl != null && tbl.Rows.Count > 0) { grdMaterialOrion.DataSource = tbl; grdMaterialOrion.DataBind(); ModalPopupExtender1.Show(); } else { CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Material não encontrado."); } } else { CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Informe no mínimo 3 digitos para pesquisa!"); txtItemMaterial.Focus(); } } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }
private void btnDestravar_Click(object sender, EventArgs e) { try { if (txtURL.Enabled) { txtURL.Enabled = false; txtFTP.Enabled = false; btnDestravar.Text = "Destravar"; Program.SenhaConfiguracao = RespostaCaixaMensagem.Nao; if (!string.IsNullOrEmpty(txtURL.Text)) { LerGravarXML.GravarValor("urlSincronizacao", txtURL.Text); } if (!string.IsNullOrEmpty(txtFTP.Text)) { LerGravarXML.GravarValor("FTPEnderecoServidor", txtFTP.Text); } } else { CaixaMensagem.ConfirmarSenha("Informe a senha de configuração para alterar os dados da rede!", true); } } catch (Exception) { } }
protected void btnGerar_Click(object sender, EventArgs e) { if (ViewState["tipoGrafico"].ToString() == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Selecione o tipo de gráfico."); } else if (ViewState["MesInicial"].ToString() == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Selecione o mês inicial."); } else if (ViewState["AnoInicial"].ToString() == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Informe o ano inicial."); } else if (ViewState["tipoGrafico"].ToString() != "CAD" && ViewState["tipoGrafico"].ToString() != "CDAQG" && ViewState["tipoGrafico"].ToString() != "CDRQG") { if (ViewState["MesFinal"].ToString() == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Informe o mês final."); } else if (ViewState["AnoFinal"].ToString() == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Informe o ano final."); } } }
private void lvMenu_SelectedIndexChanged(object sender, EventArgs e) { try { Util.MostraCursor.CursorAguarde(true); if (lvMenu.FocusedItem != null) { switch (lvMenu.FocusedItem.Index) { case 0: if (Program.CountFaixa > 0) { Program.IncluirRegistro = true; Program.CodigoEntrevista = 0; Program.AbreForm <frmEntrevista>(); } else { CaixaMensagem.ExibirOk("Não existe faixa disponível! Favor sincronizar o coletor."); return; } break; case 1: Program.IncluirRegistro = false; Program.FormularioSeleciona = "frmEntrevista"; Program.AbreForm <frmSelFormulario>(); break; case 2: Program.IDAgendamento = 0; Program.AbreForm <frmAgendamento>(); break; case 3: Program.FormularioSeleciona = "frmAgendamento"; Program.AbreForm <frmSelAgendamento>(); break; case 4: Program.AbreForm <frmTabela>(); break; } this.Close(); } } catch (Exception) { throw; } finally { Util.MostraCursor.CursorAguarde(false); } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (ValidarConfirmacao()) { tblPreventivaConfirmacao table = new tblPreventivaConfirmacao(); try { table.cmpIdPreventivaConfirmacao = ViewState["cmpIdPreventivaConfirmacao"].ToString(); table.cmpIdPreventivaAgenda = ViewState["cmpIdPreventivaAgenda"].ToString(); table.cmpDtConfirmacaoPreventiva = TxtDtConfirmacao.Text.ToString(); table.cmpNoGestorPreventivaConfirmacao = TxtGestor.Text.TrimEnd(); table.cmpNoFuncionarioPreventivaConfirmacao = txtFuncionario.Text.TrimEnd(); table.cmpInOcorrenciaPreventiva = rdbState.SelectedValue; table.cmpDcObservacaoPreventivaConfirmacao = txtObservacao.Text.TrimEnd(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario; using (DataTable tbl = table.GravarPreventivaConfirmacao(Global.GetConnection())) { if (tbl != null && tbl.Rows.Count > 0) { TxtDtConfirmacao.Text = ""; TxtGestor.Text = ""; txtFuncionario.Text = ""; txtObservacao.Text = ""; this.ModalPopupExtender1.Hide(); if (rdbState.SelectedValue == "0") { // Preventiva de Equipamento if (ViewState["cmpTpPreventiva"].ToString() == "EQUIPAMENTO") { Response.Redirect("~/Preventiva/webPRE_Equipamento.aspx?CoAtividade=" + ViewState["cmpCoTipoAtividade"] + "&NuPreventiva=" + tbl.Rows[0][0].ToString() + "&NoObra=" + cmbObra.SelectedItem + "&IdPreventivaConfirmacao=" + tbl.Rows[0][1].ToString(), false); } else { Response.Redirect("~/ATE/webATE_OS.aspx?IdPreventivaConfirmacao=" + tbl.Rows[0][1].ToString() + "&NuPreventiva=" + tbl.Rows[0][0].ToString(), false); } } grdPreventivaPesq.DataSource = pesquisaPreventiva(); grdPreventivaPesq.DataBind(); CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Preventiva confirmada com sucesso."); } } TxtDtReprogramar.Text = null; } catch (Exception ex) { Global.ShowError(Global.Title, ex); } } else { btnPesquisar_Click(sender, e); } }
protected void btnPesquisar_Click(object sender, EventArgs e) { DataTable tbl = pesquisaPreventiva(); if (tbl != null && tbl.Rows.Count > 0) { grdFormPreventiva.DataSource = tbl; grdFormPreventiva.DataBind(); } else { CaixaMensagem.Mostar(Mensagem.Tipo.Aviso, "Pesquisa não encontrada!"); } }
public IBuscarMensagens ObterBusca(CaixaMensagem caixa) { switch (caixa) { case CaixaMensagem.Entrada: return(new BuscarCaixaEntrada()); case CaixaMensagem.Saida: return(new BuscarCaixaSaida()); default: throw new NotSupportedException("Caixa de mensagem não encontrada"); } }
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 bool ValidaPeriodo() { bool Ret = true; if (txtDataInicial.Text == "") { Ret = false; txtDataInicial.Focus(); CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Informe a data inicial!"); } else if (txtDataFinal.Text == "") { Ret = false; txtDataFinal.Focus(); CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Informe a data final!"); } return(Ret); }
/// <summary> /// Grava dados da OS na tblOS. /// </summary> private bool GravarOS() { bool retval = true; try { string cmpCoObraGrupoLista = loadObra(txtCodUnidade.Text); if (cmpCoObraGrupoLista == "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Obra não cadastrada!"); retval = false; } else { DataTable tb = tblOS.VerificaNumeroDemanda(Global.GetConnection(), cmpCoObraGrupoLista, txtNuChamandoCEF.Text); if (tb.Rows[0]["Mensagem"].ToString() != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, tb.Rows[0]["Mensagem"].ToString()); retval = false; } } if (retval) { Session["cmpCoObraGrupoLista"] = cmpCoObraGrupoLista; Session["txtNuDemanda"] = txtNuChamandoCEF.Text; Session["txtLocal"] = txtEndereco.Text; Session["txtSolicitante"] = txtContato.Text; Session["txtTelefone"] = txtFone.Text; Session["txtObservacoes"] = txtDescricao.Text; Response.Redirect("~/ATE/webATE_OS.aspx?OSCef=1", false); } return(retval); } catch (Exception ex) { Global.ShowError(Global.Title, ex); return(false); } }
/// <summary> /// Evento ao desvincular material da Obra (tblObraGrupoMaterial). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDesvincular_Click(object sender, EventArgs e) { try { tblObraGrupoMaterial table = new tblObraGrupoMaterial(); string mensagem = ""; foreach (ListItem item in lstMaterial1.Items) { if (item.Selected) { table.cmpCoObraGrupoMaterial = item.Value.ToString(); table.cmpCoObraGrupo = ViewState["cmpCoObraGrupo"].ToString(); table.cmpNoUsuario = ((HzLogin)Session["login"]).cmpNoUsuario; table.ExcluirObraGrupoMaterial(Global.GetConnection(), ref mensagem); if (mensagem != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, mensagem); } else { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Material excluído da obra!"); LimparCampos(); CarregaMaterialNotObra(); if (lstMaterial1.Items.Count == 1) { lstMaterial1.Items.Clear(); break; } else { CarregaMaterialObra(); } } } } } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }
protected void btnExcluir_Click(object sender, EventArgs e) { try { tblManutencaoEquipamento table = new tblManutencaoEquipamento(); table.cmpIdManutencaoEquipamento = ViewState["cmpIdManutencaoEquipamento"].ToString(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario.TrimEnd(); if (table.ExcluirManutencaoEquipamento(Global.GetConnection())) { CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Registro excluido com sucesso!!!"); grdPesquisa.DataSource = pesquisa(); grdPesquisa.DataBind(); } } catch (Exception ex) { //CaixaMensagem.Mostar(Mensagem.Tipo.Erro, ex.Message.ToString()); } }
/// <summary> /// Validar alteração do material da O.S. /// </summary> private bool ValidarAlteracaoMaterial() { bool ret = true; string msg = ""; if (txtQuantiMaterial.Text == "") { msg += "Quantidade do material em branco! <br />"; } else if (txtVlMat.Text == "") { msg += "Valor do material em branco! <br />"; } if (msg != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, msg); ret = false; } return(ret); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { tblManutencaoEquipamento table = new tblManutencaoEquipamento(); table.cmpIdManutencaoEquipamento = ViewState["cmpIdManutencaoEquipamento"].ToString(); table.cmpIdEquipamentoObra = ViewState["cmpIdEquipamentoObra"].ToString(); table.cmpDtManutencaoEquipamento = txtDtManutencao.Text; table.cmpDcDetalhamentoManutencao = txtDetalhamento.Text; table.cmpIdPreventivaConfirmacao = ViewState["IdPreventivaConfirmacao"].ToString(); table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario.TrimEnd(); using (DataTable tblManut = table.Save(Global.GetConnection())) { if (tblManut != null && tblManut.Rows.Count > 0) { if (ViewState["cmpIdManutencaoEquipamento"].ToString() == "0") { tblPreventivaConfirmacaoOS tbl = new tblPreventivaConfirmacaoOS(); tbl.cmpIdManutencaoEquipamento = tblManut.Rows[0]["IdManutencaoEquipamento"].ToString(); tbl.cmpIdPreventivaConfirmacao = ViewState["IdPreventivaConfirmacao"].ToString(); if (tbl.Save(Global.GetConnection())) { CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Manutenção do equipamento incluido com sucesso!!!"); } } else { CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Manutenção do equipamento alterado com sucesso!!!"); } } } grdPesquisa.DataSource = pesquisa(); grdPesquisa.DataBind(); } catch (Exception ex) { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, ex.Message.ToString()); } }
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 MapearCamposAbaDados() { try { DadosTEntrevistado.CodigoEntrevista = Program.CodigoEntrevista; DadosTEntrevistado.CPF = txtAba3CPF.Text; if (string.IsNullOrEmpty(cmbAba3DataNascimentoAno.Text) || string.IsNullOrEmpty(cmbAba3DataNascimentoMes.Text) || string.IsNullOrEmpty(cmbAba3DataNascimentoDia.Text)) { DadosTEntrevistado.DataNascimento = DataCompleta; } else { string dataCompleta = cmbAba3DataNascimentoAno.Text + "-" + cmbAba3DataNascimentoMes.Text + "-" + cmbAba3DataNascimentoDia.Text; DadosTEntrevistado.DataNascimento = Convert.ToDateTime(dataCompleta); } DadosTEntrevistado.FaixaEtaria = ControllerEnum.FaixaEtariaDataNascimento(DadosTEntrevistado.DataNascimento.GetValueOrDefault()); DadosTEntrevistado.Sexo = cmbAba3Sexo.Text; if (txtAba3Telefone.Text.Length > 4) { DadosTEntrevistado.DDD = txtAba3Telefone.Text.Substring(1, 2); DadosTEntrevistado.Telefone = txtAba3Telefone.Text.Substring(4); } if (txtAba3Celular.Text.Length > 4) { DadosTEntrevistado.DDDCelular = txtAba3Celular.Text.Substring(1, 2); DadosTEntrevistado.Celular = txtAba3Celular.Text.Substring(4); } } catch (Exception ex) { LogErro.GravaLog("Erro ao mapear Aba Dados.", ex.Message); CaixaMensagem.ExibirOk("Erro ao mapear Aba Dados!"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { tblEquipamento table = new tblEquipamento(); table.cmpIdEquipamento = ViewState["cmpIdEquipamento"].ToString(); table.CmpDcEquipamento = TxtDescricao.Text.ToUpper().TrimEnd(); table.cmpCoGrupoAtividade = cmbTipoEquip.SelectedValue; table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario.TrimEnd(); if (table.Save(Global.GetConnection())) { btnCancel_Click(sender, e); txtDcEquipamentoPesq.Text = TxtDescricao.Text.TrimEnd(); grdPesquisa.DataSource = pesquisa(); grdPesquisa.DataBind(); CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Equipamento cadastrado com sucesso!"); } else { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, "Equipamento já cadastrado."); } }
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); } }
/// <summary> /// Evento ao carregar a página. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { prevPage = Request.UrlReferrer.ToString(); ViewState["cmpIdPreventivaAgenda"] = "0"; this.loadObraSolicitante(); loadObraPavimento(); NameValueCollection n = Request.QueryString; if (n.HasKeys()) { switch (n.GetKey(0)) { case "id": if (n.Count > 1) { if (n.GetKey(1) == "Concluido") { CaixaMensagem.Mostar(Mensagem.Tipo.Sucesso, "Ordem de serviço concluída com sucesso."); } } ViewState["cmpIdOS"] = Request.QueryString["id"]; this.load(); this.loadOS(); break; } } else { btnReset_Click(sender, e); } } }
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); }
/// <summary> /// Validar reprogramação da agenda preventiva. /// </summary> private bool ValidarReprogramacao() { bool ret = true; string msg = ""; if (TxtDtReprogramar.Text == "") { msg += "Data de reprogramação da preventiva em branco! <br />"; } else if (DateTime.Compare(DateTime.Parse(TxtDtReprogramar.Text.ToString()), DateTime.Parse(txtDtExecucao.Text.ToString())) < 0) { msg += "Data reprogramação menor que data início da execução! <br />"; } else if (DateTime.Compare(DateTime.Parse(TxtDtReprogramar.Text.ToString()), DateTime.Parse(txtLimiteRepro.Text.ToString())) > 0) { msg += "Data reprogramação maior que data limite para reprogramação! <br />"; } if (msg != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, msg); ret = false; } return(ret); }
/// <summary> /// Validar inclusão do material da O.S. /// </summary> private bool ValidarInclusaoMaterial() { bool ret = true; string msg = ""; if (txtQtMaterial.Text == "") { msg += "Quantidade do material em branco! <br />"; } else if (txtValorMaterial.Text == "") { msg += "Valor do material em branco! <br />"; } else if (txtMaterialSelecionado.Text == "") { msg += "Falta pesquisar material! <br />"; } if (msg != "") { CaixaMensagem.Mostar(Mensagem.Tipo.Erro, msg); ret = false; } return(ret); }
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 void MapearCamposAbaPessoal() { try { DadosTEntrevistado.CodigoEntrevista = DadosTEntrevista.CodigoEntrevista; DadosTEntrevistado.Nome = txtAba1Nome.Text; DadosTEntrevistado.EstadoCivil = Convert.ToInt32(cmbAba1EstadoCivil.SelectedValue); DadosTEntrevistado.IDProfissao = Convert.ToInt32(cmbAba1Profissao.SelectedValue); //TODO JOAO Verificar o capital de acordo com a profissão //DadosTEntrevistado.CapitalLimitado = cmbAba1Capital.SelectedValue.ToString(); if ((pAba1ConjugePanel.Visible) && !string.IsNullOrEmpty(cmbAba1DataNascimentoAno.Text) && !string.IsNullOrEmpty(cmbAba1DataNascimentoMes.Text) && !string.IsNullOrEmpty(cmbAba1DataNascimentoDia.Text)) { string dataCompleta = cmbAba1DataNascimentoAno.Text + "-" + cmbAba1DataNascimentoMes.Text + "-" + cmbAba1DataNascimentoDia.Text; DadosTEntrevistado.IDProfissaoConjuge = Convert.ToInt32(cmbAba1ConjugeProfissao.SelectedValue); DadosTEntrevistado.FaixaEtariaConjuge = ControllerEnum.FaixaEtariaDataNascimento(Convert.ToDateTime(dataCompleta)); DadosTEntrevistado.DataNascimentoConjuge = Convert.ToDateTime(dataCompleta); } else { DadosTEntrevistado.IDProfissaoConjuge = 0; DadosTEntrevistado.FaixaEtariaConjuge = 0; DadosTEntrevistado.DataNascimentoConjuge = null; } //DadosTEntrevistado.CapitalLimitadoConjuge = cmbAba2Capital.SelectedValue.ToString(); } catch (Exception ex) { LogErro.GravaLog("Erro ao mapear Aba Pessoal.", ex.Message); CaixaMensagem.ExibirOk("Erro ao mapear Aba Pessoal!"); } }