Пример #1
0
        private void arkRoyalToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            int weight = 0;
            string str = "";
            string sql = "SELECT * FROM Ships WHERE ID = 1";

            OleDbCommand command = new OleDbCommand(sql, connection);
            OleDbDataReader dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Weight"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
             //   listShips.Items.Add(str);
            }
            weight = int.Parse(str) / 2;
            dataReader.Close();
            str = null;
            sql = "SELECT * FROM Loading WHERE ShipID = 1";
            command = new OleDbCommand(sql, connection);
            dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Quantity"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
                //   listShips.Items.Add(str);
            }
            dataReader.Close();
            if (str != null)
            {
                weight = weight - int.Parse(str);
            }

            Cargo c = new Cargo(weight, 1, connection);
            c.Show();
            c.Activate();
        }
Пример #2
0
        private void bataviaToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            int weight = 0;
            string str = "";
            string sql = "SELECT * FROM Ships WHERE ID = 2";

            OleDbCommand command = new OleDbCommand(sql, connection);
            OleDbDataReader dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                str = dataReader["Weight"].ToString();
                // listShips.Items.Add(dataReader["ShipName"]);
                //   listShips.Items.Add(str);
            }
            weight = int.Parse(str) / 2;
            dataReader.Close();

            Cargo c = new Cargo(weight, 2, connection);
            c.Show();
            c.Activate();
        }