コード例 #1
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");
            }
        }
コード例 #2
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <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++;
            }
        }
コード例 #3
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
            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");
            }
        }
コード例 #4
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");
            }
        }
コード例 #5
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <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++;
            }
        }
コード例 #6
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminGroupListDao adminGroupListDao = null;
            MCodeCom          mCodeCom          = null;

            // Variable initialize
            adminGroupListDao = new AdminGroupListDao();
            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.ListGroups)
            {
                var dFlag = DataHelper.ToString(obj.DeleteFlag);

                if (DataCheckHelper.IsNull(obj.GroupName))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Tên nhóm ({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 (!adminGroupListDao.IsExistGroup(obj.GroupCd))
                {
                    throw new DataNotExistException(string.Format("Nhóm ({0})", i + 1));
                }
                i++;
            }
        }
コード例 #7
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(SaveByBrandDataModel 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.IsExistBrand(inputObject.BrandCd))
            {
                throw new DataNotExistException("Thương hiệu");
            }
            if (adminOfferEntryDao.IsExistOffer(inputObject.OfferCd))
            {
                throw new DataExistException("Khuyến mãi");
            }
        }
コード例 #8
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminAcceptListDao adminAcceptListDao = null;
            MCodeCom           mCodeCom           = null;

            // Variable initialize
            adminAcceptListDao = new AdminAcceptListDao();
            mCodeCom           = new MCodeCom();

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

            // Check valid
            int i = 0;

            foreach (var obj in inputObject.ListAccepts)
            {
                if (DataCheckHelper.IsNull(obj.SlipStatus))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Trạng thái ({0})", i + 1));
                }
                if (!mCodeCom.IsExist(Logics.GROUP_SLIP_STATUS, obj.SlipStatus, false))
                {
                    throw new DataNotExistException(string.Format("Trạng thái ({0})", i + 1));
                }
                if (!adminAcceptListDao.IsExistAccept(obj.AcceptSlipNo))
                {
                    throw new DataNotExistException(string.Format("Hóa đơn ({0})", i + 1));
                }

                i++;
            }
        }
コード例 #9
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminOfferListDao adminOfferListDao = null;
            MCodeCom          mCodeCom          = null;

            // Variable initialize
            adminOfferListDao = new AdminOfferListDao();
            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.ListOffers)
            {
                var dFlag = DataHelper.ToString(obj.DeleteFlag);
                if (DataCheckHelper.IsNull(obj.OfferCd))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Khuyến mãi ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.ItemCd))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Sản phẩm ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.StartDate))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Ngày bắt đầu ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.EndDate))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Ngày kết thúc ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.Percent))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Giảm ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.OfferGroupCd))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Nhóm khuyến mãi ({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 (DateTime.Compare(obj.StartDate.Value, obj.EndDate.Value) > 0)
                {
                    throw new ExecuteException("E_MSG_00015", "Ngày bắt đầu", "Ngày kết thúc");
                }
                if (obj.Percent < 0)
                {
                    throw new ExecuteException("E_MSG_00011", string.Format("Giảm ({0})", i + 1));
                }
                if (!adminOfferListDao.IsExistItem(obj.ItemCd))
                {
                    throw new DataNotExistException(string.Format("Sản phẩm ({0})", i + 1));
                }
                if (!adminOfferListDao.IsExistOffer(obj.OfferCd))
                {
                    throw new DataNotExistException(string.Format("Khuyến mãi ({0})", i + 1));
                }
                i++;
            }
        }