Ejemplo n.º 1
0
        public void AddCompanies(string companynamein)
        {
            using (var db = new InsertClass())
            {
                db.OpenConnection();
                db.CreateCommand("INSERT INTO Company(id,Maincompany_ID,Name) VALUES (@id,@maincompany,@name)");
                db.AddParameter("@name", companynamein);
                db.AddParameter("@id", "");
                db.AddParameter("@maincompany", "");

                db.Command.ExecuteNonQuery();
            }
        }
Ejemplo n.º 2
0
        public void AddContainer(string containertype,string weight, string companyname,string port,string ship)
        {
            using (var db = new InsertClass())
            {
                db.OpenConnection();
                db.CreateCommand("INSERT INTO CONTAINER (id, Company_ID, GPS_ID,Ship_ID,Port_ID,Weight,Type,transported)SELECT @id AS id, company.id, 1 AS GPS_ID, ship.id,port.id, @weight AS Weight, @type As type, 0 as transported FROM Company,Port,Ship WHERE Company.name = @companyname AND Port.Name = @port AND Ship.Type = @ship");
                //WITHOUT SHIP db.CreateCommand("INSERT INTO CONTAINER (id, Company_ID, GPS_ID,Ship_ID,Port_ID,Weight,Type,transported)SELECT @id AS id, company.id, 1 AS GPS_ID, 1 AS Ship_ID,port.id, @weight AS Weight, @type As type, 0 as transported FROM Company,Port,Ship WHERE Company.name = @companyname AND Port.Name = @port");
                db.AddParameter("@id", "");
                db.AddParameter("@type", containertype);
                db.AddParameter("@ship", ship);
                db.AddParameter("@port", port);
                db.AddParameter("@weight", weight);
                db.AddParameter("@companyname", companyname);

                db.Command.ExecuteNonQuery();
            }
        }