private Boolean ValidateInputParameter() { Boolean boolReturn = true; //UserLoginName输入检验 if (DataValidateManager.ValidateIsNull(htInputParameter["UserLoginName"]) || DataValidateManager.ValidateStringLengthRange(htInputParameter["UserLoginName"], 1, 50) == false) { strMessageParam[0] = "用户登录名"; strMessageParam[1] = "1"; strMessageParam[2] = "50"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } //Password输入检验 if (DataValidateManager.ValidateIsNull(htInputParameter["Password"]) == true || DataValidateManager.ValidateStringLengthRange(htInputParameter["Password"], 1, 20) == false) { strMessageParam[0] = "用户密码"; strMessageParam[1] = "1"; strMessageParam[2] = "20"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } return(boolReturn); }
//===================================================================== // FunctionName : GetCountInputParameter /// <summary> /// 得到统计记录数用户输入参数操作(通过Request对象) /// </summary> //===================================================================== protected override Boolean GetCountInputParameter() { Boolean boolReturn = true; ValidateData validateData = new ValidateData(); // 验证输入参数 if (!DataValidateManager.ValidateIsNull(CountField.SelectedValue)) { if (!DataValidateManager.ValidateStringLengthRange(CountField.SelectedValue.ToString(), 1, 50)) { strMessageParam[0] = "统计方式"; strMessageParam[1] = "1"; strMessageParam[2] = "50"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } else { appData.CountField = CountField.SelectedValue.ToString(); } } else { strMessageParam[0] = "统计方式"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0002, strMessageParam, strMessageInfo); boolReturn = false; } if (!DataValidateManager.ValidateIsNull(ViewState["Sort"])) { if (!DataValidateManager.ValidateBooleanFormat(ViewState["Sort"].ToString())) { appData.Sort = DEFAULT_SORT; } else { appData.Sort = Convert.ToBoolean(ViewState["Sort"].ToString()); } } else { appData.Sort = DEFAULT_SORT; } if (!DataValidateManager.ValidateIsNull(ViewState["SortField"])) { if (!DataValidateManager.ValidateStringFormat(ViewState["SortField"].ToString())) { appData.SortField = "RecordID"; } else { appData.SortField = ViewState["SortField"].ToString(); } } else { appData.SortField = "RecordID"; } return(boolReturn); }
protected virtual ValidateData ValidateSM(object objValidateData, bool boolNullable, bool boolExist) { ValidateData validateData = new ValidateData(); try { // 初始化参数 validateData.Result = true; validateData.Message = string.Empty; validateData.Parameters = new string[5]; validateData.IsNull = false; validateData.IsExist = false; // 传入参数赋值 validateData.Value = objValidateData; validateData.Nullable = boolNullable; validateData.Exist = boolExist; validateData.Parameters[0] = "说明"; validateData.Parameters[1] = "1"; validateData.Parameters[2] = "255"; // 空验证 if (DataValidateManager.ValidateIsNull(validateData.Value) == false) { // 数值格式验证 if (DataValidateManager.ValidateStringLengthRange(validateData.Value, 1, 255) == false) { validateData.Message = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, validateData.Parameters); validateData.Result = false; } else { // 数据存在验证 if (validateData.Exist == true) { if (AJAX_IsExist("SM", validateData.Value.ToString()) == true) { validateData.IsExist = true; validateData.Message = @"说明已存在,请再换一个。"; validateData.Result = false; } else { validateData.Message = @"说明不存在,可以使用。"; validateData.Result = true; } } else { validateData.Result = true; } } } else { validateData.IsNull = true; if (validateData.Nullable == false) { validateData.Message = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0002, validateData.Parameters); validateData.Result = false; } } } catch (Exception) { validateData.Result = false; } return(validateData); }
protected virtual Boolean GetCountInputParameter() { Boolean boolReturn = true; // 验证输入参数 if (ValidateRequestParamter() == true) { if (DataValidateManager.ValidateIsNull(Request["CountField"]) == false) { if (DataValidateManager.ValidateStringLengthRange(Request["CountField"].ToString(), 1, 50) == false) { strMessageParam[0] = "统计方式"; strMessageParam[1] = "1"; strMessageParam[2] = "50"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } else { appData.CountField = Request["CountField"].ToString(); } } else { strMessageParam[0] = "统计方式"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0002, strMessageParam, strMessageInfo); boolReturn = false; } if (DataValidateManager.ValidateIsNull(ViewState["Sort"]) == false) { if (DataValidateManager.ValidateBooleanFormat(ViewState["Sort"].ToString()) == false) { appData.Sort = DEFAULT_SORT; } else { appData.Sort = Convert.ToBoolean(ViewState["Sort"].ToString()); } } else { appData.Sort = DEFAULT_SORT; } if (DataValidateManager.ValidateIsNull(ViewState["SortField"]) == false) { if (DataValidateManager.ValidateStringFormat(ViewState["SortField"].ToString()) == false) { appData.SortField = "RecordID"; } else { appData.SortField = ViewState["SortField"].ToString(); } } else { appData.SortField = "RecordID"; } } else { // 记录日志开始 string strLogTypeID = "A04"; strMessageParam[0] = (string)Session[ConstantsManager.SESSION_USER_LOGIN_NAME]; string strLogContent = MessageManager.GetMessageInfo(MessageManager.LOG_MSGID_0009, strMessageParam); LogLibrary.LogWrite(strLogTypeID, strLogContent, null, null, null); // 记录日志结束 // 对错误消息进行处理 strMessageInfo = MessageManager.GetMessageInfo(MessageManager.ERR_MSGID_0027, strMessageInfo); MessageContent = strMessageInfo; Session[ConstantsManager.SESSION_MESSAGE_TYPE] = "FaildPre"; Response.Redirect(ConstantsManager.WEBSITE_VIRTUAL_ROOT_DIR + "/ErrorPage/CommonErrorPage.aspx"); Response.End(); } return(boolReturn); }
private Boolean ValidateQueryInputParameter() { Boolean boolReturn = true; if (DataValidateManager.ValidateIsNull(htInputParameter["UserGroupID"]) == false) { if (DataValidateManager.ValidateStringLengthRange(htInputParameter["UserGroupID"], 0, 50) == false) { strMessageParam[0] = "用户组编号"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } } else { htInputParameter.Remove("UserGroupID"); } //UserGroupName输入检验 if (DataValidateManager.ValidateIsNull(htInputParameter["UserGroupName"]) == false) { if (DataValidateManager.ValidateStringLengthRange(htInputParameter["UserGroupName"], 0, 50) == false) { strMessageParam[0] = "用户组名称"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } } else { htInputParameter.Remove("UserGroupName"); } //UserGroupContent输入检验 if (DataValidateManager.ValidateIsNull(htInputParameter["UserGroupContent"]) == false) { if (DataValidateManager.ValidateStringLengthRange(htInputParameter["UserGroupContent"], 0, 50) == false) { strMessageParam[0] = "用户组内容"; strMessageParam[1] = "0"; strMessageParam[2] = "50"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } } else { htInputParameter.Remove("UserGroupContent"); } //UserGroupRemark输入检验 if (DataValidateManager.ValidateIsNull(htInputParameter["UserGroupRemark"]) == false) { if (DataValidateManager.ValidateStringLengthRange(htInputParameter["UserGroupRemark"], 0, 255) == false) { strMessageParam[0] = "用户组备注"; strMessageParam[1] = "0"; strMessageParam[2] = "50"; strMessageInfo = MessageManager.GetMessageInfo(MessageManager.HINT_MSGID_0004, strMessageParam, strMessageInfo); boolReturn = false; } } else { htInputParameter.Remove("UserGroupRemark"); } return(boolReturn); }