/// <summary> /// Пополнение справочника групп мышц /// </summary> /// <param name="athlete"></param> public void AddMusclesGroup(MusclesGroup mg) { using (SQLiteCommand cmd = connection.CreateCommand()) { Dictionary<String, String> data = new Dictionary<string, string>(); data.Add("value", mg.value.ToString()); bool ok = Insert(cmd, TABLE_SPORT_TYPE, data); if (!ok) throw new Exception("Не удалось добавить значение в справочник мышечных групп!"); } }
private void buttonAdd_Click(object sender, RoutedEventArgs e) { if (comboBoxReferenceBook.Text.Equals(referencesNames[0])) { SportType st = new SportType(0, textBoxReferenceBookAddValue.Text); sqlite.AddSportType(st); } else if (comboBoxReferenceBook.Text.Equals(referencesNames[1])) { MusclesGroup mg = new MusclesGroup(0, textBoxReferenceBookAddValue.Text); sqlite.AddMusclesGroup(mg); } else if (comboBoxReferenceBook.Text.Equals(referencesNames[2])) { byte sportTypeId = (byte)sqlite.GetIdByValue(SQLite.TABLE_SPORT_TYPE, comboBoxSportTypes.Text); WorkType wt = new WorkType(0, sportTypeId, textBoxReferenceBookAddValue.Text, userId); sqlite.AddWorkType(wt); } else if (comboBoxReferenceBook.Text.Equals(referencesNames[3])) { WorkoutType wt = new WorkoutType(0, textBoxReferenceBookAddValue.Text); sqlite.AddWorkoutType(wt); } else if (comboBoxReferenceBook.Text.Equals(referencesNames[4])) { WorkoutPlanType wt = new WorkoutPlanType(0, textBoxReferenceBookAddValue.Text); sqlite.AddWorkoutPlanType(wt); } SetAllValuesToListBox(); textBoxReferenceBookAddValue.Text = ""; }