/// <summary> /// 初始化小区编辑模型 /// </summary> public PropertyPlaceModel InitPlaceEditModel(T_PropertyPlace place) { //创建物业小区模型并赋值 PropertyPlaceModel model = new PropertyPlaceModel() { PlaceId = place.Id, PlaceName = place.Name, CompanyId = place.CompanyId, ProvinceId = place.ProvinceId, ProvinceList = GetProvinceList(), CityId = place.CityId, CityList = base.GetCityList(place.ProvinceId), CountyId = place.CountyId, CountyList = base.GetCountyList(place.CityId), Address = place.Address, Longitude = place.Longitude, Latitude = place.Latitude, Tel = place.Tel, Content = place.Content, PlaceType = place.PlaceType, PlaceTypeList = GetPlaceTypeList(place.PlaceType), IsValidate = place.IsValidate == 0 }; return(model); }
/// <summary> /// 编辑小区信息 /// </summary> public JsonModel EditPlace(PropertyPlaceModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IPropertyCompanyBLL companyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); //如果对应的公司不存在(被删除) if (!companyBll.Exist(c => c.Id == model.CompanyId && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT)) { jm.Msg = "当前物业总公司不存在"; } else { //获取指定ID且未删除的小区 IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); T_PropertyPlace place = placeBll.GetEntity(m => m.Id == model.PlaceId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (place != null) { //重新给数据实体赋值 place.Name = model.PlaceName; place.CompanyId = model.CompanyId; place.ProvinceId = model.ProvinceId; place.CityId = model.CityId; place.CountyId = model.CountyId; place.Address = model.Address; place.Longitude = model.Longitude; place.Latitude = model.Latitude; place.Tel = model.Tel; place.Content = model.Content; place.PlaceType = model.PlaceType; place.IsValidate = model.IsValidate ? 0 : 1; //编辑 if (placeBll.Update(place)) { //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { jm.Msg = "编辑失败"; } } else { jm.Msg = "该物业小区不存在"; } } } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(jm); }
public ActionResult AddPlace() { PropertyPlaceModel model = new PropertyPlaceModel(); model.CompanyList = GetCompanyList(); model.ProvinceList = GetProvinceList(); model.CityList = new List <SelectListItem>(); model.CountyList = new List <SelectListItem>(); model.PlaceTypeList = GetPlaceTypeList(); model.IsValidate = true; return(View(model)); }
public ContentResult CheckPlaceExist(PropertyPlaceModel model) { IPropertyPlaceBLL propertyPlaceBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); if (propertyPlaceBll.Exist(m => m.Name == model.PlaceName && m.Id != model.PlaceId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT)) { return(Content("false")); } else { return(Content("true")); } }
/// <summary> /// 添加小区 /// </summary> public JsonModel AddPlace(PropertyPlaceModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IPropertyCompanyBLL companyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); //如果对应的公司不存在(被删除) if (!companyBll.Exist(c => c.Id == model.CompanyId && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT)) { jm.Msg = "物业总公司不存在"; } else { IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); T_PropertyPlace place = new T_PropertyPlace() { Name = model.PlaceName, CompanyId = model.CompanyId, ProvinceId = model.ProvinceId, CityId = model.CityId, CountyId = model.CountyId, Address = model.Address, Longitude = model.Longitude, Latitude = model.Latitude, Tel = model.Tel, Content = model.Content, PlaceType = model.PlaceType, IsValidate = model.IsValidate ? 0 : 1 }; //添加小区并指定系统角色 placeBll.AddPlace(place); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(jm); }
public ActionResult UploadImg(int id) { IPropertyPlaceBLL propertyPlaceBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL"); T_PropertyPlace place = propertyPlaceBll.GetEntity(m => m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && m.Id == id); //物业小区存在 if (place != null) { PropertyPlaceModel model = new PropertyPlaceModel() { PlaceId = place.Id, Img = place.Img }; return(View(model)); } else { return(RedirectToAction("PlaceList")); } }
public JsonResult AddPlace(PropertyPlaceModel model) { var jm = base.AddPlace(model); return(Json(jm, JsonRequestBehavior.AllowGet)); }