コード例 #1
0
ファイル: SaveLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            AdminOfferEntryDao adminOfferEntryDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminOfferEntryDao = new AdminOfferEntryDao();
            mCodeCom = new MCodeCom();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_OFFERS))
                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.Percent < 0)
                throw new ExecuteException("E_MSG_00011", "Giảm (%)");
            if (!mCodeCom.IsExist(Logics.GROUP_OFFER_DIV, inputObject.OfferDiv, false))
                throw new DataNotExistException("Dữ liệu");
            if (!adminOfferEntryDao.IsExistItem(inputObject.ItemCd))
                throw new DataNotExistException("Sản phẩm");
            if (adminOfferEntryDao.IsExistOffer(inputObject.OfferCd))
                throw new DataExistException("Khuyến mãi");
        }
コード例 #2
0
ファイル: SaveLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Save infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel SaveInfo(SaveDataModel inputObject)
        {
            // Local variable declaration
            SaveDataModel saveResult = null;
            AdminOfferEntryDao adminOfferEntryDao = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminOfferEntryDao = new AdminOfferEntryDao();

            // Insert data
            adminOfferEntryDao.InsertOffer(inputObject);

            return saveResult;
        }
コード例 #3
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <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;
            AdminOfferEntryDao adminOfferEntryDao = null;

            // Variable initialize
            getResult = new InitDataModel();
            mCodeCom = new MCodeCom();
            adminOfferEntryDao = new AdminOfferEntryDao();

            // Get sysdate
            var currentDate = DateTime.Now;

            // Get data
            var offerCd = adminOfferEntryDao.GetOfferCd();
            var listOfferDiv = mCodeCom.GetListCode(Logics.GROUP_OFFER_DIV, null, false, false);
            var listBrand = mCodeCom.GetListBrand(false, false);

            // Set value
            getResult.OfferCd = offerCd;
            getResult.StartDate = currentDate;
            getResult.EndDate = currentDate;
            getResult.ListOfferDiv = listOfferDiv;
            getResult.ListBrand = listBrand;

            // Return value
            return getResult;
        }