Exemplo n.º 1
0
    public void PegaDataAtual(String pXml, Boolean lAprov)
    {
        // Conexao Conn = new Conexao(pXml);
        String Qry = "EXEC GN_dataatual_ret ";

        DS = new DataSet();
        SqlCommand     Command = new SqlCommand(Qry, DM.ConexaoSessao);
        SqlDataAdapter DA      = new SqlDataAdapter();

        DA.TableMappings.Add("Table", "dataatual");
        DA.SelectCommand = Command;
        DA.Fill(DS);
        DataTable DT;

        DT = DS.Tables["dataatual"];
        DataRow  DR  = DT.Rows[0];
        DateTime dt1 = Convert.ToDateTime(DR["dataatual"]);

        DataAtual = String.Format("{0:dd/MM/yyyy}", dt1);
        if (lAprov)
        {
            if (dt1 < Convert.ToDateTime(Srelib.DataHojeMais(0)))
            {
                DataAtual = String.Format("{0:dd/MM/yyyy}", Srelib.DataHojeMais(0));
            }
        }

        // Conn.SqlConn.Close();
        DS.Dispose();
    }