Example #1
0
        /// <summary>
        /// Check processing.
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            var adminOfferItemListDao = new AdminOfferItemListDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_OFFERS))
                throw new ExecuteException("E_MSG_00013");

            // Exist group
            if (!adminOfferItemListDao.IsExistOffer(inputObject.OfferCd))
                throw new DataNotExistException("Khuyến mãi");
        }
Example #2
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminOfferItemListDao adminOfferItemListDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminOfferItemListDao = new AdminOfferItemListDao();
            mCodeCom = new MCodeCom();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_OFFERS))
                throw new ExecuteException("E_MSG_00013");

            // Check valid
            int i = 0;
            foreach (var obj in inputObject.ListOfferItems)
            {
                if (DataCheckHelper.IsNull(obj.OfferItemCd))
                    throw new ExecuteException("E_MSG_00004", string.Format("Mã sản phẩm ({0})", i + 1));
                if (DataCheckHelper.IsNull(obj.OfferItemQtty))
                    throw new ExecuteException("E_MSG_00004", string.Format("Số lượng ({0})", i + 1));
                if (obj.OfferItemQtty <= 0)
                    throw new ExecuteException("E_MSG_00011", "Số lượng");
                var dFlag = DataHelper.ToString(obj.DeleteFlag);
                if (DataCheckHelper.IsNull(obj.DeleteFlag))
                    throw new ExecuteException("E_MSG_00004", string.Format("Dữ liệu ({0})", i + 1));
                if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                    throw new DataNotExistException(string.Format("Dữ liệu ({0})", i + 1));
                if (!adminOfferItemListDao.IsExistItem(obj.OfferItemCd))
                    throw new DataNotExistException(string.Format("Mã sản phẩm ({0})", i + 1));
                if (!adminOfferItemListDao.IsExistOfferItem(obj.OfferCd, obj.DetailNo))
                    throw new DataNotExistException(string.Format("Sản phẩm tặng ({0})", i + 1));
                i++;
            }
        }
Example #3
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;
            AdminOfferItemListDao adminOfferItemListDao = null;

            // Variable initialize
            getResult = new UpdateDataModel();
            adminOfferItemListDao = new AdminOfferItemListDao();

            // Update data
            foreach (var obj in inputObject.ListOfferItems)
            {
                adminOfferItemListDao.UpdateOfferItem(obj);
            }
            // Submit data
            adminOfferItemListDao.SubmitChanges();

            // Return value
            return getResult;
        }
Example #4
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;
            AdminOfferItemListDao adminOfferItemListDao = null;

            // Variable initialize
            getResult = new InitDataModel();
            mCodeCom = new MCodeCom();
            adminOfferItemListDao = new AdminOfferItemListDao();

            // Get data
            var listDeleteFlag = mCodeCom.GetListCode(Logics.GROUP_DELETE_FLAG, null, false, false);
            var listOfferItems = adminOfferItemListDao.GetListOfferItems(inputObject.OfferCd);

            // Set value
            getResult.OfferCd = inputObject.OfferCd;
            getResult.ListDeleteFlag = listDeleteFlag;
            getResult.ListOfferItems = listOfferItems;

            // Return value
            return getResult;
        }