public void LoadVesselsSizes() { try { int cont = 0; d = SQL.Query(SQL.GetVesselSizes).ExecuteReader(); while (d.Read()) { cont++; } SQL.command.Connection.Close(); TotalVesselSizes = cont; VesselSizes = new VesselSizes[TotalVesselSizes]; cont = 0; d = SQL.Query(SQL.GetVesselSizes).ExecuteReader(); while (d.Read()) { VesselSize = new VesselSizes(Convert.ToInt16(d["Generation"]), Convert.ToInt16(d["Year"]), Convert.ToInt16(d["TEU"]), Convert.ToInt16(d["LOA"]), Convert.ToInt16(d["BOA"]), Convert.ToInt16(d["Draft"])); VesselSizes[cont] = VesselSize; 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); }