Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        public ContentResult RemoteCheck(PropertyCompanyModel model)
        {
            IPropertyCompanyBLL propertyCompanybll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL");

            if (propertyCompanybll.Exist(m => m.Name == model.Name && m.Id != model.Id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT))
            {
                return(Content("false"));
            }
            else
            {
                return(Content("true"));
            }
        }
Beispiel #3
0
        /// <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);
        }