private void btnAddParticipant_Click(object sender, RoutedEventArgs e) { Participant p = new Participant(this.txtCode.Text, this.txtFirstName.Text, this.txtLastName.Text); db.Participants.Add(p); this.addPInfo(p); this.lstParticipants.Items.Add(p); db.SaveChanges(); }
private void btnAddCondition_Click(object sender, RoutedEventArgs e) { Experiment ex = (Experiment)lbExperimentList.SelectedItem; if (ex != null) { this.warning.Content = ""; Condition con = new Condition(ex.experiment_id); con.code = this.conCode.Text; con.description = this.conDescription.Text; db.Conditions.Add(con); this.lstConditions.Items.Add(con); db.SaveChanges(); } else { this.warning.Content = "You must select an experiment"; } }
public void saveToDatabase(Participant_Condition pc) { DeceptionDBEntities ent = new DeceptionDBEntities(); foreach (Raw_Data rawdata in raw.Local) { rawdata.pc_id = pc.pc_id; ent.Raw_Data.Add(rawdata); } ent.SaveChanges(); }
private void btnAddTag_Click(object sender, RoutedEventArgs e) { if (txtTag.Text != "") { this.warning.Content = ""; Tag tag = new Tag(this.txtTag.Text); lstTags.Items.Add(tag); db.Tags.Add(tag); db.SaveChanges(); } else { this.warning.Content = "You must add a tag name."; } }