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 InstallData inst_data = new InstallData(); i_Form.LblVersion.Text = inst_data.st_version; ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20, alphaTextController.ENABLE_NUMBERS); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 8, alphaTextController.ENABLE_NUMBERS); ctrl_TxtSenha.AcquireTextBox(i_Form.TxtSenha, this, event_val_TxtSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEmpresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); //EndEventCode return(true); } #endregion #region - robot_ShowDialog - case robot_ShowDialog: { //InitEventCode robot_ShowDialog if (i_Form.IsDisposed) { i_Form = new dlgLogin(this); } i_Form.Show(); //EndEventCode return(true); } #endregion #region - robot_CloseDialog - case robot_CloseDialog: { //InitEventCode robot_CloseDialog i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar bool IsDone = true; if (!ctrl_TxtNome.IsUserValidated) { ctrl_TxtNome.SetErrorMessage("Nome incompleto"); IsDone = false; } if (!ctrl_TxtSenha.IsUserValidated) { ctrl_TxtSenha.SetErrorMessage("Senha incompleta"); IsDone = false; } if (!IsDone) { return(false); } string tg_trocaSenha = ""; string var_st_empresa = ctrl_TxtEmpresa.getTextBoxValue(); string st_senha_atual = var_util.getMd5Hash(ctrl_TxtSenha.getTextBoxValue()); if (var_exchange.exec_login(ctrl_TxtNome.getTextBoxValue(), var_st_empresa, st_senha_atual, ref tg_trocaSenha, ref header)) { if (tg_trocaSenha == Context.TRUE) { var_IsChangePass = true; } var_IsCanceled = false; var_st_nome = ctrl_TxtNome.getTextBoxValue(); i_Form.Close(); } else { if (!ctrl_TxtEmpresa.IsUserValidated) { ctrl_TxtEmpresa.SetErrorMessage("Código de empresa incompleto"); } } //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_TxtEmpresa - case event_val_TxtEmpresa: { //InitEventCode event_val_TxtEmpresa switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtEmpresa.getTextBoxValue().Length > 0) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } if (ctrl_TxtEmpresa.GetEnterPressed()) { doEvent(event_Confirmar, null); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtSenha - case event_val_TxtSenha: { //InitEventCode event_val_TxtSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtSenha.getTextBoxValue().Length > 3) { i_Form.TxtSenha.BackColor = Color.White; ctrl_TxtSenha.IsUserValidated = true; ctrl_TxtSenha.CleanError(); } else { i_Form.TxtSenha.BackColor = colorInvalid; ctrl_TxtSenha.IsUserValidated = false; } if (ctrl_TxtSenha.GetEnterPressed()) { doEvent(event_Confirmar, null); } break; } default: break; } //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_TxtSenhaAtual.AcquireTextBox(i_Form.TxtSenhaAtual, this, event_val_TxtSenhaAtual, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNovaSenha.AcquireTextBox(i_Form.TxtNovaSenha, this, event_val_TxtNovaSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtConfirmaSenha.AcquireTextBox(i_Form.TxtConfirmaSenha, this, event_val_TxtConfirmaSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtNovaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtConfirmaSenha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, 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_Confirmar - case event_Confirmar: { //InitEventCode event_Confirmar if (ctrl_TxtNovaSenha.getTextBoxValue() != ctrl_TxtConfirmaSenha.getTextBoxValue()) { ctrl_TxtConfirmaSenha.SetErrorMessage("Senha inválida"); return(false); } if (!ctrl_TxtNovaSenha.IsUserValidated) { ctrl_TxtNovaSenha.SetErrorMessage("Senha incompleta"); ctrl_TxtConfirmaSenha.SetErrorMessage("Senha incompleta"); return(false); } string st_senha_atual = var_util.getMd5Hash(ctrl_TxtSenhaAtual.getTextBoxValue()); string st_senha_nova = var_util.getMd5Hash(ctrl_TxtNovaSenha.getTextBoxValue()); if (var_exchange.exec_trocaSenha(st_senha_atual, st_senha_nova, ref header)) { var_IsCanceled = false; i_Form.Close(); } //EndEventCode return(true); } #endregion #region - event_val_TxtSenhaAtual - case event_val_TxtSenhaAtual: { //InitEventCode event_val_TxtSenhaAtual switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtSenhaAtual.getTextBoxValue().Length > 3) { i_Form.TxtSenhaAtual.BackColor = Color.White; ctrl_TxtSenhaAtual.IsUserValidated = true; } else { i_Form.TxtSenhaAtual.BackColor = colorInvalid; ctrl_TxtSenhaAtual.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtNovaSenha - case event_val_TxtNovaSenha: { //InitEventCode event_val_TxtNovaSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtNovaSenha.getTextBoxValue().Length > 3) { i_Form.TxtNovaSenha.BackColor = Color.White; ctrl_TxtNovaSenha.IsUserValidated = true; ctrl_TxtNovaSenha.CleanError(); } else { i_Form.TxtNovaSenha.BackColor = colorInvalid; ctrl_TxtNovaSenha.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtConfirmaSenha - case event_val_TxtConfirmaSenha: { //InitEventCode event_val_TxtConfirmaSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtConfirmaSenha.getTextBoxValue().Length > 3) { i_Form.TxtConfirmaSenha.BackColor = Color.White; ctrl_TxtConfirmaSenha.IsUserValidated = true; ctrl_TxtConfirmaSenha.CleanError(); } else { i_Form.TxtConfirmaSenha.BackColor = colorInvalid; ctrl_TxtConfirmaSenha.IsUserValidated = false; } break; } default: break; } //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_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40); 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_TxtQtdCartoes.AcquireTextBox(i_Form.TxtQtdCartoes, this, event_val_TxtQtdCartoes, 6); ctrl_TxtQtdParc.AcquireTextBox(i_Form.TxtQtdParc, this, event_val_TxtQtdParc, 6); ctrl_TxtQtdLojas.AcquireTextBox(i_Form.TxtQtdLojas, this, event_val_TxtQtdLojas, 6); ctrl_TxtVrMin.AcquireTextBox(i_Form.TxtVrMin, this, event_val_TxtVrMin, "R$", 6); ctrl_TxtVrMax.AcquireTextBox(i_Form.TxtVrMax, this, event_val_TxtVrMax, "R$", 6); //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_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_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_TxtQtdCartoes - case event_val_TxtQtdCartoes: { //InitEventCode event_val_TxtQtdCartoes switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdCartoes.getTextBoxValue().Length > 0) { i_Form.TxtQtdCartoes.BackColor = Color.White; ctrl_TxtQtdCartoes.IsUserValidated = true; } else { i_Form.TxtQtdCartoes.BackColor = colorInvalid; ctrl_TxtQtdCartoes.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtQtdParc - case event_val_TxtQtdParc: { //InitEventCode event_val_TxtQtdParc switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdParc.getTextBoxValue().Length > 0) { i_Form.TxtQtdParc.BackColor = Color.White; ctrl_TxtQtdParc.IsUserValidated = true; } else { i_Form.TxtQtdParc.BackColor = colorInvalid; ctrl_TxtQtdParc.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtVrMin - case event_val_TxtVrMin: { //InitEventCode event_val_TxtVrMin if (ctrl_TxtVrMin.getTextBoxValue_Long() > 0) { i_Form.TxtVrMin.BackColor = Color.White; ctrl_TxtVrMin.IsUserValidated = true; } else { i_Form.TxtVrMin.BackColor = colorInvalid; ctrl_TxtVrMin.IsUserValidated = false; } //EndEventCode return(true); } #endregion #region - event_val_TxtVrMax - case event_val_TxtVrMax: { //InitEventCode event_val_TxtVrMax if (ctrl_TxtVrMax.getTextBoxValue_Long() > 0) { i_Form.TxtVrMax.BackColor = Color.White; ctrl_TxtVrMax.IsUserValidated = true; } else { i_Form.TxtVrMax.BackColor = colorInvalid; ctrl_TxtVrMax.IsUserValidated = false; } //EndEventCode return(true); } #endregion #region - event_Consultar - case event_Consultar: { //InitEventCode event_Consultar i_Form.BtnConsultar.Enabled = false; DadosConsultaEmpresa dce = new DadosConsultaEmpresa(); dce.set_st_nome(ctrl_TxtNome.getTextBoxValue()); dce.set_st_cidade(ctrl_TxtCidade.getTextBoxValue()); dce.set_st_estado(ctrl_TxtEstado.getTextBoxValue()); dce.set_nu_cartoes(ctrl_TxtQtdCartoes.getTextBoxValue()); dce.set_nu_parcelas(ctrl_TxtQtdParc.getTextBoxValue()); dce.set_vr_taxa_min(ctrl_TxtVrMin.getTextBoxValue_NumberStr()); dce.set_vr_taxa_max(ctrl_TxtVrMax.getTextBoxValue_NumberStr()); dce.set_nu_lojas(ctrl_TxtQtdLojas.getTextBoxValue()); string st_csv_id = ""; i_Form.LstEmpresas.Items.Clear(); Application.DoEvents(); if (var_exchange.fetch_consultaEmpresa(ref dce, ref header, ref st_csv_id)) { ArrayList full_memory = new ArrayList(); while (st_csv_id != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv_id, "400", ref st_csv_id, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } for (int t = 0; t < full_memory.Count; ++t) { DadosEmpresa de = new DadosEmpresa(full_memory[t] as DataPortable); string [] full_row = new string [] { de.get_st_empresa(), de.get_st_fantasia(), de.get_st_cidade(), de.get_st_estado(), de.get_nu_cartoes(), de.get_nu_parcelas(), "R$ " + new money().formatToMoney(de.get_vr_mensalidade()), de.get_nu_lojas(), de.get_nu_CNPJ() }; i_Form.LstEmpresas.Items.Add(var_util.GetListViewItem(de.get_st_empresa(), full_row)); } } i_Form.BtnConsultar.Enabled = true; //EndEventCode return(true); } #endregion #region - event_Editar - case event_Editar: { //InitEventCode event_Editar if (i_Form.LstEmpresas.SelectedItems.Count > 0) { event_dlgNovaEmpresa ev_call = new event_dlgNovaEmpresa(var_util, var_exchange); ev_call.header = header; ev_call.IsMaintenance = true; ev_call.par_code = var_util.getSelectedListViewItemTag(i_Form.LstEmpresas); ev_call.i_Form.ShowDialog(); } //EndEventCode return(true); } #endregion #region - event_val_TxtQtdLojas - case event_val_TxtQtdLojas: { //InitEventCode event_val_TxtQtdLojas switch (arg as string) { case numberTextController.NUMBER_INCOMPLETE: case numberTextController.NUMBER_COMPLETE: { if (ctrl_TxtQtdLojas.getTextBoxValue().Length > 0) { i_Form.TxtQtdLojas.BackColor = Color.White; ctrl_TxtQtdLojas.IsUserValidated = true; } else { i_Form.TxtQtdLojas.BackColor = colorInvalid; ctrl_TxtQtdLojas.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_Cancelar - case event_Cancelar: { //InitEventCode event_Cancelar if (i_Form.LstEmpresas.SelectedItems.Count > 0) { dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); var_exchange.exec_cancelaEmpresa(var_util.getMd5Hash(autor.senha), new ApplicationUtil().getSelectedListViewItemTag(i_Form.LstEmpresas), ref header); } //EndEventCode return(true); } #endregion #region - event_BtnConsultarClick - case event_BtnConsultarClick: { //InitEventCode event_BtnConsultarClick //EndEventCode return(true); } #endregion #region - event_LstEmpresasDoubleClick - case event_LstEmpresasDoubleClick: { //InitEventCode event_LstEmpresasDoubleClick //EndEventCode return(true); } #endregion #region - event_BtnCancelarClick - case event_BtnCancelarClick: { //InitEventCode event_BtnCancelarClick //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_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 20, alphaTextController.ENABLE_NUMBERS); ctrl_TxtSenha.AcquireTextBox(i_Form.TxtSenha, this, event_val_TxtSenha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); if (header.get_tg_user_type() == TipoUsuario.SuperUser) { i_Form.CboNivel.Items.AddRange(new TipoUsuarioDesc().GetArray().ToArray()); } else { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.Enabled = false; if (header.get_tg_user_type() == TipoUsuario.Administrador) { i_Form.CboNivel.Items.Add(TipoUsuarioDesc.Operador); } else if (header.get_tg_user_type() == TipoUsuario.AdminGift) { i_Form.CboNivel.Items.Add(TipoUsuarioDesc.VendedorGift); i_Form.CboNivel.Items.Add(TipoUsuarioDesc.AdminGift); } } i_Form.CboNivel.SelectedIndex = 0; //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 if (!ctrl_TxtNome.IsUserValidated) { MessageBox.Show("Preencher o nome corretamente", "Aviso"); return(false); } if (!ctrl_TxtSenha.IsUserValidated) { MessageBox.Show("Preencher a senha corretamente", "Aviso"); return(false); } if (i_Form.CboNivel.SelectedIndex.ToString() != TipoUsuario.OperadorCont && i_Form.CboNivel.SelectedIndex.ToString() != TipoUsuario.OperadorConvey && i_Form.CboNivel.SelectedIndex.ToString() != TipoUsuario.SuperUser && i_Form.CboNivel.SelectedIndex.ToString() != TipoUsuario.Lojista) { if (!ctrl_TxtEmpresa.IsUserValidated) { MessageBox.Show("Preencher a empresa corretamente", "Aviso"); return(false); } } string tg_trocaSenha = Context.FALSE; if (i_Form.ChkTrocaSenha.Checked) { tg_trocaSenha = Context.TRUE; } string st_senha = var_util.getMd5Hash(ctrl_TxtSenha.getTextBoxValue()); string nivel_cad = ""; if (header.get_tg_user_type() == TipoUsuario.SuperUser) { nivel_cad = i_Form.CboNivel.SelectedIndex.ToString(); } else { if (header.get_tg_user_type() == TipoUsuario.Administrador) { nivel_cad = TipoUsuario.Operador; } else if (header.get_tg_user_type() == TipoUsuario.AdminGift) { if (i_Form.CboNivel.SelectedIndex == 0) { nivel_cad = TipoUsuario.VendedorGift; } else { nivel_cad = TipoUsuario.AdminGift; } } } var_exchange.ins_usuario(ctrl_TxtNome.getTextBoxValue(), st_senha, tg_trocaSenha, nivel_cad, ctrl_TxtEmpresa.getTextBoxValue(), ref header); if (nivel_cad == TipoUsuario.Lojista) { event_dlgLojista ev_call = new event_dlgLojista(var_util, var_exchange); ev_call.header = header; ev_call.i_Form.ShowDialog(); } //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_TxtSenha - case event_val_TxtSenha: { //InitEventCode event_val_TxtSenha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { if (ctrl_TxtSenha.getTextBoxValue().Length > 3) { i_Form.TxtSenha.BackColor = Color.White; ctrl_TxtSenha.IsUserValidated = true; } else { i_Form.TxtSenha.BackColor = colorInvalid; ctrl_TxtSenha.IsUserValidated = false; } break; } default: break; } //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; } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //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 doEvent(event_Translate, null); doEvent(event_FormIsOpening, null); //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_TxtSt_Nome.AcquireTextBox(i_Form.TxtSt_Nome, this, event_val_TxtSt_Nome, 20, alphaTextController.ENABLE_NUMBERS); ctrl_TxtSt_Empresa.AcquireTextBox(i_Form.TxtSt_Empresa, this, event_val_TxtSt_Empresa, 8, alphaTextController.ENABLE_NUMBERS); ctrl_TxtSt_Senha.AcquireTextBox(i_Form.TxtSt_Senha, this, event_val_TxtSt_Senha, 16, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtSt_Nome.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtSt_Empresa.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtSt_Senha.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); //EndEventCode return(true); } #endregion #region - event_val_TxtSt_Nome - case event_val_TxtSt_Nome: { //InitEventCode event_val_TxtSt_Nome switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { ctrl_TxtSt_Nome.CleanError(); if (ctrl_TxtSt_Nome.getTextBoxValue().Length > 2) { i_Form.TxtSt_Nome.BackColor = Color.White; ctrl_TxtSt_Nome.IsUserValidated = true; } else { i_Form.TxtSt_Nome.BackColor = Color.Lavender; ctrl_TxtSt_Nome.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtSt_Empresa - case event_val_TxtSt_Empresa: { //InitEventCode event_val_TxtSt_Empresa switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { ctrl_TxtSt_Empresa.CleanError(); if (ctrl_TxtSt_Empresa.getTextBoxValue().Length > 0) { i_Form.TxtSt_Empresa.BackColor = Color.White; ctrl_TxtSt_Empresa.IsUserValidated = true; } else { i_Form.TxtSt_Empresa.BackColor = Color.Lavender; ctrl_TxtSt_Empresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtSt_Senha - case event_val_TxtSt_Senha: { //InitEventCode event_val_TxtSt_Senha switch (arg as string) { case alphaTextController.ALPHA_COMPLETE: case alphaTextController.ALPHA_INCOMPLETE: { ctrl_TxtSt_Senha.CleanError(); if (ctrl_TxtSt_Senha.getTextBoxValue().Length > 3) { i_Form.TxtSt_Senha.BackColor = Color.White; ctrl_TxtSt_Senha.IsUserValidated = true; } else { i_Form.TxtSt_Senha.BackColor = Color.Lavender; ctrl_TxtSt_Senha.IsUserValidated = false; } if (ctrl_TxtSt_Senha.GetEnterPressed()) { doEvent(event_BtnConfirmarClick, null); } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick bool IsDone = true; if (!ctrl_TxtSt_Nome.IsUserValidated) { ctrl_TxtSt_Nome.SetErrorMessage("Nome incompleto"); IsDone = false; } if (!ctrl_TxtSt_Senha.IsUserValidated) { ctrl_TxtSt_Senha.SetErrorMessage("Senha incompleta"); IsDone = false; } if (!IsDone) { return(false); } string tg_trocaSenha = ""; string var_st_empresa = ctrl_TxtSt_Empresa.getTextBoxValue(); string st_senha_atual = var_util.getMd5Hash(ctrl_TxtSt_Senha.getTextBoxValue()); if (var_exchange.exec_login(ctrl_TxtSt_Nome.getTextBoxValue(), "l" + var_st_empresa, st_senha_atual, ref tg_trocaSenha, ref header)) { var_IsCanceled = false; i_Form.Close(); } else { if (!ctrl_TxtSt_Empresa.IsUserValidated) { ctrl_TxtSt_Empresa.SetErrorMessage("Código de empresa incompleto"); } } //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_TxtCartao.AcquireTextBox(i_Form.TxtCartao, this, event_val_TxtCartao, 6); ctrl_TxtDiario.AcquireTextBox(i_Form.TxtDiario, this, event_val_TxtDiario, "R$", 8); ctrl_TxtMensal.AcquireTextBox(i_Form.TxtMensal, this, event_val_TxtMensal, "R$", 8); ctrl_TxtEdu.AcquireTextBox(i_Form.TxtEdu, this, event_val_TxtEdu, "R$", 8); ctrl_TxtExtra.AcquireTextBox(i_Form.TxtExtra, this, event_val_TxtExtra, "R$", 8); ctrl_TxtDin.AcquireTextBox(i_Form.TxtDin, this, event_val_TxtDin, "R$", 8); ctrl_TxtCartao.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDiario.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtMensal.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtEdu.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtExtra.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtDin.SetupErrorProvider(ErrorIconAlignment.MiddleRight, false); ctrl_TxtCartao.IsUserValidated = false; ctrl_TxtDtIni.AcquireTextBox(i_Form.TxtDtIni, this, event_val_TxtDtIni, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtFim.AcquireTextBox(i_Form.TxtDtFim, this, event_val_TxtDtFim, dateTextController.FORMAT_DDMMYYYY); ctrl_TxtDtIni.SetTextBoxText(DateTime.Now.AddDays(-7).Day.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Month.ToString().PadLeft(2, '0') + DateTime.Now.AddDays(-7).Year.ToString().PadLeft(2, '0')); ctrl_TxtDtFim.SetTextBoxText(DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Year.ToString().PadLeft(2, '0')); if (header.get_tg_user_type() != TipoUsuario.SuperUser && header.get_tg_user_type() == TipoUsuario.OperadorEdu) { i_Form.TxtEmpresa.Text = 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_Definir - case event_Definir: { //InitEventCode event_Definir if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_edu_alteraDiario(var_util.getMd5Hash(autor.senha), ctrl_TxtDiario.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Pagamento - case event_Pagamento: { //InitEventCode event_Pagamento if (!ctrl_TxtCartao.IsUserValidated) { return(false); } dlgAutorizacao autor = new dlgAutorizacao(); autor.ShowDialog(); Application.DoEvents(); if (autor.IsConfirmed) { var_exchange.exec_depotEduImediato(var_util.getMd5Hash(autor.senha), ctrl_TxtEdu.getTextBoxValue_NumberStr(), ctrl_TxtExtra.getTextBoxValue_NumberStr(), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header); } doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Vis - case event_Vis: { //InitEventCode event_Vis // ############################## // # SETUP LISTS ################ // ############################## ArrayList lstHeader = new ArrayList(); ArrayList lstContent = new ArrayList(); ArrayList lstTableSizes = new ArrayList(); ArrayList lstFooter = new ArrayList(); ArrayList lstMessages = new ArrayList(); ArrayList lstFilters = new ArrayList(); ArrayList lstFooterSub1 = new ArrayList(); ArrayList lstHeaderSub1 = new ArrayList(); ArrayList lstContentSub1 = new ArrayList(); lstHeader.Add(lstHeaderSub1); lstFooter.Add(lstFooterSub1); lstContent.Add(lstContentSub1); // ############################## // # CUSTOMIZE // ############################## string st_csv = ""; string st_empresa = ""; string st_total_periodo = ""; if (!var_exchange.fetch_rel_edu_extrato(var_util.GetDataBaseTimeFormat(ctrl_TxtDtIni.getTextBoxValue_Date()), var_util.GetDataBaseTimeFormat(ctrl_TxtDtFim.getTextBoxValue_Date().AddDays(1)), ctrl_TxtEmpresa.getTextBoxValue(), ctrl_TxtCartao.getTextBoxValue(), ref header, ref st_csv, ref st_empresa, ref st_total_periodo)) { return(false); } lstMessages.Add("Extrato do aluno: " + i_Form.TxtAluno.Text); lstTableSizes.Add(950); lstHeaderSub1.Add("NSU"); lstHeaderSub1.Add("Data"); lstHeaderSub1.Add("Valor R$"); lstHeaderSub1.Add("Loja"); lstHeaderSub1.Add("Saldo R$"); lstHeaderSub1.Add("Fundo R$"); lstHeaderSub1.Add("Operação"); money money_helper = new money(); ArrayList full_memory = new ArrayList(); while (st_csv != "") { ArrayList tmp_memory = new ArrayList(); if (var_exchange.fetch_memory(st_csv, "400", ref st_csv, ref tmp_memory)) { for (int t = 0; t < tmp_memory.Count; ++t) { full_memory.Add(tmp_memory[t]); } } } ArrayList desc = new TipoConfirmacaoDesc().GetArray(); ArrayList desc_op = new OperacaoCartaoDesc().GetArray(); for (int t = 0; t < full_memory.Count; ++t) { EduExtrato rel_line = new EduExtrato(full_memory[t] as DataPortable); ArrayList lstLine1 = new ArrayList(); lstLine1.Add(rel_line.get_st_nsu()); lstLine1.Add(var_util.getDDMMYYYY_format(rel_line.get_dt_trans())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_valor())); lstLine1.Add(rel_line.get_st_loja()); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_disp())); lstLine1.Add(money_helper.formatToMoney(rel_line.get_vr_fundo())); if (rel_line.get_en_oper() == OperacaoCartao.VENDA_EMPRESARIAL) { lstLine1.Add("Utilização do cartão"); } else { lstLine1.Add(desc_op [Convert.ToInt32(rel_line.get_en_oper())].ToString()); } lstContentSub1.Add(lstLine1); } SyCrafReport rel = new SyCrafReport("Extrado de Transações por cartão", "ETC", st_empresa, ctrl_TxtDtIni.getTextBoxValue(), ctrl_TxtDtFim.getTextBoxValue(), ref lstHeader, ref lstContent, ref lstTableSizes, ref lstFooter, ref lstMessages, ref lstFilters); //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 (i_Form.TxtCartao.Text.Length == 6) { i_Form.TxtCartao.BackColor = Color.White; ctrl_TxtCartao.IsUserValidated = true; ctrl_TxtCartao.CleanError(); } else { i_Form.TxtCartao.BackColor = colorInvalid; ctrl_TxtCartao.IsUserValidated = false; } break; } default: break; } if (ctrl_TxtCartao.IsUserValidated) { if (ctrl_TxtCartao.GetEnterPressed()) { doEvent(event_BuscaDados, null); } } //EndEventCode return(true); } #endregion #region - event_val_TxtDiario - case event_val_TxtDiario: { //InitEventCode event_val_TxtDiario //EndEventCode return(true); } #endregion #region - event_val_TxtMensal - case event_val_TxtMensal: { //InitEventCode event_val_TxtMensal if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtMensal.getTextBoxValue_Long(); if (val > 0) { ctrl_TxtDiario.SetTextBoxLong(val / 31); } //EndEventCode return(true); } #endregion #region - event_val_TxtEdu - case event_val_TxtEdu: { //InitEventCode event_val_TxtEdu if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtExtra - case event_val_TxtExtra: { //InitEventCode event_val_TxtExtra if (!ctrl_TxtCartao.IsUserValidated) { return(false); } long val = ctrl_TxtEdu.getTextBoxValue_Long() + ctrl_TxtExtra.getTextBoxValue_Long(); ctrl_TxtDin.SetTextBoxLong(val); //EndEventCode return(true); } #endregion #region - event_val_TxtDoc - case event_val_TxtDoc: { //InitEventCode event_val_TxtDoc /*if ( !ctrl_TxtCartao.IsUserValidated ) * return false; * * if ( ctrl_TxtDoc.getTextBoxValue_Long() > 0 ) * { * long diario = ctrl_TxtDoc.getTextBoxValue_Long() / 31; * * i_Form.rb1.Text = "Em Fundo Educacional, definindo R$ " + * new money().formatToMoney ( diario.ToString() ) + * " diário"; * } */ //EndEventCode return(true); } #endregion #region - event_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados if (!ctrl_TxtEmpresa.IsUserValidated || !ctrl_TxtCartao.IsUserValidated) { return(false); } DadosCartaoEdu dce = new DadosCartaoEdu(); if (var_exchange.fetch_dadosAluno(ctrl_TxtEmpresa.getTextBoxValue() + ctrl_TxtCartao.getTextBoxValue() + "01", ref header, ref dce)) { i_Form.TxtAluno.Text = dce.get_st_aluno(); ctrl_TxtDiario.SetTextBoxString(dce.get_vr_diario().PadLeft(6, '0')); int diario = Convert.ToInt32(dce.get_vr_diario()); int calc_mes = diario * 31; i_Form.TxtMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtVrDisp.Text = "R$ " + new money().formatToMoney(dce.get_vr_disp()); i_Form.TxtVrDispDiario.Text = "R$ " + new money().formatToMoney(diario.ToString()); i_Form.TxtVrDispMensal.Text = "R$ " + new money().formatToMoney(calc_mes.ToString()); i_Form.TxtSaldoTotal.Text = "R$ " + new money().formatToMoney(dce.get_vr_depot()); DateTime tim = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1); long dias = tim.Subtract(DateTime.Now).Days; long prev_mes = dias * diario; i_Form.TxtVrSaldoMes.Text = "R$ " + new money().formatToMoney(prev_mes.ToString()); } //EndEventCode return(true); } #endregion #region - event_val_TxtDin - case event_val_TxtDin: { //InitEventCode event_val_TxtDin //EndEventCode return(true); } #endregion #region - event_val_TxtDtIni - case event_val_TxtDtIni: { //InitEventCode event_val_TxtDtIni switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtIni.BackColor = colorInvalid; ctrl_TxtDtIni.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtIni.BackColor = Color.White; ctrl_TxtDtIni.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //EndEventCode return(true); } #endregion #region - event_val_TxtDtFim - case event_val_TxtDtFim: { //InitEventCode event_val_TxtDtFim switch (arg as string) { case dateTextController.DATE_INVALID: { i_Form.TxtDtFim.BackColor = colorInvalid; ctrl_TxtDtFim.IsUserValidated = false; break; } case dateTextController.DATE_VALID: { i_Form.TxtDtFim.BackColor = Color.White; ctrl_TxtDtFim.IsUserValidated = true; ctrl_TxtDtIni.CleanError(); break; } default: break; } //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 == 6) { i_Form.TxtEmpresa.BackColor = Color.White; ctrl_TxtEmpresa.IsUserValidated = true; ctrl_TxtEmpresa.CleanError(); } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_BtnAlterarClick - case event_BtnAlterarClick: { //InitEventCode event_BtnAlterarClick //EndEventCode return(true); } #endregion #region - event_BtnPagamentoClick - case event_BtnPagamentoClick: { //InitEventCode event_BtnPagamentoClick //EndEventCode return(true); } #endregion #region - event_BtnExtratoClick - case event_BtnExtratoClick: { //InitEventCode event_BtnExtratoClick //EndEventCode return(true); } #endregion default: break; } return(false); }