Exemple #1
0
        } // MONTA A QUERY A PARTIR DOS CONTROLES NA TELA.

        private void replaceRecursiveTables(StringBuilder inQuery, Table mainTB, SigaObjects.Session.Empresa.EmpresaVo empresa)
        {
            foreach (Table childTB in mainTB.CHILDREN)
            {
                replaceTableEmpresa(inQuery, childTB.TABLE, empresa);
                replaceRecursiveTables(inQuery, childTB, empresa);
            }
        }
Exemple #2
0
        public void   generateShowFieldsAndGroupBy(SigaObjects.Session.Empresa.EmpresaVo empresa)
        {
            this.showFields    = new List <string>();
            this.fieldsname    = new List <string>();
            this.fieldsheaders = new List <string>();
            this.fieldsunion   = new List <string>(); // AGRUPAMENTO DO UNION
            this.groupFields   = new List <string>();

            this._togrid = new List <string[]>();      // CAMPOS NO GRID

            foreach (DataGridViewRow drw in dgvFields.Rows)
            {
                if ((drw.Cells[0] as DataGridViewCheckBoxCell).Value.ToString() == true.ToString())
                {
                    string show = "*";

                    show = drw.Cells[3].Value.ToString();

                    string field = //"@"+this.MAIN.TABLE+"@"
                                   this.MAIN.TABLE + this.MAIN.SUFIXO
                                   + "."
                                   + (string)drw.Cells[1].Value;

                    if (show == "*" || show == null || show == "")
                    {
                        this.groupFields.Add(field);
                        this.fieldsunion.Add((string)drw.Cells[2].Value);
                        show = "*";
                    }
                    else
                    {
                        this.haveGroup = true;
                    }

                    this.fieldsname.Add(field);
                    this.fieldsheaders.Add((string)drw.Cells[2].Value);

                    string filtro = SXManager.FieldValueMember
                                    + " = '" + (string)drw.Cells[1].Value + "'";

                    if (new SXManager(sigaSession.EMPRESAS[0].CODIGO)
                        .getFields(this.MAIN.TABLE
                                   , filtro
                                   , SXManager.FieldDisplayMember).DefaultView[0]["X3_TIPO"].ToString() == "D")
                    {
                        showFields.Add("CONVERT(VARCHAR(12),CONVERT(DATETIME," + field + ",103),103) " + (string)drw.Cells[1].Value);/*
                                                                                                                                      + " [ "
                                                                                                                                      + (string)drw.Cells[2].Value
                                                                                                                                      + " ] ");//*/
                    }
                    else
                    {
                        showFields.Add(show.Replace("*", field) + " " + (string)drw.Cells[1].Value);/*
                                                                                                     + " [ "
                                                                                                     + (string)drw.Cells[4].Value
                                                                                                     + " "
                                                                                                     + (string)drw.Cells[2].Value
                                                                                                     + " ]");//*/
                    }
                    /// LISTA CAMPOS E SEUS NOMES PRA EXIBIÇÃO NOS CONTROLES DE TELA
                    this._togrid.Add(new string[] { (string)drw.Cells[1].Value
                                                    , (string)drw.Cells[2].Value });
                }
            }
        }
Exemple #3
0
 private void replaceTableEmpresa(StringBuilder inQuery, string table, SigaObjects.Session.Empresa.EmpresaVo empresa)
 {
     inQuery = inQuery.Replace("@" + table + "@"
                               , new SXManager(empresa.CODIGO).getTabela(table)["X2_ARQUIVO"].ToString());
 }