protected void LoadEntity(Question entity) { if (entity != null) { EntityId = entity.QuestionId; Name = entity.Name; SortId = entity.SortId; Status = entity.Status; PostDate = entity.PostDate; Content = entity.Content; MainCode = entity.MainCode; MainName = entity.MainName; AdminCode = entity.AdminCode; AdminName = entity.AdminName; ServiceCode = entity.ServiceCode; ServiceName = entity.ServiceName; if (entity.QuestionClass != null) { QuestionClass = entity.QuestionClass; QuestionClassId = entity.QuestionClass.QuestionClassId; } } }
/// <summary> /// 刪除Q&A /// </summary> /// <param name="question">被刪除的Q&A</param> public void DeleteQuestion(Question question) { FTISDao.DeleteQuestion(question); }
/// <summary> /// 更新Q&A /// </summary> /// <param name="question">被更新的Q&A</param> /// <returns>更新後的Q&A</returns> public Question UpdateQuestion(Question question) { return FTISDao.UpdateQuestion(question); }
/// <summary> /// Q&A /// </summary> /// <param name="question">被新增的Q&A</param> /// <returns>新增後的Q&A</returns> public Question CreateQuestion(Question question) { return FTISDao.CreateQuestion(question); }
private void Save(Question entity) { if (QuestionClassId > 0) { entity.QuestionClass = m_FTISService.GetQuestionClassById(QuestionClassId); } else { entity.QuestionClass = null; } entity.Name = Name; entity.SortId = SortId; entity.Status = Status; entity.PostDate = PostDate; entity.Content = Content; entity.MainCode = MainCode; entity.MainName = MainName; entity.AdminCode = AdminCode; entity.AdminName = AdminName; entity.ServiceCode = ServiceCode; entity.ServiceName = ServiceName; if (entity.QuestionId == 0) { m_FTISService.CreateQuestion(entity); } else { m_FTISService.UpdateQuestion(entity); } LoadEntity(entity.QuestionId); }
public void Insert() { Question entity = new Question(); Save(entity); }