public int addNewBoxStorage(BoxStorage boxstorage) { MySqlCommand sqlComm = new MySqlCommand("INSERT INTO" + " box(storingJob_id, product_id, box_id, nettWeight, storeroom_id, add_date, best_before, out_date, order_id)" + "VALUES" + "(@storingJob_id, @product_id, @box_id, @nettWeight, @storeroom_id, @add_date, @best_before, @out_date, @order_id)", MysqlDbc.Instance.getConn()); sqlComm.Parameters.Add("@storingJob_id", MySqlDbType.UInt32).Value = boxstorage.StoringJob_id; sqlComm.Parameters.Add("@product_id", MySqlDbType.UInt32).Value = boxstorage.Product_id; sqlComm.Parameters.Add("@box_id", MySqlDbType.UInt32).Value = boxstorage.Box_id; sqlComm.Parameters.Add("@nettWeight", MySqlDbType.Decimal).Value = boxstorage.NettWeight; sqlComm.Parameters.Add("@storeroom_id", MySqlDbType.UInt32).Value = boxstorage.Storeroom_id; sqlComm.Parameters.Add("@add_date", MySqlDbType.Date).Value = boxstorage.Storeroom_id; sqlComm.Parameters.Add("@best_before", MySqlDbType.Date).Value = boxstorage.Storeroom_id; sqlComm.Parameters.Add("@out_date", MySqlDbType.Date).Value = boxstorage.Storeroom_id; sqlComm.Parameters.Add("@order_id", MySqlDbType.UInt32).Value = boxstorage.Storeroom_id; return(sqlComm.ExecuteNonQuery()); }
public int updateBoxStorage(BoxStorage boxstorage) { string query = "UPDATE" + " boxstorage SET storingJob_id=@storingJob_id, product_id=@product_id, box_id=@box_id, nettWeight=@nettWeight, " + " storeroom_id=@storeroom_id, add_date=@add_date, best_before=@best_before, out_date=@out_date, order_id=@order_id " + "WHERE id = " + boxstorage.Id; MySqlCommand sqlComm = new MySqlCommand(query, MysqlDbc.Instance.getConn()); sqlComm.Parameters.Add("@storingJob_id", MySqlDbType.Text).Value = boxstorage.StoringJob_id; sqlComm.Parameters.Add("@product_id", MySqlDbType.UInt32).Value = boxstorage.Product_id; sqlComm.Parameters.Add("@box_id", MySqlDbType.UInt32).Value = boxstorage.Box_id; sqlComm.Parameters.Add("@nettWeight", MySqlDbType.Decimal).Value = boxstorage.NettWeight; sqlComm.Parameters.Add("@storeroom_id", MySqlDbType.UInt32).Value = boxstorage.Storeroom_id; sqlComm.Parameters.Add("@add_date", MySqlDbType.Date).Value = boxstorage.Add_date; sqlComm.Parameters.Add("@best_before", MySqlDbType.Date).Value = boxstorage.Best_before; sqlComm.Parameters.Add("@out_date", MySqlDbType.Date).Value = boxstorage.Out_date; sqlComm.Parameters.Add("@order_id", MySqlDbType.UInt32).Value = boxstorage.Order_id; return(sqlComm.ExecuteNonQuery()); }