/// <summary> /// Check processing /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>DataModel</returns> private void Check(SaveDataModel inputObject) { // Local variable declaration AdminGiftEntryDao adminGiftEntryDao = null; // Variable initialize adminGiftEntryDao = new AdminGiftEntryDao(); // Check role if (!PageHelper.AuthRole(Logics.RL_GIFT_ENTRY)) throw new ExecuteException("E_MSG_00013"); // Check valid if(DateTime.Compare(inputObject.StartDate, inputObject.EndDate) > 0) throw new ExecuteException("E_MSG_00015", "Ngày bắt đầu", "Ngày kết thúc"); if (inputObject.Price < 0) throw new ExecuteException("E_MSG_00011", "Số tiền"); if (adminGiftEntryDao.IsExistGift(inputObject.GiftCd)) throw new DataExistException("Thẻ"); }
/// <summary> /// Save infomation /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>DataModel</returns> private SaveDataModel SaveInfo(SaveDataModel inputObject) { // Local variable declaration SaveDataModel saveResult = null; AdminGiftEntryDao adminGiftEntryDao = null; // Variable initialize saveResult = new SaveDataModel(); adminGiftEntryDao = new AdminGiftEntryDao(); // Insert data adminGiftEntryDao.InsertGift(inputObject); return saveResult; }