public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40, false); ctrl_TxtEndereco.AcquireTextBox(i_Form.TxtEndereco, this, event_val_TxtEndereco, 40, ""); ctrl_TxtNumero.AcquireTextBox(i_Form.TxtNumero, this, event_val_TxtNumero, 6); ctrl_TxtComplemento.AcquireTextBox(i_Form.TxtComplemento, this, event_val_TxtComplemento, 40, alphaTextController.ENABLE_NUMBERS); ctrl_TxtBairro.AcquireTextBox(i_Form.TxtBairro, this, event_val_txtBairro, 40, false); ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false); ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 2, false); ctrl_TxtCEP.AcquireTextBox(i_Form.TxtCEP, this, event_val_TxtCEP, 6); ctrl_TxtDDD.AcquireTextBox(i_Form.TxtDDD, this, event_val_TxtDDD, 2); ctrl_TxtTelefone.AcquireTextBox(i_Form.TxtTelefone, this, event_val_TxtTelefone, 8); ctrl_TxtDtNasc.AcquireTextBox(i_Form.TxtDtNasc, this, event_val_TxtDtNasc, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtEmail.AcquireTextBox(i_Form.TxtEmail, this, event_val_TxtEmail, 40); ctrl_TxtRenda.AcquireTextBox(i_Form.TxtRenda, this, event_val_TxtRenda, "R$", 8); ctrl_TxtCpf.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtNome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEndereco.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtNumero.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtComplemento.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtBairro.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCidade.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEstado.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCEP.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDDD.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtTelefone.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDtNasc.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmail.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtRenda.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCpf.SetTextBoxText(cpf_cnpj); ctrl_TxtCpf.forceValidation(); if (cpf_cnpj != "") { ctrl_TxtEndereco.SetTextBoxText(dp.get_st_endereco()); ctrl_TxtNumero.SetTextBoxText(dp.get_st_numero()); ctrl_TxtComplemento.SetTextBoxText(dp.get_st_complemento()); ctrl_TxtBairro.SetTextBoxText(dp.get_st_bairro()); ctrl_TxtCidade.SetTextBoxText(dp.get_st_cidade()); ctrl_TxtEstado.SetTextBoxText(dp.get_st_UF()); ctrl_TxtCEP.SetTextBoxText(dp.get_st_CEP()); ctrl_TxtDDD.SetTextBoxText(dp.get_st_ddd()); ctrl_TxtTelefone.SetTextBoxText(dp.get_st_telefone()); ctrl_TxtDtNasc.SetTextBoxText(dp.get_dt_nasc()); ctrl_TxtEmail.SetTextBoxText(dp.get_st_email()); ctrl_TxtRenda.SetTextBoxString(dp.get_vr_renda()); ctrl_TxtNome.SetTextBoxText(dp.get_st_nome()); } else { i_Form.TxtCpf.ReadOnly = false; } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Alterar - case event_Alterar: { //InitEventCode event_Alterar bool IsDone = true; if (!ctrl_TxtNome.IsUserValidated) { ctrl_TxtNome.SetErrorMessage("O nome deve ser informado"); IsDone = false; } if (!ctrl_TxtEndereco.IsUserValidated) { ctrl_TxtEndereco.SetErrorMessage("O endereço deve ser informado"); IsDone = false; } if (!ctrl_TxtNumero.IsUserValidated) { ctrl_TxtNumero.SetErrorMessage("O número deve ser informado"); IsDone = false; } if (!ctrl_TxtComplemento.IsUserValidated) { ctrl_TxtComplemento.SetErrorMessage("O complemento deve ser informado"); IsDone = false; } if (!ctrl_TxtBairro.IsUserValidated) { ctrl_TxtBairro.SetErrorMessage("O bairro deve ser informado"); IsDone = false; } if (!ctrl_TxtCidade.IsUserValidated) { ctrl_TxtCidade.SetErrorMessage("A cidade deve ser informada"); IsDone = false; } if (!ctrl_TxtEstado.IsUserValidated) { ctrl_TxtEstado.SetErrorMessage("O estado deve ser informado"); IsDone = false; } if (!ctrl_TxtCEP.IsUserValidated) { ctrl_TxtCEP.SetErrorMessage("O CEP deve ser informado"); IsDone = false; } if (!ctrl_TxtDDD.IsUserValidated) { ctrl_TxtDDD.SetErrorMessage("O DDD deve ser informado"); IsDone = false; } if (!ctrl_TxtTelefone.IsUserValidated) { ctrl_TxtTelefone.SetErrorMessage("O telefone deve ser informado"); IsDone = false; } if (!ctrl_TxtDtNasc.IsUserValidated) { ctrl_TxtDtNasc.SetErrorMessage("A data de nascimento deve ser informada"); IsDone = false; } if (!IsDone) { MessageBox.Show("Existem pendências de cadastro", "Aviso"); return(false); } DadosProprietario dp = new DadosProprietario(); dp.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dp.set_st_endereco(ctrl_TxtEndereco.getTextBoxValue()); dp.set_st_numero(ctrl_TxtNumero.getTextBoxValue()); dp.set_st_complemento(ctrl_TxtComplemento.getTextBoxValue()); dp.set_st_bairro(ctrl_TxtBairro.getTextBoxValue()); dp.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dp.set_st_UF(ctrl_TxtEstado.getTextBoxValue()); dp.set_st_CEP(ctrl_TxtCEP.getTextBoxValue()); dp.set_st_ddd(ctrl_TxtDDD.getTextBoxValue()); dp.set_st_telefone(ctrl_TxtTelefone.getTextBoxValue()); dp.set_vr_renda(ctrl_TxtRenda.getTextBoxValue_NumberStr()); dp.set_st_email(ctrl_TxtEmail.getTextBoxValue()); dp.set_dt_nasc(var_util.GetDataBaseTimeFormat(ctrl_TxtDtNasc.getTextBoxValue_Date())); var_exchange.exec_alteraProprietario(ctrl_TxtCpf.getTextBoxValue(), ref dp, ref header); //EndEventCode return(true); } #endregion #region - event_val_TxtCpf - case event_val_TxtCpf: { //InitEventCode event_val_TxtCpf if (ctrl_TxtCpf.getTextBoxValue().Length == 11 || // cpf ctrl_TxtCpf.getTextBoxValue().Length == 14) // cnpj { DadosProprietario dp = new DadosProprietario(); if (var_exchange.fetch_proprietario(ctrl_TxtCpf.getTextBoxValue(), ref header, ref dp)) { if (dp.get_tg_found() == Context.TRUE) { ctrl_TxtEndereco.SetTextBoxText(dp.get_st_endereco()); ctrl_TxtNumero.SetTextBoxText(dp.get_st_numero()); ctrl_TxtComplemento.SetTextBoxText(dp.get_st_complemento()); ctrl_TxtBairro.SetTextBoxText(dp.get_st_bairro()); ctrl_TxtCidade.SetTextBoxText(dp.get_st_cidade()); ctrl_TxtEstado.SetTextBoxText(dp.get_st_UF()); ctrl_TxtCEP.SetTextBoxText(dp.get_st_CEP()); ctrl_TxtDDD.SetTextBoxText(dp.get_st_ddd()); ctrl_TxtTelefone.SetTextBoxText(dp.get_st_telefone()); ctrl_TxtDtNasc.SetTextBoxText(dp.get_dt_nasc()); ctrl_TxtEmail.SetTextBoxText(dp.get_st_email()); ctrl_TxtRenda.SetTextBoxString(dp.get_vr_renda()); ctrl_TxtNome.SetTextBoxText(dp.get_st_nome()); } } } //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 3) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; ctrl_TxtNome.CleanError(); } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEndereco - case event_val_TxtEndereco: { //InitEventCode event_val_TxtEndereco switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEndereco.getTextBoxValue().Length > 8) { i_Form.TxtEndereco.BackColor = Color.White; ctrl_TxtEndereco.IsUserValidated = true; ctrl_TxtEndereco.CleanError(); } else { i_Form.TxtEndereco.BackColor = colorInvalid; ctrl_TxtEndereco.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtNumero - case event_val_TxtNumero: { //InitEventCode event_val_TxtNumero switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtNumero.Text.Length > 0) { i_Form.TxtNumero.BackColor = Color.White; ctrl_TxtNumero.IsUserValidated = true; ctrl_TxtNumero.CleanError(); } else { i_Form.TxtNumero.BackColor = colorInvalid; ctrl_TxtNumero.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtComplemento - case event_val_TxtComplemento: { //InitEventCode event_val_TxtComplemento switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtComplemento.getTextBoxValue().Length > 0) { i_Form.TxtComplemento.BackColor = Color.White; ctrl_TxtComplemento.IsUserValidated = true; ctrl_TxtComplemento.CleanError(); } else { i_Form.TxtComplemento.BackColor = colorInvalid; ctrl_TxtComplemento.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_txtBairro - case event_val_txtBairro: { //InitEventCode event_val_txtBairro switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtBairro.getTextBoxValue().Length > 3) { i_Form.TxtBairro.BackColor = Color.White; ctrl_TxtBairro.IsUserValidated = true; ctrl_TxtBairro.CleanError(); } else { i_Form.TxtBairro.BackColor = colorInvalid; ctrl_TxtBairro.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCidade - case event_val_TxtCidade: { //InitEventCode event_val_TxtCidade switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtCidade.getTextBoxValue().Length > 3) { i_Form.TxtCidade.BackColor = Color.White; ctrl_TxtCidade.IsUserValidated = true; ctrl_TxtCidade.CleanError(); } else { i_Form.TxtCidade.BackColor = colorInvalid; ctrl_TxtCidade.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEstado - case event_val_TxtEstado: { //InitEventCode event_val_TxtEstado switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEstado.getTextBoxValue().Length == 2) { i_Form.TxtEstado.BackColor = Color.White; ctrl_TxtEstado.IsUserValidated = true; } else { i_Form.TxtEstado.BackColor = colorInvalid; ctrl_TxtEstado.IsUserValidated = false; ctrl_TxtEstado.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCEP - case event_val_TxtCEP: { //InitEventCode event_val_TxtCEP switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtCEP.Text.Length > 3) { i_Form.TxtCEP.BackColor = Color.White; ctrl_TxtCEP.IsUserValidated = true; } else { i_Form.TxtCEP.BackColor = colorInvalid; ctrl_TxtCEP.IsUserValidated = false; ctrl_TxtCEP.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDDD - case event_val_TxtDDD: { //InitEventCode event_val_TxtDDD switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtDDD.Text.Length > 1) { i_Form.TxtDDD.BackColor = Color.White; ctrl_TxtDDD.IsUserValidated = true; } else { i_Form.TxtDDD.BackColor = colorInvalid; ctrl_TxtDDD.IsUserValidated = false; ctrl_TxtDDD.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtTelefone - case event_val_TxtTelefone: { //InitEventCode event_val_TxtTelefone switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtTelefone.getTextBoxValue().Length < 8) { i_Form.TxtTelefone.BackColor = colorInvalid; ctrl_TxtTelefone.IsUserValidated = false; } else { i_Form.TxtTelefone.BackColor = Color.White; ctrl_TxtTelefone.IsUserValidated = true; ctrl_TxtTelefone.CleanError(); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtNasc - case event_val_TxtDtNasc: { //InitEventCode event_val_TxtDtNasc switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtNasc.BackColor = colorInvalid; ctrl_TxtDtNasc.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtNasc.BackColor = Color.White; ctrl_TxtDtNasc.IsUserValidated = true; ctrl_TxtDtNasc.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEmail - case event_val_TxtEmail: { //InitEventCode event_val_TxtEmail switch (arg as string) { case emailTextController.EMAIL_INVALID: { i_Form.TxtEmail.BackColor = colorInvalid; ctrl_TxtEmail.IsUserValidated = false; break; } case emailTextController.EMAIL_VALID: { i_Form.TxtEmail.BackColor = Color.White; ctrl_TxtEmail.IsUserValidated = true; ctrl_TxtEmail.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtRenda - case event_val_TxtRenda: { //InitEventCode event_val_TxtRenda //EndEventCode return(true); } #endregion #region - event_BtnAlterarClick - case event_BtnAlterarClick: { //InitEventCode event_BtnAlterarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtMatricula.AcquireTextBox(i_Form.TxtMatricula, this, event_val_TxtMatricula, 6); if (header.get_tg_user_type() == TipoUsuario.VendedorGift || header.get_tg_user_type() == TipoUsuario.AdminGift || header.get_tg_user_type() == TipoUsuario.Operador || header.get_tg_user_type() == TipoUsuario.Administrador) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; } //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar DadosProprietario dp = new DadosProprietario(); DadosCartao dc = new DadosCartao(); DadosAdicionais da = new DadosAdicionais(); if (var_exchange.fetch_proprietarioGift(ctrl_TxtMatricula.getTextBoxValue(), ref header, ref dp)) { dc.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); dc.set_st_matricula(ctrl_TxtMatricula.getTextBoxValue()); event_dlgConfGiftCard ev_call = new event_dlgConfGiftCard(var_util, var_exchange); ev_call.header = header; ev_call.dp = dp; ev_call.da = da; ev_call.dc = dc; ev_call.recarga = true; ev_call.i_Form.ShowDialog(); i_Form.Close(); } //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtEmpresa.Text.Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_val_TxtCartao, null); } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtMatricula - case event_val_TxtMatricula: { //InitEventCode event_val_TxtMatricula switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (i_Form.TxtMatricula.Text.Length > 0) { i_Form.TxtMatricula.BackColor = Color.White; ctrl_TxtMatricula.IsUserValidated = true; ctrl_TxtMatricula.CleanError(); if (ctrl_TxtMatricula.GetEnterPressed()) { doEvent(event_val_TxtCartao, null); } } else { i_Form.TxtMatricula.BackColor = colorInvalid; ctrl_TxtMatricula.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtTit - case event_val_TxtTit: { //InitEventCode event_val_TxtTit //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao if (!ctrl_TxtEmpresa.IsUserValidated && !ctrl_TxtMatricula.IsUserValidated) { return(false); } string empresa = ctrl_TxtEmpresa.getTextBoxValue(); string matricula = ctrl_TxtMatricula.getTextBoxValue(); string titularidade = "01"; string output_nu_maxParcelas = ""; string output_vr_dispMes = ""; string output_vr_dispTotal = ""; string output_st_nome = ""; if (var_exchange.fetch_dadosCartao(empresa, matricula, titularidade, ref header, ref output_nu_maxParcelas, ref output_vr_dispMes, ref output_vr_dispTotal, ref output_st_nome)) { i_Form.TxtNome.Text = output_st_nome; } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }
public override bool doEvent(int event_number, object arg) { switch (event_number) { #region - event_Load - case event_Load: { //InitEventCode event_Load #if ROBOT var_util.execDefinedRobot(this, var_alias); #else doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); #endif //EndEventCode return(true); } #endregion #region - event_Translate - case event_Translate: { //InitEventCode event_Translate //EndEventCode return(true); } #endregion #region - event_FormIsOpening - case event_FormIsOpening: { //InitEventCode event_FormIsOpening ctrl_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20); ctrl_TxtLimTotal.AcquireTextBox(i_Form.TxtLimTotal, this, event_val_TxtLimTotal, "R$", 6); ctrl_TxtLimMensal.AcquireTextBox(i_Form.TxtLimMensal, this, event_val_TxtLimMensal, "R$", 6); ctrl_TxtCotaExtra.AcquireTextBox(i_Form.TxtCotaExtra, this, event_val_TxtCotaExtra, "R$", 6); ctrl_TxtCidade.AcquireTextBox(i_Form.TxtCidade, this, event_val_TxtCidade, 20, false); ctrl_TxtEstado.AcquireTextBox(i_Form.TxtEstado, this, event_val_TxtEstado, 20, false); ctrl_TxtCpf.AcquireTextBox(i_Form.TxtCpf, this, event_val_TxtCpf); ctrl_TxtCNPJ.AcquireTextBox(i_Form.TxtCNPJ, this, event_val_TxtCNPJ); if (header.get_tg_user_type() == TipoUsuario.Administrador || header.get_tg_user_type() == TipoUsuario.AdminGift || header.get_tg_user_type() == TipoUsuario.VendedorGift || header.get_tg_user_type() == TipoUsuario.Operador) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; } if (header.get_tg_user_type() == TipoUsuario.SuperUser) { i_Form.BtnExclui.Visible = true; } i_Form.CboSit.SelectedIndex = 3; i_Form.CboExp.SelectedIndex = 2; //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog //EndEventCode return(true); } #endregion #region - event_Consultar - case event_Consultar: { //InitEventCode event_Consultar i_Form.BtnConsultar.Enabled = false; DadosConsultaCartoes dcc = new DadosConsultaCartoes(); if (header.get_tg_user_type() == TipoUsuario.Administrador) { dcc.set_st_empresa(header.get_st_empresa()); } else { dcc.set_st_cnpj(ctrl_TxtCNPJ.getTextBoxValue()); dcc.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); } dcc.set_st_cpf(ctrl_TxtCpf.getTextBoxValue()); dcc.set_st_cartao(ctrl_TxtCartao.getTextBoxValue()); dcc.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dcc.set_vr_limTotal(ctrl_TxtLimTotal.getTextBoxValue_NumberStr()); dcc.set_vr_limMensal(ctrl_TxtLimMensal.getTextBoxValue_NumberStr()); dcc.set_vr_cotaExtra(ctrl_TxtCotaExtra.getTextBoxValue_NumberStr()); dcc.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dcc.set_st_estado(ctrl_TxtEstado.getTextBoxValue()); dcc.set_tg_bloqueado(i_Form.CboSit.SelectedIndex.ToString()); dcc.set_tg_expedido(i_Form.CboExp.SelectedIndex.ToString()); string st_csv_block = ""; i_Form.LstCartao.Items.Clear(); i_Form.LblCart.Text = "Processando..."; Application.DoEvents(); ArrayList full_memory = new ArrayList(); if (var_exchange.fetch_consultaCartao(ref dcc, ref header, ref st_csv_block)) { while (st_csv_block != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_block, "400", ref st_csv_block, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } string bloq = ""; if (i_Form.ChkAlfa.Checked) { ArrayList lst_sort = new ArrayList(); Hashtable hsh_sort = new Hashtable(); for (int t = 0; t < full_memory.Count; ++t) { DadosCartao dc = new DadosCartao(full_memory[t] as DataPortable); lst_sort.Add(dc.get_st_proprietario() + dc.get_st_matricula()); hsh_sort [dc.get_st_proprietario() + dc.get_st_matricula()] = dc; } lst_sort.Sort(); for (int t = 0; t < lst_sort.Count; ++t) { DadosCartao dc = hsh_sort [lst_sort[t]] as DadosCartao; if (dc.get_tg_status() == CartaoStatus.Bloqueado) { bloq = "Sim"; } else { bloq = "Não"; } string [] full_row = new string [] { dc.get_st_empresa() + "." + dc.get_st_matricula() + "-" + dc.get_st_titularidade(), bloq, dc.get_st_proprietario(), "R$ " + new money().formatToMoney(dc.get_vr_limiteTotal()), "R$ " + new money().formatToMoney(dc.get_vr_limiteMensal()), "R$ " + new money().formatToMoney(dc.get_vr_extraCota()), "R$ " + new money().formatToMoney(dc.get_vr_dispMes()), "R$ " + new money().formatToMoney(dc.get_vr_dispTotal()) }; i_Form.LstCartao.Items.Add(var_util.GetListViewItem(dc.get_st_cpf(), full_row)); } } else { for (int t = 0; t < full_memory.Count; ++t) { DadosCartao dc = new DadosCartao(full_memory[t] as DataPortable); if (dc.get_tg_status() == CartaoStatus.Bloqueado) { bloq = "Sim"; } else { bloq = "Não"; } string [] full_row = new string [] { dc.get_st_empresa() + "." + dc.get_st_matricula() + "-" + dc.get_st_titularidade(), bloq, dc.get_st_proprietario(), "R$ " + new money().formatToMoney(dc.get_vr_limiteTotal()), "R$ " + new money().formatToMoney(dc.get_vr_limiteMensal()), "R$ " + new money().formatToMoney(dc.get_vr_extraCota()), "R$ " + new money().formatToMoney(dc.get_vr_dispMes()), "R$ " + new money().formatToMoney(dc.get_vr_dispTotal()) }; i_Form.LstCartao.Items.Add(var_util.GetListViewItem(dc.get_st_cpf(), full_row)); } } } if (full_memory.Count != 0) { i_Form.LblCart.Text = full_memory.Count.ToString() + " cartões encontrados"; } else { i_Form.LblCart.Text = "Nenhum cartão encontrado"; } i_Form.BtnConsultar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_val_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtEmpresa.getTextBoxValue().Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCNPJ - case event_val_TxtCNPJ: { //InitEventCode event_val_TxtCNPJ switch (arg as string) { case cnpjTextController.CNPJ_INCOMPLETE: case cnpjTextController.CNPJ_INVALID: { i_Form.TxtCNPJ.BackColor = colorInvalid; ctrl_TxtCNPJ.IsUserValidated = false; break; } case cnpjTextController.CNPJ_VALID: { i_Form.TxtCNPJ.BackColor = Color.White; ctrl_TxtCNPJ.IsUserValidated = true; ctrl_TxtCNPJ.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtNome - case event_val_TxtNome: { //InitEventCode event_val_TxtNome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNome.getTextBoxValue().Length > 0) { i_Form.TxtNome.BackColor = Color.White; ctrl_TxtNome.IsUserValidated = true; } else { i_Form.TxtNome.BackColor = colorInvalid; ctrl_TxtNome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtLimTotal - case event_val_TxtLimTotal: { //InitEventCode event_val_TxtLimTotal if (arg as string == moneyTextController.MONEY_ZERO) { i_Form.TxtLimTotal.BackColor = colorInvalid; ctrl_TxtLimTotal.IsUserValidated = false; } else { i_Form.TxtLimTotal.BackColor = Color.White; ctrl_TxtLimTotal.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_val_TxtLimMensal - case event_val_TxtLimMensal: { //InitEventCode event_val_TxtLimMensal if (arg as string == moneyTextController.MONEY_ZERO) { i_Form.TxtLimMensal.BackColor = colorInvalid; ctrl_TxtLimMensal.IsUserValidated = false; } else { i_Form.TxtLimMensal.BackColor = Color.White; ctrl_TxtLimMensal.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_val_TxtCotaExtra - case event_val_TxtCotaExtra: { //InitEventCode event_val_TxtCotaExtra if (arg as string == moneyTextController.MONEY_ZERO) { i_Form.TxtCotaExtra.BackColor = colorInvalid; ctrl_TxtCotaExtra.IsUserValidated = false; } else { i_Form.TxtCotaExtra.BackColor = Color.White; ctrl_TxtCotaExtra.IsUserValidated = true; } //EndEventCode return(true); } #endregion #region - event_val_TxtCidade - case event_val_TxtCidade: { //InitEventCode event_val_TxtCidade switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtCidade.getTextBoxValue().Length > 0) { i_Form.TxtCidade.BackColor = Color.White; ctrl_TxtCidade.IsUserValidated = true; } else { i_Form.TxtCidade.BackColor = colorInvalid; ctrl_TxtCidade.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtEstado - case event_val_TxtEstado: { //InitEventCode event_val_TxtEstado switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEstado.getTextBoxValue().Length > 0) { i_Form.TxtEstado.BackColor = Color.White; ctrl_TxtEstado.IsUserValidated = true; } else { i_Form.TxtEstado.BackColor = colorInvalid; ctrl_TxtEstado.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCartao - case event_val_TxtCartao: { //InitEventCode event_val_TxtCartao switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtCartao.getTextBoxValue().Length > 0) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtCpf - case event_val_TxtCpf: { //InitEventCode event_val_TxtCpf switch (arg as string) { case cnpjTextController.CNPJ_INCOMPLETE: case cnpjTextController.CNPJ_INVALID: case cpfTextController.CPF_INCOMPLETE: case cpfTextController.CPF_INVALID: { i_Form.TxtCpf.BackColor = colorInvalid; ctrl_TxtCpf.IsUserValidated = false; break; } case cpfTextController.CPF_VALID: case cnpjTextController.CNPJ_VALID: { i_Form.TxtCpf.BackColor = System.Drawing.Color.White; ctrl_TxtCpf.IsUserValidated = true; break; } } //EndEventCode return(true); } #endregion #region - event_Editar - case event_Editar: { //InitEventCode event_Editar if (i_Form.LstCartao.SelectedItems.Count > 0) { string cpf_cnpj = var_util.getSelectedListViewItemTag(i_Form.LstCartao); DadosProprietario dp = new DadosProprietario(); if (var_exchange.fetch_proprietario(cpf_cnpj, ref header, ref dp)) { if (dp.get_tg_found() == Context.TRUE) { event_dlgDadosCadastrais ev_call = new event_dlgDadosCadastrais(var_util, var_exchange); ev_call.header = header; ev_call.dp = dp; ev_call.cpf_cnpj = cpf_cnpj; ev_call.i_Form.ShowDialog(); } } } //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print //EndEventCode return(true); } #endregion #region - event_Report - case event_Report: { //InitEventCode event_Report ArrayList lstReport = new ArrayList(); lstReport.Add("RELATÓRIO DE CONSULTA DE CARTÃO"); lstReport.Add(""); lstReport.Add(" Limite Limite Cota Extra Disponível Disponível "); lstReport.Add("CARTÃO BLOQ NOME TOTAL MENSAL MENSAL TOTAL"); lstReport.Add("------------------------------------------------------------------------------------------------------------------------"); lstReport.Add(""); string line = ""; for (int t = 0; t < i_Form.LstCartao.Items.Count; ++t) { line = i_Form.LstCartao.Items[t].SubItems[0].Text + " "; line += i_Form.LstCartao.Items[t].SubItems[1].Text.PadLeft(4, ' ') + " "; line += i_Form.LstCartao.Items[t].SubItems[2].Text.PadRight(38, ' ').Substring(0, 38); line += i_Form.LstCartao.Items[t].SubItems[3].Text.PadLeft(14, ' ').Replace("R$ ", ""); line += i_Form.LstCartao.Items[t].SubItems[4].Text.PadLeft(14, ' ').Replace("R$ ", ""); line += i_Form.LstCartao.Items[t].SubItems[5].Text.PadLeft(14, ' ').Replace("R$ ", ""); line += i_Form.LstCartao.Items[t].SubItems[6].Text.PadLeft(14, ' ').Replace("R$ ", ""); line += i_Form.LstCartao.Items[t].SubItems[7].Text.PadLeft(14, ' ').Replace("R$ ", ""); lstReport.Add(line); } new ConveyPrinter("Courier New", 7, 10, ref lstReport); //EndEventCode return(true); } #endregion #region - event_BtnConsultarClick - case event_BtnConsultarClick: { //InitEventCode event_BtnConsultarClick //EndEventCode return(true); } #endregion #region - event_LstCartaoDoubleClick - case event_LstCartaoDoubleClick: { //InitEventCode event_LstCartaoDoubleClick //EndEventCode return(true); } #endregion #region - event_BtnRelatorioClick - case event_BtnRelatorioClick: { //InitEventCode event_BtnRelatorioClick //EndEventCode return(true); } #endregion #region - event_ChkAlfaCheckedChanged - case event_ChkAlfaCheckedChanged: { //InitEventCode event_ChkAlfaCheckedChanged doEvent(event_Consultar, null); //EndEventCode return(true); } #endregion #region - event_BtnExcluiClick - case event_BtnExcluiClick: { //InitEventCode event_BtnExcluiClick if (i_Form.LstCartao.SelectedItems.Count == 1) { string emp = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(0, 6); string mat = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(7, 6); string tit = i_Form.LstCartao.SelectedItems[0].SubItems[0].Text.Substring(14, 2); var_exchange.exec_excluiCart(emp, mat, tit, ref header); } //EndEventCode return(true); } #endregion default: break; } return(false); }