Esempio n. 1
0
        /// <summary>
        /// 批量增加单元户的远程验证
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string RemoteCheck(BuildDoorBatchAddModel model, int BuildId)
        {
            IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            var lamdaList = new List <Expression <Func <T_BuildDoor, bool> > >();

            foreach (var name in model.DoorName)
            {
                lamdaList.Add(r => r.DoorName == name);
            }
            Expression <Func <T_BuildDoor, bool> > lamda  = p => false;
            Expression <Func <T_BuildDoor, bool> > lamda1 = r => (r.UnitId == model.UnitId && r.BuildUnit.BuildId == model.BuildId);

            foreach (var expression in lamdaList)
            {
                lamda = PredicateBuilder.Or <T_BuildDoor>(lamda, expression);
            }

            lamda = PredicateBuilder.And(lamda, lamda1);

            var doorlist = doorBll.GetList(lamda);//查询

            if (doorlist.Count() > 0)
            {
                // 校验不通过
                return(string.Join(",", doorlist.ToList().Select(q => q.DoorName).Distinct().ToArray()));
            }
            else
            {
                // 校验通过
                return("");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取单元户列表
        /// </summary>
        /// <returns>户列表</returns>
        private List <SelectListItem> GetDoorList(int unitId)
        {
            //获取单元户列表
            IBuildDoorBLL DoorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            var sortModel = this.SettingSorting("Id", true);
            var list      = DoorBll.GetList(u => u.UnitId == unitId, sortModel.SortName, sortModel.IsAsc);

            //转换为下拉列表并返回
            return(list.Select(m => new SelectListItem()
            {
                Text = m.DoorName,
                Value = m.Id.ToString(),
                Selected = false
            }).ToList());
        }
Esempio n. 3
0
        public JsonResult GetDoorList(int?unitId)
        {
            List <object> list = new List <object>();

            if (unitId == null)
            {
                return(Json(list, JsonRequestBehavior.AllowGet));
            }

            IBuildDoorBLL bll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

            foreach (var item in bll.GetList(m => m.UnitId == unitId.Value).ToList())
            {
                list.Add(new { Value = item.Id.ToString(), Text = item.DoorName });
            }
            return(Json(list, JsonRequestBehavior.AllowGet));
        }