Beispiel #1
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            AdminBannerEntryDao adminBannerEntryDao = null;

            // Variable initialize
            adminBannerEntryDao = new AdminBannerEntryDao();

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

            // Check valid
            if (IsAdd && adminBannerEntryDao.IsExistBanner(inputObject.BannerCd))
                throw new DataExistException("Banner");
            if (IsEdit && !adminBannerEntryDao.IsExistBanner(inputObject.BannerCd))
                throw new DataNotExistException("Banner");
        }
Beispiel #2
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            AdminBannerEntryDao adminBannerEntryDao = null;

            // Variable initialize
            adminBannerEntryDao = new AdminBannerEntryDao();

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

            // Check valid
            if (!IsAdd)
            {
                if (DataCheckHelper.IsNull(inputObject.BannerCd))
                    throw new ExecuteException("E_MSG_DATA_00004", "Mã banner");

                if (!adminBannerEntryDao.IsExistBanner(inputObject.BannerCd))
                    throw new DataNotExistException("Banner");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Save infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel SaveInfo(SaveDataModel inputObject)
        {
            // Local variable declaration
            SaveDataModel saveResult = null;
            AdminBannerEntryDao adminBannerEntryDao = null;
            StorageFileCom storageFileCom = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminBannerEntryDao = new AdminBannerEntryDao();
            storageFileCom = new StorageFileCom();

            if (IsAdd) adminBannerEntryDao.InsertBanner(inputObject); // Insert
            else adminBannerEntryDao.UpdateBanner(inputObject); // Update

            // Update StorageFile
            foreach (var storageFile in storageFileCom.GetListActive(inputObject.FileId, false))
            {
                storageFile.ActiveFlag = true;
                storageFileCom.UpdateActiveFlag(storageFile, false);
            }
            storageFileCom.SubmitChanges();

            return saveResult;
        }
Beispiel #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;
            AdminBannerEntryDao adminBannerEntryDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            adminBannerEntryDao = new AdminBannerEntryDao();
            mCodeCom = new MCodeCom();

            // Get data
            var listDeleteFlag = mCodeCom.GetListCode(Logics.GROUP_DELETE_FLAG, null, false, false);
            var listOfferGroup = adminBannerEntryDao.GetListOfferGroup();
            var banner = new Banner();
            if (!IsAdd) banner = adminBannerEntryDao.GetSingleBanner(inputObject.BannerCd);
            else banner.FileId = DataHelper.GetUniqueKey();

            // Set value
            getResult.ListDeleteFlag = listDeleteFlag;
            getResult.ListOfferGroup = listOfferGroup;
            getResult.Banner = banner;

            // Return value
            return getResult;
        }