public void LoadShips() { try { DateTime Today = DateTime.Now; Today = Convert.ToDateTime("01/01/1900 00:00:01"); int cont = 0; d = SQL.Query(SQL.GetShips).ExecuteReader(); while (d.Read()) { cont++; } SQL.command.Connection.Close(); TotalShips = cont; Ships = new POPDemanding[TotalShips]; cont = 0; d = SQL.Query(SQL.GetShips).ExecuteReader(); while (d.Read()) { LoadShip = new POPDemanding(Convert.ToInt16(d["IDVessel"]), d["ShipName"].ToString().Trim(), d["IMO"].ToString().Trim(), Convert.ToInt16(d["VesselTypeID"]), 0, Convert.ToInt16(d["Units"]), 0, Convert.ToDouble(d["LOA"]), Convert.ToDouble(d["BOA"]), 0, 0, 0, 0, 0); Ships[cont] = LoadShip; cont++; } SQL.command.Connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message + " / " + ex.ToString()); } }
public VesselSizes GetVesselSizesForVesselID(int VesselID) { VesselSizes V = VesselSizes[0]; POPDemanding P = GetShipIndexByVesselID(VesselID); foreach (VesselSizes Vs in VesselSizes) { if ((P.LOA1 <= Vs.LOA1) && (P.BOA1 <= Vs.BOA1)) { V = Vs; break; } } return(V); }