Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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"));
            }
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }