예제 #1
0
        // insert a sale
        public bool insertSale(SALE sale)
        {
            MySqlCommand command = new MySqlCommand("INSERT INTO `sale`(`property_id`,`selling_price`, `sale_date`) VALUES (@pid,@slprice,@sldate)");

            // @pid,@clid,@slprice,@sldate
            command.Parameters.Add("@pid", MySqlDbType.Int32).Value     = sale.propertyid;
            command.Parameters.Add("@slprice", MySqlDbType.Int32).Value = sale.sellingprice;
            command.Parameters.Add("@sldate", MySqlDbType.Date).Value   = sale.sellingdate;

            return(func.ExecQuery(command));
        }
        // insert a new property
        public Boolean insertProperty(THE_PROPERTY property)
        {
            MySqlCommand command = new MySqlCommand("INSERT INTO `the_property`(`type`, `square_feet`, `price`, `address`, `bedrooms`, `bathrooms`, `age`, `balcony`, `backyard`, `pool`, `garage`, `fireplace`, `comment`) VALUES (@tp,@size,@price,@adrs,@bedr,@bathr,@age,@balc,@backy,@pool,@grg,@fire,@cmnt)");

            // (@tp,@size,@owner,@price,@adrs,@bedr,@bathr,@age,@balc,@backy,@pool,@grg,@fire,@cmnt)
            //  command.Parameters.Add("@tp", MySqlDbType.Int32).Value = property.id;
            command.Parameters.Add("@tp", MySqlDbType.Int32).Value     = property.type;
            command.Parameters.Add("@size", MySqlDbType.VarChar).Value = property.size;
            // command.Parameters.Add("@owner", MySqlDbType.Int32).Value = property.ownerId;
            command.Parameters.Add("@price", MySqlDbType.VarChar).Value = property.price;
            command.Parameters.Add("@adrs", MySqlDbType.VarChar).Value  = property.address;
            command.Parameters.Add("@bedr", MySqlDbType.Int32).Value    = property.bedrooms;
            command.Parameters.Add("@bathr", MySqlDbType.Int32).Value   = property.bathrooms;
            command.Parameters.Add("@age", MySqlDbType.Int32).Value     = property.age;
            command.Parameters.AddWithValue("@balc", property.balcony);
            command.Parameters.AddWithValue("@backy", property.backyard);
            command.Parameters.AddWithValue("@pool", property.pool);
            command.Parameters.AddWithValue("@grg", property.garage);
            command.Parameters.AddWithValue("@fire", property.fireplace);
            command.Parameters.Add("@cmnt", MySqlDbType.VarChar).Value = property.comment;

            return(func.ExecQuery(command));
        }