コード例 #1
0
 /// <summary>
 /// Kiểm tra và chỉnh sửa Feedback
 /// </summary>
 /// <param name="entity">FeedbackEntity</param>
 /// <returns>bool:kết quả thực hiện</returns>
 public static bool Edit(FeedbackEntity entity)
 {
     checkExist(entity);
     checkFK(entity);
     checkLogic(entity);
     return FeedbackDAL.Edit(entity);
 }
コード例 #2
0
 /// <summary>
 /// Kiểm tra và thêm mới Feedback
 /// </summary>
 /// <param name="entity">Entity</param>
 /// <returns>Int32: ID của Feedback Mới Thêm Vào</returns>
 public static Int32 Add(FeedbackEntity entity)
 {
     checkLogic(entity);
     checkFK(entity);
     return FeedbackDAL.Add(entity);
 }
コード例 #3
0
 /// <summary>
 /// Kiểm tra logic Entity
 /// </summary>
 /// <param name="entity">FeedbackEntity: Tin tức Entity</param>
 private static void checkLogic(FeedbackEntity entity)
 {
     if (String.IsNullOrEmpty(entity.sContent))
         throw new Exception(EX_CONTENT_EMPTY);
     if (String.IsNullOrEmpty(entity.sEmail))
         throw new Exception(EX_EMAIL_EMPTY);
     if (String.IsNullOrEmpty(entity.sName))
         throw new Exception(EX_NAME_EMPTY);
     if (String.IsNullOrEmpty(entity.sTitle))
         throw new Exception(EX_TITLE_EMPTY);
     if (entity.iNewsID < 0)
         throw new Exception(EX_NEWSID_INVALID);
 }
コード例 #4
0
 /// <summary>
 /// Kiểm tra tồn tại khóa ngoại
 /// </summary>
 /// <param name="entity">FeedbackEntity:entity</param>
 private static void checkFK(FeedbackEntity entity)
 {
     NewsEntity oNews = NewsDAL.GetOne(entity.iNewsID);
     if (oNews == null)
     {
         throw new Exception(EX_NEWSID_NOTFOUND);
     }
 }
コード例 #5
0
 /// <summary>
 /// Kiểm tra tồn tại bản ghi
 /// </summary>
 /// <param name="entity">FeedbackEntity: entity</param>
 private static void checkExist(FeedbackEntity entity)
 {
     FeedbackEntity fbEntity = FeedbackDAL.GetOne(entity.iFeedbackID);
     if (fbEntity == null)
         throw new Exception(EX_NOT_EXIST);
 }
コード例 #6
0
 /// <summary>
 /// Kiểm tra và xoá Feedback
 /// </summary>
 /// <param name="entity">FeedbackEntity</param>
 /// <returns>bool:kết quả thực hiện</returns>
 public static bool Remove(FeedbackEntity entity)
 {
     checkExist(entity);
     return FeedbackDAL.Remove(entity.iFeedbackID);
 }