Example #1
0
        private bool CheckBuildingObj(BuildingDto building, out string message)
        {
            message = "";
            //
            string buildingname = building.BuildingName == null ? null : building.BuildingName.DecodeField();

            if (string.IsNullOrEmpty(buildingname))
            {
                message = "请输入楼栋名称";
                return(false);
            }
            if (buildingname.Length > 150)
            {
                message = "请输入楼栋名称长度不能大于150";
                return(false);
            }
            //
            //string doorplate = building.Doorplate == null ? null : building.Doorplate.DecodeField();
            //if (doorplate != null && doorplate.Length > 200)
            //{
            //    message = "请输入门牌号长度不能大于200";
            //    return false;
            //}
            //
            string othername = building.OtherName == null ? null : building.OtherName.DecodeField();

            if (othername != null && othername.Length > 50)
            {
                message = "请输入楼栋别名长度不能大于50";
                return(false);
            }
            //
            if (building.StructureCode.HasValue && !StringHelp.CheckInteger(building.StructureCode.Value.ToString().DecodeField()))
            {
                message = "请输入正确的建筑结构";
                return(false);
            }
            //
            if (building.LocationCode.HasValue && !StringHelp.CheckInteger(building.LocationCode.Value.ToString().DecodeField()))
            {
                message = "请输入正确的位置";
                return(false);
            }
            //
            //if (building.AveragePrice.HasValue && !StringHelp.CheckDecimal(building.AveragePrice.Value.ToString().DecodeField()))
            //{
            //    message = "请输入正确的楼栋均价";
            //    return false;
            //}
            //
            if (building.BuildDate.HasValue && !StringHelp.CheckIsDate(building.BuildDate.Value.ToString().DecodeField()))
            {
                message = "请输入正确的楼栋竣工时间(建筑时间)";
                return(false);
            }
            //
            if (building.IsElevator.HasValue && !StringHelp.CheckInteger(building.IsElevator.Value.ToString().DecodeField()))
            {
                message = "请输入正确的楼栋是否带电梯";
                return(false);
            }
            //
            string elevatorrate = string.IsNullOrEmpty(building.ElevatorRate) ? null : building.ElevatorRate.DecodeField();

            if (elevatorrate != null && elevatorrate.Length > 50)
            {
                message = "请输入楼栋梯户比字符不能大于50";
                return(false);
            }
            //
            //string pricedetail = string.IsNullOrEmpty(building.PriceDetail) ? null : building.PriceDetail.DecodeField();
            //if (pricedetail != null && pricedetail.Length > 500)
            //{
            //    message = "请输入价格系数说明字符不能大于500";
            //    return false;
            //}
            //
            //if (building.SightCode.HasValue && !StringHelp.CheckInteger(building.SightCode.Value.ToString().DecodeField()))
            //{
            //    message = "请输入正确的景观值";
            //    return false;
            //}
            //
            if (!building.TotalFloor.HasValue || !StringHelp.CheckInteger(building.TotalFloor.Value.ToString().DecodeField()))
            {
                message = "请输入楼栋总层数";
                return(false);
            }
            return(true);
        }
