Esempio n. 1
0
 private Ship InflateShip(IDataReader dr)
 {
     var ship = new Ship();
     this.PopulateCoreFields(ship, dr);
     return ship;
 }
Esempio n. 2
0
 private void PopulateCoreFields(Ship ship, IDataReader dr)
 {
     ship.ShipID = dr.GetInt32("ShipID");
     ship.UserAccountID = dr.GetInt32("UserAccountID");
     ship.Name = dr.GetString("Name");
     ship.IsSelected = dr.GetBoolean("IsSelected");
     ship.SolarSystemID = dr.GetNullableInt64("SolarSystemID");
     ship.JobID = dr.GetNullableInt64("JobID");
 }
Esempio n. 3
0
        public void Save(Ship ship)
        {
            if (ship == null) throw new ArgumentNullException("ship");

            using (var cmd = this.SessionManager.GetCurrentUnitOfWork().CreateCommand("UPDATE Ships SET Name = @Name, IsSelected = @IsSelected WHERE ShipID = @ID"))
            {
                cmd.AddParameter("ID", DbType.Int32, ship.ShipID);
                cmd.AddParameter("Name", DbType.String, ship.Name);
                cmd.AddParameter("IsSelected", DbType.Boolean, ship.IsSelected);

                cmd.ExecuteNonQuery();
            }
        }