Exemple #1
0
 public bool valida_login(cUsuario user)
 {
     try
     {
         #region QUERY
         cGlobal.query = "SELECT TB1.LOGIN, TB2.SETOR FROM USUARIO_TB TB1, SETOR_TB TB2 " +
                         "WHERE TB2.ID_SETOR = TB1.ID_SETOR " +
                         "AND TB1.LOGIN = '******' " +
                         "AND TB1.PWD = '" + user.senha + "' ";
         using (DataTable dt = dao.retorna_datatable(cGlobal.query))
         {
             if (dt.Rows.Count == 0)
             {
                 return(false);
             }
             else
             {
                 cGlobal.userlogado = (dt.Rows[0]).ItemArray[0].ToString();
                 cGlobal.userSetor  = (dt.Rows[0]).ItemArray[1].ToString();
                 return(true);
             }
         }
         #endregion
     }
     catch (OleDbException ex)
     {
         throw ex;
     }
 }
Exemple #2
0
 public DataTable preenche_lista_setor()
 {
     try
     {
         #region QUERY
         cGlobal.query = "SELECT * FROM SETOR_TB WHERE ID_SETOR <> 1 ORDER BY ID_SETOR DESC";
         using (DataTable dt = dao.retorna_datatable(cGlobal.query))
         {
             return(dt);
         }
         #endregion
     }
     catch (OleDbException ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public DataTable preenche_lista_fundo()
 {
     try
     {
         #region QUERY
         cGlobal.query = "SELECT * FROM FUNDO_TB ";
         using (DataTable dt = dao.retorna_datatable(cGlobal.query, "cnn"))
         {
             return(dt);
         }
         #endregion
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public DataTable conexoes()
 {
     try
     {
         #region QUERY
         cDAO dao = new cDAO();
         cGlobal.query = "SELECT * FROM CONEXAO_TB ";
         using (DataTable dt = dao.retorna_datatable(cGlobal.query))
         {
             return(dt);
         }
         #endregion
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #5
0
 public DataTable arquivos(string campos)
 {
     try
     {
         #region QUERY
         cDAO dao = new cDAO();
         cGlobal.query = string.Format("SELECT {0} FROM DIRETORIO_TB WHERE ID_SETOR = {1}", campos, cGlobal.userSetor);
         using (DataTable dt = dao.retorna_datatable(cGlobal.query, "cnn"))
         {
             return(dt);
         }
         #endregion
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public DataTable diretorios(cConfiguracao cf)
        {
            try
            {
                #region QUERY
                cDAO dao = new cDAO();
                if (cf.setor.Equals("PROCESSAMENTO"))
                {
                    cGlobal.query = "SELECT SAC,DI8 FROM DIRETORIO_TB " +
                                    "INNER JOIN SETOR_TB ON SETOR_TB.ID_SETOR = DIRETORIO_TB.ID_SETOR " +
                                    "WHERE SETOR_TB.SETOR = '" + cf.setor + "' ";
                }

                using (DataTable dt = dao.retorna_datatable(cGlobal.query))
                {
                    return(dt);
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }