public override void OnAfterMatrixLinkPressed(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)
        {
            base.OnAfterMatrixLinkPressed(FormUID, ref pVal, out BubbleEvent);

            if (pVal.ColUID == _matrizContratosFinais.CodigoContrato.ItemUID)
            {
                var mtx    = GetMatrix(FormUID, _matrizContratosFinais.ItemUID);
                var codigo = mtx.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.Value;

                FormContratoFinal.AbrirNoRegistro(codigo);
            }
        }
Ejemplo n.º 2
0
        public override void OnBeforeItemPressed(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)
        {
            base.OnAfterItemPressed(FormUID, ref pVal, out BubbleEvent);

            if (pVal.ItemUID == "B_DocNumCF")
            {
                using (var formCOM = new FormCOM(FormUID))
                {
                    var form = formCOM.Form;
                    using (var dbdtsCOM = new DBDatasourceCOM(form, mainDbDataSource))
                    {
                        BubbleEvent = false;
                        var dbdts  = dbdtsCOM.Dbdts;
                        var codigo = dbdts.GetValue("U_DocNumCF", 0).Trim();
                        FormContratoFinal.AbrirNoRegistro(codigo);
                    }
                }
            }
        }
 public override void OnAfterItemPressed(string FormUID, ref ItemEvent pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     if (pVal.ItemUID == _botaoAdicionar.ItemUID)
     {
         using (var formCOM = new FormCOM(FormUID))
         {
             var form = formCOM.Form;
             if (form.Mode == BoFormMode.fm_OK_MODE)
             {
                 FormContratoFinal.AbrirCriandoNovoRegistro(FormUID);
             }
             else
             {
                 Dialogs.PopupError("Salve o Contrato antes de criar um novo Contrato Final.");
             }
         }
     }
     else
     {
         base.OnAfterItemPressed(FormUID, ref pVal, out BubbleEvent);
     }
 }
        private static void DeclararEventos()
        {
            var eventFilters = new EventFilters();

            eventFilters.Add(BoEventTypes.et_MENU_CLICK);

            try
            {
                #region :: Forms Cadastro Básico

                var formGrupoDeItens        = new FormGrupoDeItens();
                var formConfiguracaoPeneira = new FormConfiguracaoPeneira();
                var formCertificado         = new FormCertificado();
                var formMetodoFinanceiro    = new FormMetodoFinanceiro();
                var formModalidade          = new FormModalidade();
                var formSafra            = new FormSafra();
                var formTipoOperacao     = new FormTipoOperacao();
                var formUnidadeComercial = new FormUnidadeComercial();
                var formParticipante     = new FormParticipante();

                var formsCadastroBasico = new List <SAPHelper.Form>()
                {
                    formGrupoDeItens,
                    formConfiguracaoPeneira,
                    formCertificado,
                    formMetodoFinanceiro,
                    formModalidade,
                    formSafra,
                    formTipoOperacao,
                    formUnidadeComercial,
                    formParticipante
                };

                #endregion


                #region :: Forms Detalhe de Contrato

                var formPreContrato   = new FormPreContrato();
                var formContratoFinal = new FormContratoFinal();

                var formPreContratoAberturaPorPeneira   = new FormPreContratoAberturaPorPeneira();
                var formContratoFinalAberturaPorPeneira = new FormContratoFinalAberturaPorPeneira();

                var formPreContratoDetalheCertificado   = new FormPreContratoDetalheCertificado();
                var formContratoFinalDetalheCertificado = new FormContratoFinalDetalheCertificado();

                var formPreContratoComissoes   = new FormPreContratoComissoes();
                var formContratoFinalComissoes = new FormContratoFinalComissoes();

                var formsDetalheContrato = new List <SAPHelper.Form>()
                {
                    formPreContratoAberturaPorPeneira,
                    formContratoFinalAberturaPorPeneira,

                    formPreContratoDetalheCertificado,
                    formContratoFinalDetalheCertificado,

                    formPreContratoComissoes,
                    formContratoFinalComissoes
                };

                #endregion


                #region :: Form SAP
                var formUsuarios     = new FormUsuarios();
                var formPedidoCompra = new FormPedidoCompra();

                var formsPadraoSAP = new List <SAPHelper.Form>()
                {
                    formUsuarios,
                    formPedidoCompra
                };

                #endregion


                #region :: Grupos de Forms

                var formsVisible = new List <SAPHelper.Form>()
                {
                    formPreContrato, formContratoFinal
                };
                formsVisible.AddRange(formsCadastroBasico);
                formsVisible.AddRange(formsDetalheContrato);

                #endregion


                FormEvents.DeclararEventos(eventFilters, new List <MapEventsToForms>()
                {
                    new MapEventsToForms(BoEventTypes.et_FORM_VISIBLE, formsVisible),
                    new MapEventsToForms(BoEventTypes.et_FORM_LOAD, formsPadraoSAP),
                    new MapEventsToForms(BoEventTypes.et_COMBO_SELECT, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal,
                        formPreContratoComissoes,
                        formContratoFinalComissoes
                    }),
                    new MapEventsToForms(BoEventTypes.et_VALIDATE, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal
                    }),
                    new MapEventsToForms(BoEventTypes.et_CHOOSE_FROM_LIST, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formPreContratoAberturaPorPeneira,
                        formContratoFinal,
                        formContratoFinalAberturaPorPeneira
                    }),
                    new MapEventsToForms(BoEventTypes.et_FORM_DATA_ADD, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal,
                        formCertificado,
                        formMetodoFinanceiro,
                        formModalidade,
                        formSafra,
                        formTipoOperacao,
                        formUnidadeComercial,
                        formParticipante
                    }),
                    new MapEventsToForms(BoEventTypes.et_FORM_DATA_UPDATE, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal,
                        formCertificado,
                        formMetodoFinanceiro,
                        formModalidade,
                        formSafra,
                        formTipoOperacao,
                        formUnidadeComercial,
                        formParticipante
                    }),
                    new MapEventsToForms(BoEventTypes.et_FORM_DATA_LOAD, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal
                    }),
                    new MapEventsToForms(BoEventTypes.et_FORM_CLOSE, new List <SAPHelper.Form>()
                    {
                        formPreContratoDetalheCertificado,
                        formPreContratoComissoes,
                        formContratoFinalDetalheCertificado,
                        formContratoFinalComissoes,
                        formContratoFinal
                    }),
                    new MapEventsToForms(BoEventTypes.et_ITEM_PRESSED, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal,
                        formPreContratoAberturaPorPeneira,
                        formPreContratoDetalheCertificado,
                        formPreContratoComissoes,
                        formContratoFinalAberturaPorPeneira,
                        formContratoFinalDetalheCertificado,
                        formContratoFinalComissoes,
                        formGrupoDeItens,
                        formConfiguracaoPeneira,
                        formPedidoCompra
                    }),
                    new MapEventsToForms(BoEventTypes.et_MATRIX_LINK_PRESSED, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal
                    }),
                    new MapEventsToForms(BoEventTypes.et_DOUBLE_CLICK, new List <SAPHelper.Form>()
                    {
                        formPreContrato,
                        formContratoFinal
                    }),
                });

                var formsAdicionarNovo = new List <SAPHelper.Form>()
                {
                    formPreContrato, formContratoFinal
                };
                formsAdicionarNovo.AddRange(formsCadastroBasico);

                FormEvents.DeclararEventosInternos(EventosInternos.AdicionarNovo, formsAdicionarNovo);
                FormEvents.DeclararEventosInternos(EventosInternos.Pesquisar, new List <SAPHelper.Form>()
                {
                    formPreContrato,
                    formContratoFinal
                });
                FormEvents.DeclararEventosInternos(EventosInternos.Duplicar, formPedidoCompra);
            }
            catch (Exception e)
            {
                Dialogs.PopupError("Erro ao declarar eventos de formulário.\nErro: " + e.Message);
            }

            try
            {
                Global.SBOApplication.SetFilter(eventFilters);
            }
            catch (Exception e)
            {
                Dialogs.PopupError("Erro ao setar eventos declarados da aplicação.\nErro: " + e.Message);
            }

            Global.SBOApplication.AppEvent      += AppEvent;
            Global.SBOApplication.ItemEvent     += FormEvents.ItemEvent;
            Global.SBOApplication.FormDataEvent += FormEvents.FormDataEvent;
            Global.SBOApplication.MenuEvent     += Menu.MenuEvent;
        }