Exemplo n.º 1
0
        public ActionResult AddDoor(BuildDoorSearchModel model)
        {
            JsonModel     jm      = new JsonModel();
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            if (doorBll.Exist(m => m.DoorName == model.DoorName && m.Id != model.DoorId && m.UnitId == model.UnitId))
            {
                jm.Msg = "该单元户名称已经存在";
            }
            //如果表单模型验证成功
            else if (ModelState.IsValid)
            {
                T_BuildDoor newDoor = new T_BuildDoor()
                {
                    DoorName = model.DoorName,
                    UnitId   = model.UnitId
                };
                // 保存到数据库
                doorBll.Save(newDoor);

                //日志记录
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 远程验证指定单元户名称是否存在
        /// </summary>
        /// <param name="doorName">单元户名称</param>
        /// <param name="id">单元户id,新增时恒为0,修改单元户名称时不为0</param>
        public ContentResult RemoteCheckExist(BuildDoorSearchModel model)
        {
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            // 单元户名称已存在
            if (doorBll.Exist(m => m.DoorName == model.DoorName && m.Id != model.DoorId && m.UnitId == model.UnitId))
            {
                // 校验不通过
                return(Content("false"));
            }
            else
            {
                return(Content("true"));
            }
        }