public int addNewStoringJob(StoringJob storingjob) { MySqlCommand sqlComm = new MySqlCommand("INSERT INTO" + " storingjob(description, harvest_id, crop_id, box_id, quantity, vehicle_id, employee_id, date_start, date_end)" + "VALUES" + "(@description, @harvest_id, @crop_id, @box_id, @quantity, @vehicle_id, @employee_id, @date_start, @date_end)", MysqlDbc.Instance.getConn()); sqlComm.Parameters.Add("@description", MySqlDbType.Text).Value = storingjob.Description; sqlComm.Parameters.Add("@harvest_id", MySqlDbType.UInt32).Value = storingjob.Harvest_id; sqlComm.Parameters.Add("@crop_id", MySqlDbType.UInt32).Value = storingjob.Crop_id; sqlComm.Parameters.Add("@box_id", MySqlDbType.UInt32).Value = storingjob.Box_id; sqlComm.Parameters.Add("@quantity", MySqlDbType.UInt32).Value = storingjob.Quantity; sqlComm.Parameters.Add("@vehicle_id", MySqlDbType.UInt32).Value = storingjob.Vehicle_id; sqlComm.Parameters.Add("@employee_id", MySqlDbType.UInt32).Value = storingjob.Employee_id; sqlComm.Parameters.Add("@date_start", MySqlDbType.Date).Value = storingjob.Date_start; sqlComm.Parameters.Add("@date_end", MySqlDbType.Date).Value = storingjob.Date_end; return(sqlComm.ExecuteNonQuery()); }
public int updateStoringJob(StoringJob storingjob) { string query = "UPDATE" + " storingjob SET description=@description, harvest_id=@harvest_id, crop_id=@crop_id," + " box_id=@box_id, quantity=@quantity, vehicle_id=@vehicle_id, employee_id=@employee_id," + " date_start=@date_start, date_end=@date_end " + "WHERE id = " + storingjob.Id; MySqlCommand sqlComm = new MySqlCommand(query, MysqlDbc.Instance.getConn()); sqlComm.Parameters.Add("@description", MySqlDbType.Text).Value = storingjob.Description; sqlComm.Parameters.Add("@harvest_id", MySqlDbType.UInt32).Value = storingjob.Harvest_id; sqlComm.Parameters.Add("@crop_id", MySqlDbType.UInt32).Value = storingjob.Crop_id; sqlComm.Parameters.Add("@box_id", MySqlDbType.UInt32).Value = storingjob.Box_id; sqlComm.Parameters.Add("@quantity", MySqlDbType.UInt32).Value = storingjob.Quantity; sqlComm.Parameters.Add("@vehicle_id", MySqlDbType.UInt32).Value = storingjob.Vehicle_id; sqlComm.Parameters.Add("@employee_id", MySqlDbType.UInt32).Value = storingjob.Employee_id; sqlComm.Parameters.Add("@date_start", MySqlDbType.Date).Value = storingjob.Date_start; sqlComm.Parameters.Add("@date_start", MySqlDbType.Date).Value = storingjob.Date_end; return(sqlComm.ExecuteNonQuery()); }