コード例 #1
0
        private void BB_Remover_Click(object sender, EventArgs e)
        {
            if (treeConsulta.SelectedNode != null)
            {
                try
                {
                    TreeNode no = treeConsulta.SelectedNode;

                    if (!((BS_Relatorio.Current as TRegistro_Cad_Report).lConsulta.Exists(p => p.ID_Consulta == no.Name.Trim())))
                    {
                        throw new Exception("Não existe esta consulta adicionado no relatório!");
                    }
                    else
                    {
                        TRegistro_Cad_Consulta RegConsulta = BuscaConsulta(no.Name.Trim());
                        TreeNode noMenu = new TreeNode(RegConsulta.DS_Consulta.Trim());
                        noMenu.Name       = RegConsulta.ID_Consulta.ToString().Trim();
                        noMenu.ImageIndex = 0;

                        treeConsulta.Nodes.RemoveByKey(noMenu.Name);

                        (BS_Relatorio.Current as TRegistro_Cad_Report).lConsulta.Remove(RegConsulta);
                        BS_Relatorio.ResetBindings(true);

                        AtualizaTreeConsulta();
                    }
                }
                catch (Exception erro)
                {
                    MessageBox.Show("ERRO: " + erro.Message, "Mensagem");
                }
            }
        }
コード例 #2
0
        private void tsBB_AddConsulta_Click(object sender, EventArgs e)
        {
            try
            {
                TFCad_SQL fSQL = new TFCad_SQL(new TRegistro_Cad_Consulta(), true);
                fSQL.Homologacao         = true;
                fSQL.pNMConsulta.Visible = true;
                fSQL.ShowDialog();

                if (!string.IsNullOrEmpty(fSQL.Cad_Consulta.DS_SQL))
                {
                    //ADD OS DADOS QUE FALTA
                    fSQL.Cad_Consulta.DS_Consulta = fSQL.NM_Consulta.Text;
                    fSQL.Cad_Consulta.ID_Consulta = System.Guid.NewGuid().ToString();
                    fSQL.Cad_Consulta.Login       = Utils.Parametros.pubLogin;

                    //ADD AO BIND
                    lConsulta.Add(fSQL.Cad_Consulta);
                    (BS_Relatorio.Current as TRegistro_Cad_Report).lConsulta.Add(fSQL.Cad_Consulta);
                    BS_Relatorio.ResetBindings(true);
                }
            }
            catch (Exception erro)
            {
                MessageBox.Show("ERRO: " + erro.Message, "Mensagem");
            }
        }
コード例 #3
0
        private void bbEditReport_Click(object sender, EventArgs e)
        {
            Type t = null;

            if (BIntelegence)
            {
                t = Application.OpenForms["TFBInteligence"].GetType();
                t.GetMethod("DefineDadosConexao").Invoke(Application.OpenForms["TFBInteligence"], new object[] { "N" });
            }

            Query_Report relatorio = new Query_Report();

            relatorio.Homologacao = true;
            relatorio.vEditor     = true;
            if (BIntelegence)
            {
                relatorio.vBIntelligence = true;
            }
            relatorio.vURLWebService = URLWebService;
            relatorio.vSistema       = "AL";
            relatorio.MontaFormRelatorio((BS_Relatorio.Current as TRegistro_Cad_Report), null);

            (BS_Relatorio.Current as TRegistro_Cad_Report).Code_Report   = relatorio.Cad_Report.Code_Report;
            (BS_Relatorio.Current as TRegistro_Cad_Report).Code_Chart    = relatorio.Cad_Report.Code_Chart;
            (BS_Relatorio.Current as TRegistro_Cad_Report).Code_DataCube = relatorio.Cad_Report.Code_DataCube;
            BS_Relatorio.ResetBindings(true);
            if (BIntelegence)
            {
                t.GetMethod("DefineDadosConexao").Invoke(Application.OpenForms["TFBInteligence"], new object[] { "C" });
            }
        }
コード例 #4
0
        private void tsBB_EditarConsulta_Click(object sender, EventArgs e)
        {
            TRegistro_Cad_Consulta Reg_Consulta = null;

            if (treeConsulta.Focused && treeConsulta.SelectedNode != null)
            {
                Reg_Consulta = BuscaConsulta(treeConsulta.SelectedNode.Name);
            }
            else if (treeConsultaBusca.Focused && treeConsultaBusca.SelectedNode != null)
            {
                Reg_Consulta = BuscaConsulta(treeConsultaBusca.SelectedNode.Name);
            }

            if (Reg_Consulta != null)
            {
                try
                {
                    TFCad_SQL fSQL = new TFCad_SQL(Reg_Consulta, true);
                    fSQL.Homologacao         = true;
                    fSQL.pNMConsulta.Visible = true;
                    fSQL.NM_Consulta.Text    = Reg_Consulta.DS_Consulta;
                    fSQL.ShowDialog();

                    if (fSQL.Cad_Consulta.DS_SQL != "")
                    {
                        //ADD OS DADOS QUE FALTA
                        Reg_Consulta.DS_Consulta = fSQL.NM_Consulta.Text;
                        Reg_Consulta.DS_SQL      = fSQL.DS_SQL.Text;

                        //ADD AO BIND
                        if (lConsulta.Exists(p => p.ID_Consulta == Reg_Consulta.ID_Consulta))
                        {
                            lConsulta.Remove(Reg_Consulta);
                            lConsulta.Add(Reg_Consulta);

                            TCN_Cad_Consulta.GravaConsulta(Reg_Consulta, null);
                        }
                        else
                        {
                            (BS_Relatorio.Current as TRegistro_Cad_Report).lConsulta.Remove(Reg_Consulta);
                            (BS_Relatorio.Current as TRegistro_Cad_Report).lConsulta.Add(Reg_Consulta);
                            BS_Relatorio.ResetBindings(true);
                        }

                        AtualizaTreeConsulta();
                    }
                }
                catch (Exception erro)
                {
                    MessageBox.Show("ERRO: " + erro.Message, "Mensagem");
                }
            }
        }