Exemplo n.º 1
0
        private bool tryValidate(Model.Car model, out string errMsg)
        {
            errMsg = "";
            bool re = true;

            if (model.Number == null || model.Number.Length == 0 || model.Number.Length > 20 ||
                model.Vin == null || model.Vin.Length == 0 || model.Vin.Length > 100 ||
                model.Model.Length > 20 ||
                model.Description.Length > 200)
            {
                errMsg = "输入数据不合法";
                re     = false;
            }
            if (re && CarManager.CheckRepeatForNumber(model))
            {
                errMsg = "内部编号不能重复";
                re     = false;
            }
            if (re && CarManager.CheckRepeatForVin(model))
            {
                errMsg = "Vin不能重复";
                re     = false;
            }
            if (re && model.Modifier != auth.UserId)
            {
                errMsg = "登录信息异常,请刷新浏览器以重启应用(APP请退出应用后重新打开)";
                re     = false;
            }
            return(re);
        }