public ActionResult EditBuildCompany(int id)
        {
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            //获取要编辑的物业公司
            T_BuildCompany buildCompany = buildCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            if (buildCompany != null)
            {
                //初始化返回页面的模型
                BuildCompanyModel model = new BuildCompanyModel()
                {
                    Id          = buildCompany.Id,
                    Name        = buildCompany.Name,
                    Phone       = buildCompany.Phone,
                    Desc        = buildCompany.Desc,
                    PayDesc     = buildCompany.PayDesc,
                    ServiceDesc = buildCompany.ServiceDesc
                };
                return(View(model));
            }
            else
            {
                return(RedirectToAction("BuildCompanyList"));
            }
        }
        public ActionResult BuildCompanyList(BuildCompanyModel model)
        {
            //物业公司Id
            int CompanyId = GetSessionModel().CompanyId.Value;

            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            //查询
            Expression <Func <T_BuildCompany, bool> > where = u => (string.IsNullOrEmpty(model.Name) ? true : u.Name.Contains(model.Name)) && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlace.CompanyId == CompanyId && u.PropertyPlace.PlaceType == ConstantParam.PLACE_TYPE_COMPANY;

            //根据小区名称查询
            if (model.PropertyPlaceId != null)
            {
                where = PredicateBuilder.And(where, u => u.PropertyPlaceId == model.PropertyPlaceId.Value);
            }

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

            model.DataList = buildCompanyBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex) as PagedList <T_BuildCompany>;

            //获取所有物业小区列表
            model.CompanyPlaceList = GetCompanyPlaceList();

            return(View(model));
        }
        public ActionResult AddBuildCompany(BuildCompanyModel model)
        {
            JsonModel jm = new JsonModel();

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

                T_BuildCompany buildCompany = new T_BuildCompany()
                {
                    Name            = model.Name,
                    Phone           = model.Phone,
                    Desc            = model.Desc,
                    PayDesc         = model.PayDesc,
                    ServiceDesc     = model.ServiceDesc,
                    PropertyPlaceId = GetSessionModel().PropertyPlaceId.Value
                };
                // 保存
                buildCompanyBll.Save(buildCompany);

                //日志记录
                jm.Content = PropertyUtils.ModelToJsonString(model);
            }
            else
            {
                // 保存异常日志
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
        public ActionResult BuildCompanyList(BuildCompanyModel model)
        {
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            int propertyPlaceId = GetSessionModel().PropertyPlaceId.Value;

            //查询
            Expression <Func <T_BuildCompany, bool> > where = u => (string.IsNullOrEmpty(model.Name) ? true : u.Name.Contains(model.Name)) && u.DelFlag == Property.Common.ConstantParam.DEL_FLAG_DEFAULT && u.PropertyPlaceId == propertyPlaceId;
            //排序
            var sortModel = this.SettingSorting("Id", false);
            var list      = buildCompanyBll.GetPageList(where, sortModel.SortName, sortModel.IsAsc, model.PageIndex);

            return(View(list));
        }
Example #5
0
        /// <summary>
        /// 获取小区办公楼单位下拉列表
        /// </summary>
        /// <returns>小区列表</returns>
        private List <SelectListItem> GetBuildCompanyList(int placeId)
        {
            //获取楼座列表
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            var list = buildCompanyBll.GetList(b => b.PropertyPlaceId == placeId && b.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //转换为下拉列表并返回
            return(list.Select(m => new SelectListItem()
            {
                Text = m.Name,
                Value = m.Id.ToString(),
                Selected = false
            }).ToList());
        }
        public ContentResult RemoteCheckExist(BuildCompanyModel model)
        {
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            // 用户名已存在
            if (buildCompanyBll.Exist(m => m.Name == model.Name && m.Id != model.Id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT))
            {
                // 校验不通过

                return(Content("false"));
            }
            else
            {
                return(Content("true"));
            }
        }
Example #7
0
        /// <summary>
        /// 获取当前小区办公楼单位列表
        /// </summary>
        private List <SelectListItem> GetBuildCompanyList(int PlaceId)
        {
            //获取办公楼单位列表
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            var sortModel = this.SettingSorting("Id", true);
            var list      = buildCompanyBll.GetList(u => u.PropertyPlaceId == PlaceId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT,
                                                    sortModel.SortName, sortModel.IsAsc);

            //转换为下拉列表并返回
            return(list.Select(m => new SelectListItem()
            {
                Text = m.Name,
                Value = m.Id.ToString(),
                Selected = false
            }).ToList());
        }
        public JsonResult EditBuildCompany(BuildCompanyModel model)
        {
            JsonModel jm = new JsonModel();

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

                T_BuildCompany buildCompany = buildCompanyBll.GetEntity(m => m.Id == model.Id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                if (buildCompany != null)
                {
                    buildCompany.Name        = model.Name;
                    buildCompany.Phone       = model.Phone;
                    buildCompany.Desc        = model.Desc;
                    buildCompany.PayDesc     = model.PayDesc;
                    buildCompany.ServiceDesc = model.ServiceDesc;
                    //保存到数据库
                    if (buildCompanyBll.Update(buildCompany))
                    {
                        //日志记录
                        jm.Content = PropertyUtils.ModelToJsonString(model);
                    }
                    else
                    {
                        jm.Msg = "编辑失败";
                    }
                }
                else
                {
                    jm.Msg = "该办公楼单位业主不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
        public JsonResult DeleteBuildCompany(int id)
        {
            JsonModel jm = new JsonModel();
            //获取要删除的物业公司
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            T_BuildCompany buildCompany = buildCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //如果该物业公司存在
            if (buildCompany == null)
            {
                jm.Msg = "该办公楼单位业主不存在";
            }
            else
            {
                //修改指定办公楼单位业主的已删除标识
                buildCompany.DelFlag = ConstantParam.DEL_FLAG_DELETE;
                buildCompanyBll.Update(buildCompany);
                //操作日志
                jm.Content = "删除该办公楼单位业主 " + buildCompany.Name;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index(int id = 1)
        {
            CompanyPlatformIndexModel model = new CompanyPlatformIndexModel();
            int CurrentCompanyId            = GetSessionModel().CompanyId.Value;

            //获取当前公司物业小区个数并赋值
            IPropertyPlaceBLL placeBll = BLLFactory <IPropertyPlaceBLL> .GetBLL("PropertyPlaceBLL");

            model.PlaceCount = placeBll.Count(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId);

            //获取当前公司下属小区物业人员总个数
            IPropertyUserBLL placeUserBll = BLLFactory <IPropertyUserBLL> .GetBLL("PropertyUserBLL");

            model.PlaceUserCount = placeUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                      u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //住宅业主个数
            IHouseUserBLL houseUserBll = BLLFactory <IHouseUserBLL> .GetBLL("HouseUserBLL");

            model.HouseUserCount = houseUserBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                      u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
            //办公楼业主个数
            IBuildCompanyBLL buildCompanyBll = BLLFactory <IBuildCompanyBLL> .GetBLL("BuildCompanyBLL");

            model.BuildCompanyCount = buildCompanyBll.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                            u.PropertyPlace.CompanyId == CurrentCompanyId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取物业公告个数
            IPostBLL postBLL = BLLFactory <IPostBLL> .GetBLL("PostBLL");

            int postCount = postBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                          u.PropertyPlace.CompanyId == CurrentCompanyId && u.PublishedFlag == ConstantParam.PUBLISHED_TRUE && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            model.PlacePostCount = postCount;


            //获取业主上报问题个数
            IQuestionBLL questionBLL = BLLFactory <IQuestionBLL> .GetBLL("QuestionBLL");

            int QuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                  u.PropertyPlace.CompanyId == CurrentCompanyId);

            //获取业主上报问题已处理个数
            int DisposedQuestionCount = questionBLL.Count(u => u.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                          u.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.DISPOSED);

            //设置上报问题处理率
            model.QuestionDisposedRate = Convert.ToDouble(DisposedQuestionCount) / QuestionCount;


            //获取巡检异常个数
            IInspectionResultBLL resultBLL = BLLFactory <IInspectionResultBLL> .GetBLL("InspectionResultBLL");

            int InspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                           u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId &&
                                                           u.Status == ConstantParam.EXCEPTION && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);

            //获取巡检异常已处理个数
            int DisposedInspectionExceptionCount = resultBLL.Count(u => u.InspectionTimePlan.InspectionPlan.PropertyPlace.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                                   u.InspectionTimePlan.InspectionPlan.PropertyPlace.CompanyId == CurrentCompanyId && u.Status == ConstantParam.EXCEPTION &&
                                                                   u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.DisposeStatus == ConstantParam.DISPOSED);

            //设置巡检异常处理率
            model.InspectionExceptionDisposedRate = Convert.ToDouble(DisposedInspectionExceptionCount) / InspectionExceptionCount;


            var dataList         = placeBll.GetList(u => u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT && u.CompanyId == CurrentCompanyId).ToList();
            var ExpenseCountList = new List <ExpenseCountModel>();

            foreach (var item in dataList)
            {
                var m = new ExpenseCountModel();
                m.PlaceName = item.Name;
                //如果是住宅小区
                if (item.PlaceType == ConstantParam.PLACE_TYPE_HOUSE)
                {
                    IBuildDoorBLL doorBll = BLLFactory <IBuildDoorBLL> .GetBLL("BuildDoorBLL");

                    m.DoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id);

                    int ExpensedDoorCount = doorBll.Count(d => d.BuildUnit.Build.PropertyPlaceId == item.Id && d.HouseUserExpenseDetails.Count > 0 &&
                                                          d.HouseUserExpenseDetails.OrderByDescending(e => e.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE);
                    m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount;
                }
                //如果是办公楼小区
                else if (item.PlaceType == ConstantParam.PLACE_TYPE_COMPANY)
                {
                    m.DoorCount = item.BuildCompanys.Count(c => c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT);
                    int ExpensedDoorCount = item.BuildCompanys.Count(c => c.HouseUserExpenseDetails.Count > 0 && c.DelFlag == ConstantParam.DEL_FLAG_DEFAULT &&
                                                                     c.HouseUserExpenseDetails.OrderByDescending(d => d.CreateDate).FirstOrDefault().IsPayed == ConstantParam.PAYED_TRUE);
                    m.ExpensedRate = Convert.ToDouble(ExpensedDoorCount) / m.DoorCount;
                }
                ExpenseCountList.Add(m);
            }
            model.ExpenseCountList = ExpenseCountList.OrderByDescending(m => m.ExpensedRate).ToPagedList(id, ConstantParam.PAGE_SIZE);
            return(View(model));
        }