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_TxtCodAcesso.AcquireTextBox(i_Form.TxtCodAcesso, this, event_val_TxtCodAcesso, 4); ctrl_TxtCarga.AcquireTextBox(i_Form.TxtCarga, this, event_val_TxtCarga, "R$", 6); i_Form.LstDados.Items.Add("-Nome "); i_Form.LstDados.Items.Add(dp.get_st_nome()); i_Form.LstDados.Items.Add("-Cpf "); i_Form.LstDados.Items.Add(dp.get_st_cpf()); i_Form.LstDados.Items.Add("-Telefone "); i_Form.LstDados.Items.Add(dp.get_st_telefone()); i_Form.LstDados.Items.Add("-Endereço "); i_Form.LstDados.Items.Add(dp.get_st_endereco()); ArrayList lst = new ArrayList(); var_exchange.fetch_extraGift(ref header, ref lst); i_Form.LstProd.Items.Clear(); for (int t = 0; t < lst.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(lst[t] as DataPortable); string [] full_row = new string [] { dpg.get_st_nome(), "R$ " + new money().formatToMoney(dpg.get_vr_valor()) }; i_Form.LstProd.Items.Add(var_util.GetListViewItem(dpg.get_id_produto(), full_row)); if (recarga) { if (t == 1) { i_Form.LstProd.Items[t].Checked = true; } } else { if (t == 0) { i_Form.LstProd.Items[t].Checked = true; } } } if (recarga) { i_Form.Text = "Confirmação para recarga de cartão Gift"; } doEvent(event_CalcTotal, null); //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_TxtCarga.getTextBoxValue_Long() == 0) { MessageBox.Show("Informe o valor de carga", "Aviso"); return(false); } string tg_recarga = Context.FALSE; if (recarga) { tg_recarga = Context.TRUE; } if (!var_exchange.exec_validGift(ctrl_TxtCodAcesso.getTextBoxValue(), dc.get_st_empresa(), dc.get_st_matricula(), tg_recarga, ref header)) { return(false); } event_dlgFinalGift ev_call = new event_dlgFinalGift(var_util, var_exchange); ev_call.header = header; ev_call.da = da; ev_call.dp = dp; ev_call.dc = dc; ev_call.total = total; ev_call.carga = ctrl_TxtCarga.getTextBoxValue_Long(); ev_call.recarga = recarga; for (int t = 0; t < i_Form.LstProd.Items.Count; ++t) { if (i_Form.LstProd.Items[t].Checked == true) { ev_call.lstProdsNome.Add(i_Form.LstProd.Items[t].SubItems[0].Text); ev_call.lstProdsValor.Add(new money().getNumericValue(i_Form.LstProd.Items[t].SubItems[1].Text.Replace("R$", "")).ToString()); } } ev_call.i_Form.ShowDialog(); i_Form.IsTerm = ev_call.IsTerm; i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_val_TxtCarga - case event_val_TxtCarga: { //InitEventCode event_val_TxtCarga doEvent(event_CalcTotal, null); //EndEventCode return(true); } #endregion #region - event_CalcTotal - case event_CalcTotal: { //InitEventCode event_CalcTotal total = ctrl_TxtCarga.getTextBoxValue_Long(); for (int t = 0; t < i_Form.LstProd.Items.Count; ++t) { if (recarga) { if (t == 1) { if (i_Form.LstProd.Items[t].Checked == false) { i_Form.LstProd.Items[t].Checked = true; return(false); } } } else { if (t == 0) { if (i_Form.LstProd.Items[t].Checked == false) { i_Form.LstProd.Items[t].Checked = true; return(false); } } } if (i_Form.LstProd.Items[t].Checked == true) { total += new money().getNumericValue(i_Form.LstProd.Items[t].SubItems[1].Text.Replace("R$", "")); } } i_Form.LblTotal.Text = "Total: R$ " + new money().formatToMoney(total.ToString()); //EndEventCode return(true); } #endregion #region - event_FormIsClosing - case event_FormIsClosing: { //InitEventCode event_FormIsClosing //EndEventCode return(true); } #endregion #region - event_val_TxtCodAcesso - case event_val_TxtCodAcesso: { //InitEventCode event_val_TxtCodAcesso //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion #region - event_LstProdItemChecked - case event_LstProdItemChecked: { //InitEventCode event_LstProdItemChecked //EndEventCode return(true); } #endregion #region - event_DlgConfGiftCardFormClosing - case event_DlgConfGiftCardFormClosing: { //InitEventCode event_DlgConfGiftCardFormClosing //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_TxtValor.AcquireTextBox(i_Form.TxtValor, this, event_val_TxtValor, "R$", 8); ctrl_TxtNome.AcquireTextBox(i_Form.TxtNome, this, event_val_TxtNome, 40, alphaTextController.ENABLE_NUMBERS, alphaTextController.ENABLE_SYMBOLS); ctrl_TxtEmpresa.AcquireTextBox(i_Form.TxtEmpresa, this, event_val_TxtEmpresa, 6); if (header.get_tg_user_type() == TipoUsuario.AdminGift) { ctrl_TxtEmpresa.SetTextBoxText(header.get_st_empresa()); i_Form.TxtEmpresa.ReadOnly = true; doEvent(event_BuscaDados, null); } //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_BuscaDados - case event_BuscaDados: { //InitEventCode event_BuscaDados ArrayList lst = new ArrayList(); if (header.get_tg_user_type() == TipoUsuario.SuperUser) { header.set_st_empresa(ctrl_TxtEmpresa.getTextBoxValue()); } var_exchange.fetch_extraGift(ref header, ref lst); if (header.get_tg_user_type() == TipoUsuario.SuperUser) { header.set_st_empresa("000000"); } i_Form.LstProd.Items.Clear(); for (int t = 0; t < lst.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(lst[t] as DataPortable); string [] full_row = new string [] { dpg.get_st_nome(), "R$ " + new money().formatToMoney(dpg.get_vr_valor()) }; i_Form.LstProd.Items.Add(var_util.GetListViewItem(dpg.get_id_produto(), full_row)); } //EndEventCode return(true); } #endregion #region - event_Remover - case event_Remover: { //InitEventCode event_Remover if (i_Form.LstProd.SelectedItems.Count == 0) { return(false); } if (MessageBox.Show("Confirma remoção de produto ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } var_exchange.del_extraGift(var_util.getSelectedListViewItemTag(i_Form.LstProd), ref header); doEvent(event_BuscaDados, null); //EndEventCode return(true); } #endregion #region - event_Adicionar - case event_Adicionar: { //InitEventCode event_Adicionar if (!ctrl_TxtValor.IsUserValidated && !ctrl_TxtNome.IsUserValidated) { return(false); } DadosProdutoGift prod = new DadosProdutoGift(); prod.set_st_nome(ctrl_TxtNome.getTextBoxValue()); prod.set_vr_valor(ctrl_TxtValor.getTextBoxValue_NumberStr()); var_exchange.ins_extraGift(ref prod, ref header); doEvent(event_BuscaDados, null); //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_TxtValor - case event_val_TxtValor: { //InitEventCode event_val_TxtValor if (ctrl_TxtValor.getTextBoxValue_Long() == 0) { i_Form.TxtValor.BackColor = colorInvalid; ctrl_TxtValor.IsUserValidated = false; } else { i_Form.TxtValor.BackColor = Color.White; ctrl_TxtValor.IsUserValidated = true; ctrl_TxtValor.CleanError(); } //EndEventCode return(true); } #endregion #region - event_Selecionar - case event_Selecionar: { //InitEventCode event_Selecionar if (i_Form.LstProd.SelectedItems.Count == 0) { return(false); } ctrl_TxtNome.SetTextBoxText(i_Form.LstProd.SelectedItems[0].SubItems[0].Text); ctrl_TxtValor.SetTextBoxLong(new money().getNumericValue(i_Form.LstProd.SelectedItems[0].SubItems[1].Text.Replace("R$ ", ""))); //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_BuscaDados, null); } } else { i_Form.TxtEmpresa.BackColor = colorInvalid; ctrl_TxtEmpresa.IsUserValidated = false; } break; } default: break; } //EndEventCode return(true); } #endregion #region - event_LstProdClick - case event_LstProdClick: { //InitEventCode event_LstProdClick //EndEventCode return(true); } #endregion #region - event_BtnRemoverClick - case event_BtnRemoverClick: { //InitEventCode event_BtnRemoverClick //EndEventCode return(true); } #endregion #region - event_BtnAdicionarClick - case event_BtnAdicionarClick: { //InitEventCode event_BtnAdicionarClick //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 i_Form.LblTotal.Text = "Total: R$ " + new money().formatToMoney(total.ToString()); i_Form.rbDinheiro.Checked = true; ctrl_TxtIdent.AcquireTextBox(i_Form.TxtIdent, this, event_val_TxtIdent, 20); i_Form.CboTipoCart.SelectedIndex = 0; if (recarga) { i_Form.Text = "Efetuar pagamento para recarga de cartão Gift"; } //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 (i_Form.rbCheque.Checked) { if (i_Form.TxtIdent.Text.Length == 0) { MessageBox.Show("Informe a identificação do cheque", "Aviso"); return(false); } } else if (i_Form.rbCartao.Checked) { if (i_Form.TxtIdent.Text.Length == 0) { MessageBox.Show("Informe a identificação da venda pelo cartão", "Aviso"); return(false); } if (i_Form.CboTipoCart.SelectedIndex == -1) { MessageBox.Show("Escolha o tipo de cartão", "Aviso"); return(false); } } dc.set_vr_dispTotal(carga.ToString()); string tipoPag = TipoPagamento.Dinheiro; string info = i_Form.TxtIdent.Text;; if (i_Form.rbCheque.Checked) { tipoPag = TipoPagamento.Cheque; } else if (i_Form.rbCartao.Checked) { tipoPag = TipoPagamento.Cartao; } else { info = ""; } ArrayList lst = new ArrayList(); for (int t = 0; t < lstProdsNome.Count; ++t) { DadosProdutoGift dpg = new DadosProdutoGift(); dpg.set_st_nome(lstProdsNome[t].ToString()); dpg.set_vr_valor(lstProdsValor[t].ToString()); lst.Add(dpg); } string tg_adesao = Context.TRUE; if (recarga) { tg_adesao = Context.FALSE; } var_exchange.exec_recargaGift(dc.get_st_empresa(), dc.get_st_matricula(), carga.ToString(), tipoPag, i_Form.CboTipoCart.SelectedIndex.ToString(), info, tg_adesao, ref header, ref lst, ref id_gift); if (!recarga) { if (!var_exchange.ins_cartaoProprietario("", ref dc, ref dp, ref da, ref header)) { return(false); } } IsTerm = true; bool Finish = false; while (!Finish) { PrintDocument pd = new PrintDocument(); PrintDialog pDialog = new PrintDialog(); pDialog.Document = pd; PrintPreviewDialog prevDialog = new PrintPreviewDialog(); prevDialog.Document = pd; pd.PrintPage += new PrintPageEventHandler(i_Form.Inven_Report); prevDialog.ShowDialog(); if (pDialog.ShowDialog() == DialogResult.OK) { pd.Print(); } if (MessageBox.Show("Impressão bem sucedida?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { Finish = true; } } i_Form.Close(); //EndEventCode return(true); } #endregion #region - event_FormIsClosing - case event_FormIsClosing: { //InitEventCode event_FormIsClosing if (MessageBox.Show("Confirma cancelamento de cadastro de cartão GiftCard?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { return(false); } //EndEventCode return(true); } #endregion #region - event_val_TxtIdent - case event_val_TxtIdent: { //InitEventCode event_val_TxtIdent //EndEventCode return(true); } #endregion #region - event_Print - case event_Print: { //InitEventCode event_Print ArrayList lst = new ArrayList(); var_exchange.fetch_comprov_Gift(id_gift, Context.FALSE, ref header, ref lst); PrintPageEventArgs e = arg as PrintPageEventArgs; Graphics g = e.Graphics; int n = 0; Font myFont = new Font("Courier New", 10); try { for (int t = 0; t < lst.Count; ++t) { DataPortable port = lst[t] as DataPortable; g.DrawString(port.getValue("linha"), myFont, Brushes.Black, 10, 10 + (n * 20)); ++n; } myFont.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } //EndEventCode return(true); } #endregion #region - event_BtnConfirmarClick - case event_BtnConfirmarClick: { //InitEventCode event_BtnConfirmarClick //EndEventCode return(true); } #endregion default: break; } return(false); }