Esempio n. 1
0
        public ActionResult EditDoor(BuildDoorSearchModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单模型验证成功
            if (ModelState.IsValid)
            {
                IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

                T_BuildDoor doorInfo = doorBll.GetEntity(m => m.Id == model.DoorId);
                if (doorInfo != null)
                {
                    doorInfo.DoorName = model.DoorName;
                    // 保存到数据库
                    doorBll.Update(doorInfo);

                    //日志记录
                    jm.Content = PropertyUtils.ModelToJsonString(model);
                }
                else
                {
                    jm.Msg = "该单元户不存在";
                }
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public ActionResult BatchAddDoor(int unitId)
        {
            IBuildUnitBLL unitBll = BLLFactory <IBuildUnitBLL> .GetBLL("BuildUnitBLL");

            var entity = unitBll.GetEntity(m => m.Id == unitId);
            BuildDoorSearchModel model = new BuildDoorSearchModel();

            model.UnitId    = unitId;
            model.UnitName  = entity.UnitName;
            model.BuildName = entity.Build.BuildName;
            model.BuildId   = entity.Build.Id;
            return(View(model));
        }
Esempio n. 4
0
        public ActionResult DoorList(BuildDoorSearchModel model)
        {
            // 获取单元户访问对象
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            int propertyPlaceId = GetSessionModel().PropertyPlaceId.Value;

            Expression <Func <T_BuildDoor, bool> > where = w => (model.UnitId == 0 ? true : w.UnitId == model.UnitId) && (string.IsNullOrEmpty(model.DoorName) ? true : w.DoorName.Contains(model.DoorName)) && (string.IsNullOrEmpty(model.UnitName) ? true : w.BuildUnit.UnitName.Contains(model.UnitName)) && (string.IsNullOrEmpty(model.BuildName) ? true : w.BuildUnit.Build.BuildName.Contains(model.BuildName)) && w.BuildUnit.Build.PropertyPlaceId == propertyPlaceId;

            // 排序模型
            var sortModel = this.SettingSorting("Id", false);

            model.List = doorBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_BuildDoor>;
            return(View(model));
        }
Esempio n. 5
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"));
            }
        }
Esempio n. 6
0
        public ActionResult EditDoor(int id)
        {
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            var doorInfo = doorBll.GetEntity(index => index.Id == id);

            if (doorInfo != null)
            {
                BuildDoorSearchModel doorModel = new BuildDoorSearchModel();
                doorModel.BuildName = doorInfo.BuildUnit.Build.BuildName;
                doorModel.UnitName  = doorInfo.BuildUnit.UnitName;
                doorModel.UnitId    = doorInfo.BuildUnit.Id;
                doorModel.DoorId    = id;
                doorModel.DoorName  = doorInfo.DoorName;
                return(View(doorModel));
            }
            else
            {
                return(RedirectToAction("DoorList"));
            }
        }