Esempio n. 1
0
        public void InsertOfferItem(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;

            // Get max
            var max = GetMaxOffer(inputObject.OfferCd);

            // Set item
            var entity = new OfferItem();
            entity.OfferCd = inputObject.OfferCd;
            entity.DetailNo = max + 1;
            entity.OfferItemCd = inputObject.OfferItemCd;
            entity.OfferItemQtty = inputObject.OfferItemQtty;
            entity.SortKey = decimal.Zero;
            entity.CreateUser = PageHelper.UserName;
            entity.CreateDate = currentDate;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = inputObject.DeleteFlag;

            EntityManager.OfferItems.InsertOnSubmit(entity);

            // Submit
            EntityManager.SubmitChanges();
        }
Esempio n. 2
0
        /// <summary>
        /// Execute convert input.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel Convert(SaveRequestModel request)
        {
            // Local variable declaration
            SaveDataModel inputObject = null;

            // Variable initialize
            inputObject = new SaveDataModel();

            // Convert data input
            DataHelper.ConvertInput(request, inputObject);

            // Return value
            return inputObject;
        }
Esempio n. 3
0
        /// <summary>
        /// Execute convert ouput.
        /// </summary>
        /// <param name="resultObject">DataModel</param>
        /// <returns>ResponseModel</returns>
        private SaveResponseModel Convert(SaveDataModel resultObject)
        {
            // Local variable declaration
            SaveResponseModel response = null;

            // Variable initialize
            response = new SaveResponseModel();

            // Set value
            response.OfferCd = DataHelper.ToString(resultObject.OfferCd);
            response.AddMessage(MessageHelper.GetMessageInfo("I_MSG_00001"));

            // Return value
            return response;
        }
Esempio n. 4
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            var adminOfferItemEntryDao = new AdminOfferItemEntryDao();
            var mCodeCom = new MCodeCom();

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

            // Exist offer
            if (!adminOfferItemEntryDao.IsExistOffer(inputObject.OfferCd))
                throw new DataNotExistException("Khuyến mãi");

            // Check valid
            if (inputObject.OfferItemQtty <= 0)
                throw new ExecuteException("E_MSG_00011", "Số lượng");
            var dFlag = DataHelper.ToString(inputObject.DeleteFlag);
            if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                throw new DataNotExistException("Dữ liệu");
            if (!adminOfferItemEntryDao.IsExistItem(inputObject.OfferItemCd))
                throw new DataNotExistException("Mã sản phẩm");
        }
Esempio n. 5
0
        /// <summary>
        /// Save infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private SaveDataModel SaveInfo(SaveDataModel inputObject)
        {
            // Local variable declaration
            SaveDataModel saveResult = null;
            AdminOfferItemEntryDao adminOfferItemEntryDao = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminOfferItemEntryDao = new AdminOfferItemEntryDao();

            // Insert data
            adminOfferItemEntryDao.InsertOfferItem(inputObject);

            // Set value
            saveResult.OfferCd = inputObject.OfferCd;

            // Return value
            return saveResult;
        }