/// <summary> /// 角色信息添加数据检测 /// </summary> /// <param name="form">数据表单</param> /// <param name="stateInfo">状态消息</param> /// <returns>执行结果</returns> private bool AddedByCheck(FormCollection form, out string stateInfo) { stateInfo = GeneralHandler.StateSuccess; string txtName = form["txtName"] as string; if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50) { stateInfo = "名称不能为空或小于2个或大于50个字符!"; return(false); } if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName)) { stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)"; return(false); } string txtCode = form["txtCode"] as string; if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50) { stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)"; return(false); } string txtDesc = form["txtDesc"] as string; if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300) { stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)"; return(false); } return(true); }
/// <summary> /// 模块信息添加数据检测 /// </summary> /// <param name="form">数据表单</param> /// <param name="stateInfo">状态消息</param> /// <returns>执行结果</returns> private bool AddedByCheck(FormCollection form, out string stateInfo) { stateInfo = GeneralHandler.StateSuccess; int father = TypeHelper.TypeToInt32(form["ddlFather"], -1); if (father == 0 || father < -1) { stateInfo = "模块标识不正确!"; return(false); } string txtName = form["txtName"] as string; if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50) { stateInfo = "名称不能为空或小于2个或大于50个字符!"; return(false); } if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName)) { stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)"; return(false); } string txtCode = form["txtCode"] as string; if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50) { stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)"; return(false); } string txtIdent = form["txtIdent"] as string; if (!ValidHelper.NumIsInteger(txtIdent)) { stateInfo = "您输入的识别码不正确!(只能由数字组成,介于1-65535为佳)"; return(false); } string txtRank = form["txtRank"] as string; if ((txtRank.Length > 0 && !ValidHelper.NumIsIntegralBySignless(txtRank)) || int.Parse(txtRank) < 1 || int.Parse(txtRank) > 65535) { stateInfo = "您输入的序列不正确!(只能由数字组成,且不小于1及大于65535)"; return(false); } string txtDesc = form["txtDesc"] as string; if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300) { stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)"; return(false); } return(true); }
/// <summary> /// 状态机制添加数据检测 /// </summary> /// <param name="form">数据表单</param> /// <param name="stateInfo">状态消息</param> /// <returns>执行结果</returns> private bool AddedByCheck(FormCollection form, out string stateInfo) { stateInfo = GeneralHandler.StateSuccess; int Function = TypeHelper.TypeToInt32(form["ddlModule"], -1); if (Function == 0 || Function < -1) { stateInfo = "模块标识不正确!"; return(false); } string txtName = form["txtName"] as string; if (string.IsNullOrEmpty(txtName) || txtName.Length < 2 || txtName.Length > 50) { stateInfo = "名称不能为空或小于2个或大于50个字符!"; return(false); } if (!ValidHelper.ChsIsChineseOrEngOrNums(txtName)) { stateInfo = "您输入的名称不正确!(只能由汉字、字母、数字组成)"; return(false); } string txtCode = form["txtCode"] as string; if ((txtCode.Length > 0 && !ValidHelper.EngIsEngAndNums(txtCode)) || txtCode.Length > 50) { stateInfo = "您输入的编码不正确!(只能由字母和数字组成,且不大于50个字)"; return(false); } string txtMark = form["txtMark"]; if (!ValidHelper.NumIsInteger(txtMark)) { stateInfo = "您输入的状态标识不正确!(只能由数字组成)"; return(false); } string txtDesc = form["txtDesc"] as string; if ((txtDesc.Length > 0 && !ValidHelper.ChsIsMemos(txtDesc)) || txtDesc.Length > 300) { stateInfo = "您输入的描述不正确!(只能由汉字、字母、数字组成,且不大于300个字)"; return(false); } return(true); }