Example #2
0
        public static bool CheckProjectObj(Project project, out string message)
        {
            message = "";
            //
            if (project.X == null || project.Y == null)
            {
                message = "请输入查勘员经度和纬度";
                return(false);
            }
            if (!StringHelp.CheckDecimal(Convert.ToString(project.X)) || !StringHelp.CheckDecimal(Convert.ToString(project.Y)))
            {
                message = "请输入正确的查勘员经度和纬度";
                return(false);
            }
            //
            string projectname = string.IsNullOrEmpty(project.ProjectName) ? null : project.ProjectName.DecodeField();

            if (string.IsNullOrEmpty(projectname))
            {
                message = "请输入楼盘名";
                return(false);
            }
            //
            if (project.CityID < 1 || project.AreaID < 1)
            {
                message = "请正确输入城市和行政区";
                return(false);
            }
            //
            string address = string.IsNullOrEmpty(project.Address) ? null : project.Address.DecodeField();

            if (string.IsNullOrEmpty(address))
            {
                message = "请输入楼盘地址";
                return(false);
            }
            //
            if (project.EndDate.HasValue && !StringHelp.CheckIsDate(project.EndDate.Value.ToString().DecodeField())) //(enddate == null || !StringHelp.CheckIsDate(enddate.ToString().DecodeField()))
            {
                message = "请输入正确的竣工时间";
                return(false);
            }
            //
            if (project.BuildingArea.HasValue && !StringHelp.CheckDecimal(project.BuildingArea.Value.ToString().DecodeField()))//(buildingarea == null || !StringHelp.CheckDecimal(buildingarea.ToString().DecodeField()))
            {
                message = "请输入正确的建筑面积";
                return(false);
            }
            //
            if (project.LandArea.HasValue && !StringHelp.CheckDecimal(project.LandArea.Value.ToString().DecodeField()))//(landarea == null || !StringHelp.CheckDecimal(landarea.ToString().DecodeField()))
            {
                message = "请输入正确的占地面积";
                return(false);
            }
            //
            //object cubagerate = jobj["cubagerate"] == null || jobj.Value<string>("cubagerate") == "" ? null : jobj.Value<JValue>("cubagerate").Value;
            //if ( cubagerate != null && !StringHelp.CheckDecimal(cubagerate.ToString().DecodeField()))//(cubagerate == null || !StringHelp.CheckDecimal(cubagerate.ToString().DecodeField()))
            //{
            //    message = "请输入正确的容积率值";
            //    return false;
            //}
            //
            //object greenrate = jobj["greenrate"] == null || jobj.Value<string>("greenrate") == "" ? null : jobj.Value<JValue>("greenrate").Value;
            //if (greenrate != null && !StringHelp.CheckDecimal(greenrate.ToString().DecodeField()))//(greenrate == null || !StringHelp.CheckDecimal(greenrate.ToString().DecodeField()))
            //{
            //    message = "请输入正确的绿化率值";
            //    return false;
            //}
            //
            //string managerprice = jobj["managerprice"] == null ? null : jobj.Value<string>("managerprice").DecodeField();
            //if (string.IsNullOrEmpty(managerprice))
            //{
            //    message = "请输入物业管理费";
            //    return false;
            //}
            //
            //object parkingnumber = jobj["parkingnumber"] == null || jobj.Value<string>("parkingnumber") == "" ? null : jobj.Value<JValue>("parkingnumber").Value;
            //if (parkingnumber != null && !StringHelp.CheckInteger(parkingnumber.ToString().DecodeField()))//(parkingnumber == null || !StringHelp.CheckInteger(parkingnumber.ToString().DecodeField()))
            //{
            //    message = "请输入车位数量";
            //    return false;
            //}
            //
            if (project.TotalNum.HasValue && !StringHelp.CheckInteger(project.TotalNum.Value.ToString().DecodeField()))//(totalnum == null || !StringHelp.CheckInteger(totalnum.ToString().DecodeField()))
            {
                message = "请输入总户数";
                return(false);
            }
            //
            if (project.BuildingNum.HasValue && !StringHelp.CheckInteger(project.BuildingNum.Value.ToString().DecodeField()))//(buildingnum == null || !StringHelp.CheckInteger(buildingnum.ToString().DecodeField()))
            {
                message = "请输入总栋数";
                return(false);
            }
            //
            //object saledate = jobj["saledate"] == null || jobj.Value<string>("saledate") == "" ? null : jobj.Value<JValue>("saledate").Value;
            //if (saledate != null && !StringHelp.CheckIsDate(saledate.ToString().DecodeField()))//(saledate == null || !StringHelp.CheckIsDate(saledate.ToString().DecodeField()))
            //{
            //    message = "请输入开盘时间";
            //    return false;
            //}
            ////
            //object buildingdate = jobj["buildingdate"] == null || jobj.Value<string>("buildingdate") == "" ? null : jobj.Value<JValue>("buildingdate").Value;
            //if (buildingdate != null && !StringHelp.CheckIsDate(buildingdate.ToString()))//(buildingdate == null || !StringHelp.CheckIsDate(buildingdate.ToString()))
            //{
            //    message = "请输入开工时间";
            //    return false;
            //}
            //
            if (project.StartDate.HasValue && !StringHelp.CheckIsDate(project.StartDate.Value.ToString().DecodeField()))//(statedate == null || !StringHelp.CheckIsDate(statedate.ToString().DecodeField()))
            {
                message = "请输入采集时间";
                return(false);
            }
            return(true);
        }