Пример #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));
        }
Пример #2
0
        // edit the selected sale
        public bool updateSale(SALE sale)
        {
            MySqlCommand command = new MySqlCommand("UPDATE `sale` SET `property_id`=@pid,`selling_price`=@slprice,`sale_date`=@sldate WHERE `id`=@id");

            //@id,@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;
            command.Parameters.Add("@id", MySqlDbType.Int32).Value      = sale.id;

            return(func.ExecQuery(command));
        }