示例#1
0
        /// <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;
            AdminCategoryListDao adminCategoryListDao = null;

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

            // Get data
            var listCategoryDiv = mCodeCom.GetListCode(Logics.GROUP_CATEGORY_DIV, null, false, false);
            var listDeleteFlag  = mCodeCom.GetListCode(Logics.GROUP_DELETE_FLAG, null, false, false);
            var listAccepts     = adminCategoryListDao.GetListCategories();

            // Set value
            getResult.ListCategoryDiv = listCategoryDiv;
            getResult.ListDeleteFlag  = listDeleteFlag;
            getResult.ListCategories  = listAccepts;

            // Return value
            return(getResult);
        }
示例#2
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++;
            }
        }
示例#3
0
        /// <summary>
        /// Update item to cart
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private UpdateDataModel UpdateInfo(UpdateDataModel inputObject)
        {
            // Local variable declaration
            UpdateDataModel      getResult            = null;
            AdminCategoryListDao adminCategoryListDao = null;

            // Variable initialize
            getResult            = new UpdateDataModel();
            adminCategoryListDao = new AdminCategoryListDao();

            // Update data
            foreach (var obj in inputObject.ListCategories)
            {
                adminCategoryListDao.UpdateCategory(obj);
            }
            // Submit data
            adminCategoryListDao.SubmitChanges();

            // Return value
            return(getResult);
        }