コード例 #1
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            MParameterCom mParameterCom = null;

            // Variable initialize
            mParameterCom = new MParameterCom();

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

            // Check valid
            int i = 0;

            foreach (var obj in inputObject.ListParams)
            {
                if (DataCheckHelper.IsNull(obj.ParamValue))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Giá trị ({0})", i + 1));
                }
                if (!mParameterCom.IsExist(obj.ParamCd, false))
                {
                    throw new DataNotExistException(string.Format("Tham số ({0})", i + 1));
                }
                var paramType = mParameterCom.GetType(obj.ParamCd, false);
                if (paramType == Logics.PT_NUMBER && !DataCheckHelper.IsNumber(obj.ParamValue))
                {
                    throw new ExecuteException("E_MSG_00001", string.Format("Giá trị ({0})", i + 1));
                }
                if (paramType == Logics.PT_DATE && !DataCheckHelper.IsDate(obj.ParamValue))
                {
                    throw new ExecuteException("E_MSG_00001", string.Format("Giá trị ({0})", i + 1));
                }
                i++;
            }
        }