예제 #1
0
 //Verifica Atraso
 public bool EmAtraso(Locacao loc, string conString)
 {
     try
     {
         using (Conexao c = new Conexao(conString))
         {
             c.Query($"Select count(*) From Locacao Where Id = {loc.Id} And Status = 0 And Convert(Date,DtDevolucao,120) < convert(date,getdate(),120)");
             return(G1.GetInt(c.DtSql().Rows[0][0]) > 0);
         }
     }
     catch (Exception e)
     {
         throw
             new Exception("Erro Locação em Atraso\n" + e.Message);
     }
 }
예제 #2
0
 public int InsertReturnId(string nomeDoMetodo = null)
 {
     try
     {
         query.Append(";Select SCOPE_IDENTITY()");
         Cmd.CommandText = Convert.ToString(query);
         SqlDataAdapter sqlAdapter = new SqlDataAdapter(Cmd);
         DataTable      d          = new DataTable();
         d.BeginLoadData();
         sqlAdapter.Fill(d);
         d.EndLoadData();
         Cmd.CommandText = null;
         query.Clear();
         return(G1.GetInt(d.Rows[0][0]));
     }
     catch (Exception e)
     {
         Cmd.CommandText = null;
         query           = null;
         throw new Exception(nomeDoMetodo + " - " + e.Message, e.InnerException);
     }
 }