Exemplo n.º 1
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminGroupRoleListDao adminGroupRoleListDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminGroupRoleListDao = new AdminGroupRoleListDao();
            mCodeCom = new MCodeCom();

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

            // Check valid
            int i = 0;
            foreach (var obj in inputObject.ListGroupRoles)
            {
                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 (!adminGroupRoleListDao.IsExistGroupRole(obj.GroupCd, obj.RoleCd))
                    throw new DataNotExistException(string.Format("Quyền ({0})", i + 1));
                i++;
            }
        }
Exemplo n.º 2
0
        /// <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");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminGiftListDao adminGiftListDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminGiftListDao = new AdminGiftListDao();
            mCodeCom = new MCodeCom();

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

            // Check valid
            int i = 0;
            foreach (var obj in inputObject.ListGifts)
            {
                if (DataCheckHelper.IsNull(obj.GiftStatus))
                    throw new ExecuteException("E_MSG_00004", string.Format("Trạng thái ({0})", i + 1));
                if (!mCodeCom.IsExist(Logics.GROUP_GIFT_STATUS, obj.GiftStatus, false))
                    throw new DataNotExistException(string.Format("Trạng thái ({0})", i + 1));
                if (!adminGiftListDao.IsExistGift(obj.GiftCd))
                    throw new DataNotExistException(string.Format("Thẻ ({0})", i + 1));

                i++;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminCategoryListDao adminCategoryListDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminCategoryListDao = new AdminCategoryListDao();
            mCodeCom = new MCodeCom();

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

            // Check valid
            int i = 0;
            foreach (var obj in inputObject.ListCategories)
            {
                var dFlag = DataHelper.ToString(obj.DeleteFlag);

                if (DataCheckHelper.IsNull(obj.CategoryName))
                    throw new ExecuteException("E_MSG_00004", string.Format("Tên loại ({0})", i + 1));
                if (DataCheckHelper.IsNull(obj.CategoryDiv))
                    throw new ExecuteException("E_MSG_00004", string.Format("Chủng loại ({0})", i + 1));
                if (!mCodeCom.IsExist(Logics.GROUP_CATEGORY_DIV, obj.CategoryDiv, false))
                    throw new DataNotExistException(string.Format("Chủng loại ({0})", i + 1));
                if (DataCheckHelper.IsNull(obj.SortKey))
                    throw new ExecuteException("E_MSG_00004", string.Format("Thứ tự ({0})", i + 1));
                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 (!adminCategoryListDao.IsExistCategory(obj.CategoryCd))
                    throw new DataNotExistException(string.Format("Loại sản phẩm ({0})", i + 1));
                i++;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            AdminCategoryEntryDao adminCategoryEntryDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminCategoryEntryDao = new AdminCategoryEntryDao();
            mCodeCom = new MCodeCom();

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

            // Check valid
            var dFlag = DataHelper.ToString(inputObject.DeleteFlag);

            if (!mCodeCom.IsExist(Logics.GROUP_CATEGORY_DIV, inputObject.CategoryDiv, false))
                throw new DataNotExistException("Chủng loại");
            if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                throw new DataNotExistException("Dữ liệu");
            if (adminCategoryEntryDao.IsExistCategory(inputObject.CategoryCd))
                throw new DataExistException("Loại sản phẩm");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            var adminGroupRoleEntryDao = new AdminGroupRoleEntryDao();
            var mCodeCom = new MCodeCom();

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

            // Exist group
            if (!adminGroupRoleEntryDao.IsExistGroup(inputObject.GroupCd))
                throw new DataNotExistException("Nhóm");

            // Check valid
            var dFlag = DataHelper.ToString(inputObject.DeleteFlag);

            if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                throw new DataNotExistException("Dữ liệu");
            if (adminGroupRoleEntryDao.IsExistGroupRole(inputObject.GroupCd, inputObject.RoleCd))
                throw new DataExistException("Quyền");
        }
Exemplo n.º 7
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");
        }
Exemplo n.º 8
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++;
            }
        }