public void updatePerson(Personnel person) { string sql = "UPDATE personnel SET name = '" + person.getName() + "', start = '" + person.getStart() + "', work = " + person.getWork() + ", rest = " + person.getRest() + ", xp_id = " + person.getXpId() + " WHERE id = " + person.getId() + ";"; connection.Open(); SQLiteCommand command = new SQLiteCommand(sql, connection); command.ExecuteNonQuery(); connection.Close(); }
public void addPerson(Personnel person) { string sql = "INSERT INTO personnel (name, start, work, rest, xp_id) VALUES " + "('" + person.getName() + "', '" + person.getStart() + "', " + person.getWork() + ", " + person.getRest() + ", " + person.getXpId() + ");"; connection.Open(); SQLiteCommand command = new SQLiteCommand(sql, connection); command.ExecuteNonQuery(); connection.Close(); }
private void init() { txtName.Text = person.getName(); txtRest.Text = person.getRest().ToString(); txtWork.Text = person.getWork().ToString(); String[] date = calendar.SplitDate(person.getStart()); txtRDay.Text = date[2]; txtRYear.Text = date[0]; cbRMonth.SelectedIndex = int.Parse(date[1]) - 1; xps = db.getExpertise(); foreach (Expertise xp in xps) { cbXP.Items.Add(xp.getXp()); } cbXP.SelectedIndex = cbXP.Items.IndexOf(person.getXp()); HasChangeToSave = false; }