/// <summary> /// Check processing /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>ResultModel</returns> private void Check(UpdateDataModel inputObject) { // Local variable declaration AdminGiftListDao adminGiftListDao = null; MCodeCom mCodeCom = null; // Variable initialize adminGiftListDao = new AdminGiftListDao(); mCodeCom = new MCodeCom(); // Check role if (!PageHelper.AuthRole(Logics.RL_GIFTS)) throw new ExecuteException("E_MSG_00013"); // Check valid int i = 0; foreach (var obj in inputObject.ListGifts) { if (DataCheckHelper.IsNull(obj.GiftStatus)) throw new ExecuteException("E_MSG_00004", string.Format("Trạng thái ({0})", i + 1)); if (!mCodeCom.IsExist(Logics.GROUP_GIFT_STATUS, obj.GiftStatus, false)) throw new DataNotExistException(string.Format("Trạng thái ({0})", i + 1)); if (!adminGiftListDao.IsExistGift(obj.GiftCd)) throw new DataNotExistException(string.Format("Thẻ ({0})", i + 1)); i++; } }
/// <summary> /// Get infomation /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>DataModel</returns> private FilterDataModel GetInfo(FilterDataModel inputObject) { // Local variable declaration FilterDataModel getResult = null; MCodeCom mCodeCom = null; AdminGiftListDao adminGiftListDao = null; // Variable initialize getResult = new FilterDataModel(); mCodeCom = new MCodeCom(); adminGiftListDao = new AdminGiftListDao(); // Get data var listGiftStatus = mCodeCom.GetListCode(Logics.GROUP_GIFT_STATUS, null, true, false); var listGifts = adminGiftListDao.GetListGifts(inputObject); // Set value getResult.ListGiftStatus = listGiftStatus; getResult.ListGifts = listGifts; // Return value return getResult; }
/// <summary> /// Update item to cart /// </summary> /// <param name="inputObject">DataModel</param> /// <returns>DataModel</returns> private UpdateDataModel UpdateInfo(UpdateDataModel inputObject) { // Local variable declaration UpdateDataModel getResult = null; AdminGiftListDao adminGiftListDao = null; // Variable initialize getResult = new UpdateDataModel(); adminGiftListDao = new AdminGiftListDao(); // Update data foreach (var obj in inputObject.ListGifts) { adminGiftListDao.UpdateGift(obj); } // Submit data adminGiftListDao.SubmitChanges(); // Return value return getResult; }