예제 #1
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel    getResult        = null;
            MCodeCom         mCodeCom         = null;
            AdminGiftListDao adminGiftListDao = null;

            // Variable initialize
            getResult        = new InitDataModel();
            mCodeCom         = new MCodeCom();
            adminGiftListDao = new AdminGiftListDao();

            // Get data
            var listDeleteFlag = mCodeCom.GetListCode(Logics.GROUP_DELETE_FLAG, null, true, false);
            var listGiftStatus = mCodeCom.GetListCode(Logics.GROUP_GIFT_STATUS, null, true, false);
            var listGifts      = adminGiftListDao.GetListGifts();

            // Set value
            getResult.ListGiftStatus = listGiftStatus;
            getResult.ListDeleteFlag = listDeleteFlag;
            getResult.ListGifts      = listGifts;

            // Return value
            return(getResult);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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++;
            }
        }