コード例 #1
0
    private Driver getDriver(int id)
    {
        using (ISession session = NHibernateTMSSession.openSession())
        {
            try
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    var driver = session.QueryOver <Driver>().Where(x => x.id == id).List().ToList().First();
                    //response.driver = driver;

                    /*var vehicle = session.QueryOver<Vehicle>().Where(x => x.alias.Equals(alias)).SingleOrDefault();
                     * response.vehicle = vehicle;*/
                    return(driver);
                }
                // getSumaDeDiferencias(dreams);
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.ToString());
                return(null);
                //errorLog.Error("Error:\n" + e);
            }
            finally
            {
                session.Close();
            }
        }
    }
コード例 #2
0
 private Performance getVehiclePerformance(Vehicle vehicle)
 {
     using (ISession session = NHibernateTMSSession.openSession())
     {
         try
         {
             using (ITransaction transaction = session.BeginTransaction())
             {
                 var performance = session.QueryOver <Performance>().Where(x => x.Id == vehicle.Performance_Type).List().ToList().First();
                 return(performance);
             }
             // getSumaDeDiferencias(dreams);
         }
         catch (Exception e)
         {
             System.Console.WriteLine(e.ToString());
             return(null);
             //errorLog.Error("Error:\n" + e);
         }
         finally
         {
             session.Close();
         }
     }
 }
コード例 #3
0
 private Vehicle getInfoUnidad(String alias)
 {
     using (ISession session = NHibernateTMSSession.openSession())
     {
         try
         {
             using (ITransaction transaction = session.BeginTransaction())
             {
                 var vehicle = session.QueryOver <Vehicle>().Where(x => x.alias == alias).List().ToList().First();
                 return(vehicle);
             }
             // getSumaDeDiferencias(dreams);
         }
         catch (Exception e)
         {
             System.Console.WriteLine(e.ToString());
             return(null);
             //errorLog.Error("Error:\n" + e);
         }
         finally
         {
             session.Close();
         }
     }
 }
コード例 #4
0
 public static Shipment GetShipment(String solicitud)
 {
     using (ISession session = NHibernateTMSSession.openSession())
     {
         try
         {
             using (ITransaction transaction = session.BeginTransaction())
             {
                 var shipment = session.QueryOver <Shipment>().Where(x => x.External_Id == solicitud).List().ToList().First();
                 return(shipment);
             }
             // getSumaDeDiferencias(dreams);
         }
         catch (Exception e)
         {
             System.Console.WriteLine(e.ToString());
             return(null);
             //errorLog.Error("Error:\n" + e);
         }
         finally
         {
             session.Close();
         }
     }
 }