/// <summary> /// 更新问题记录 /// </summary> /// <param name="lawyer">问题对象</param> internal void UpdateQuestion(Question question) { if (question.QuestionInfo == "") return; Question databaseQuestion = null; using (IDataReader reader = DB.Select(DataBases.Question).Where(DataBases.Question.QuestionInfo == question.QuestionInfo).ToDataReader()) { if (reader.Read()) { databaseQuestion = ReadRow(reader); } } if (databaseQuestion != null) { if (databaseQuestion.QuestionInfo != "") databaseQuestion.QuestionInfo = question.QuestionInfo; databaseQuestion.SystemService = this.SystemService; databaseQuestion.SQLtransaction = this.SQLtransaction; databaseQuestion.Update(); } else { databaseQuestion.SystemService = this.SystemService; databaseQuestion.SQLtransaction = this.SQLtransaction; databaseQuestion.Update(); } }
protected override void EndUpdate(DbTransaction trans) { base.EndUpdate(trans); int count = Convert.ToInt32(DB.Select(DataBases.Question, DataBases.Question.ID.Count()).Where(DataBases.Question.QuestionInfo == Question).SetTransaction(trans).ToScalar()); if (count == 0) { Question question = new Question { QuestionInfo = Question, SystemService = this.SystemService, SQLtransaction = this.SQLtransaction }; question.Update(); } }