Exemple #1
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.AddMessage(MessageHelper.GetMessageInfo("I_MSG_00001"));

            // Return value
            return response;
        }
Exemple #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;
        }
Exemple #3
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            AdminGiftEntryDao adminGiftEntryDao = null;

            // Variable initialize
            adminGiftEntryDao = new AdminGiftEntryDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_GIFT_ENTRY))
                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.Price < 0)
                throw new ExecuteException("E_MSG_00011", "Số tiền");

            if (adminGiftEntryDao.IsExistGift(inputObject.GiftCd))
                throw new DataExistException("Thẻ");
        }
Exemple #4
0
        public void InsertGift(SaveDataModel inputObject)
        {
            // Get sysdate
            var currentDate = DateTime.Now;

            // Set item
            var entity = new GiftCard();
            entity.GiftCd = inputObject.GiftCd;
            entity.GiftStatus = Logics.CD_GIFT_STATUS_ACTIVE;
            entity.Price = inputObject.Price;
            entity.StartDate = inputObject.StartDate;
            entity.EndDate = inputObject.EndDate;
            entity.Notes = inputObject.Notes;

            entity.CreateDate = currentDate;
            entity.UpdateUser = PageHelper.UserName;
            entity.UpdateDate = currentDate;
            entity.DeleteFlag = false;

            EntityManager.GiftCards.InsertOnSubmit(entity);

            // Submit
            EntityManager.SubmitChanges();
        }
Exemple #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;
            AdminGiftEntryDao adminGiftEntryDao = null;

            // Variable initialize
            saveResult = new SaveDataModel();
            adminGiftEntryDao = new AdminGiftEntryDao();

            // Insert data
            adminGiftEntryDao.InsertGift(inputObject);

            return saveResult;
        }