protected static bool UpdatePronunciation(PronModel Pron) { var oldPron = Pronunciations.First(c => c.Id == Pron.Id).ToModel(); int field = 0; string ColumnsToUpdate = string.Empty; CheckFieldUpdate("Words", Pron.Text, oldPron.Text, ref field, ref ColumnsToUpdate); CheckFieldUpdate("Phonemes", Pron.Phonemes, oldPron.Phonemes, ref field, ref ColumnsToUpdate); CheckQuestionChanges(Pron, oldPron, ref field, ref ColumnsToUpdate); if (ColumnsToUpdate.IsEmpty()) { return(Errors.ThrowErrorMsg(ErrorType.NullOrEmpty, ColumnsToUpdate)); } string query = string.Format(UpdateSQL, Model.Pron.ToDesc(), ColumnsToUpdate, Pron.Id); if (!SendQuery(query)) { return(false); } return(true); }
protected static bool InsertPronunciation(PronModel Pron) { string query = string.Format(InsertSQL + "'{1}', '{2}', {3}, '{4}')", Model.Pron.ToDesc(), Pron.Text, Pron.Phonemes, Pron.Importance, Pron.IsActive); if (!SendQuery(query)) { return(false); } var inserted = GetLast(Model.Pron.ToDesc()); Pronunciations.Add(inserted.Tables[0].AsEnumerable(). Select(GetDatarowPronunciation()).First().ToVM()); return(true); }