public ActionResult EditCompany() { int CompanyId = GetSessionModel().CompanyId.Value; IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); //获取要编辑的物业公司 T_Company company = propertyCompanyBll.GetEntity(m => m.Id == CompanyId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { //初始化返回页面的模型 PropertyCompanyModel model = new PropertyCompanyModel() { Id = company.Id, Name = company.Name, Address = company.Address, Content = company.Content, Tel = company.Tel }; return(View(model)); } else { return(RedirectToAction("CompanyDetail")); } }
public ActionResult Detail() { //获取登录物业公司 int CompanyId = GetSessionModel().CompanyId.Value; IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanyBll.GetEntity(m => m.Id == CompanyId && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { //初始化返回页面的模型 PropertyCompanyModel model = new PropertyCompanyModel() { Name = company.Name, Address = company.Address, Content = company.Content, Img = company.Img, Tel = company.Tel }; return(View(model)); } else { return(View()); } }
public ActionResult EditCompany(int id) { IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); //获取要编辑的物业公司 T_Company company = propertyCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { //初始化返回页面的模型 SetPropertyCompanyModel model = new SetPropertyCompanyModel() { Id = company.Id, Name = company.Name, Address = company.Address, Content = company.Content, Tel = company.Tel, Img = company.Img }; return(View(model)); } else { return(RedirectToAction("CompanyList")); } }
public JsonResult DeleteCompany(int id) { JsonModel jm = new JsonModel(); //获取要删除的物业公司 IPropertyCompanyBLL propertyCompanBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); //如果该物业公司存在 if (company == null) { jm.Msg = "该物业公司不存在"; } else if (company.PropertyPlaces.Count(p => p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT) > 0) { jm.Msg = "该公司下有小区存在,不能删除"; } else { //修改指定物业公司中的已删除标识 company.DelFlag = ConstantParam.DEL_FLAG_DELETE; propertyCompanBll.Update(company); //操作日志 jm.Content = "删除物业公司 " + company.Name; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public JsonResult SetCompanyInfo(SetPropertyCompanyModel model) { JsonModel jm = new JsonModel(); if (ModelState.IsValid) { //存入文件的路径 string directory = Server.MapPath(ConstantParam.PROPERTY_COMPANY_DIR); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } HttpPostedFileBase file = model.UploadImg; string filename = Path.GetFileName(file.FileName); //获取上传文件名 string fileEx = Path.GetExtension(filename); //获取上传文件的扩展名 //存入的文件名 string FileName = DateTime.Now.ToFileTime().ToString() + fileEx; //保存数据文件 string savrPath = Path.Combine(directory, FileName); file.SaveAs(savrPath); IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanyBll.GetEntity(m => m.Id == model.Id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { string oldFile = company.Img; company.Img = ConstantParam.PROPERTY_COMPANY_DIR + FileName; propertyCompanyBll.Update(company); //删除旧图标 if (!string.IsNullOrEmpty(oldFile)) { oldFile = Server.MapPath(oldFile); FileInfo f = new FileInfo(oldFile); if (f.Exists) { f.Delete(); } } } //日志记录 //jm.Content = PropertyUtils.ModelToJsonString(company); } else { jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ActionResult CompanyDetail(int id) { IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); //获取要查看的物业公司介绍 T_Company company = propertyCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { return(View(company)); } else { return(RedirectToAction("CompanyList")); } }
/// <summary> /// 获取当前登录的总公司用户所属公司 /// </summary> /// <param name="html">HTML对象</param> /// <returns></returns> public static string GetPropertyCompanyName(this HtmlHelper html) { var model = GetSessionModel(html); if (model != null) { int companyId = model.CompanyId.Value; IPropertyCompanyBLL companyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); var company = companyBll.GetEntity(p => p.Id == companyId && p.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { return(company.Name); } } return(null); }
public ActionResult SetPlatCompanyInfo(int id) { IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { SetPropertyCompanyModel model = new SetPropertyCompanyModel() { Id = id, Img = company.Img }; return(View(model)); } else { return(RedirectToAction("CompanyList")); } }
public ActionResult EditCompanyUser(int?id) { // 参数校验 if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ICompanyUserBLL companyUserBll = BLLFactory <ICompanyUserBLL> .GetBLL("CompanyUserBLL"); var companyUserInfo = companyUserBll.GetEntity(index => index.Id == id && index.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (companyUserInfo != null) { CompanyUserModel companyUserModel = new CompanyUserModel(); companyUserModel.CompanyUserId = companyUserInfo.Id; companyUserModel.UserName = companyUserInfo.UserName; companyUserModel.TrueName = companyUserInfo.TrueName; companyUserModel.Memo = companyUserInfo.Memo; companyUserModel.Tel = companyUserInfo.Tel; companyUserModel.Phone = companyUserInfo.Phone; companyUserModel.Email = companyUserInfo.Email; companyUserModel.HeadPath = companyUserInfo.HeadPath; companyUserModel.CompanyId = GetSessionModel().CompanyId.Value; // 获取指定小区的名称 IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); var propertyCompany = propertyCompanyBll.GetEntity(m => m.Id == companyUserModel.CompanyId); if (propertyCompany != null) { companyUserModel.CompanyName = propertyCompany.Name; } return(View(companyUserModel)); } else { return(RedirectToAction("UserList")); } }
public ActionResult SetCompanyAdministrator(int id) { //获取要设置的物业总公司 IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanyBll.GetEntity(m => m.Id == id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { //返回初始化模型页面 CompanyUserModel model = new CompanyUserModel(); model.CompanyId = company.Id; model.CompanyName = company.Name; ViewBag.Admins = company.CompanyUsers.Where(u => u.IsMgr == ConstantParam.USER_ROLE_MGR).Select(u => u.UserName).ToList(); return(View(model)); } else { return(RedirectToAction("CompanyList")); } }
public ActionResult AddCompanyUser() { // 获取物业总公司管理员所属的物业总公司 int companyId = GetSessionModel().CompanyId.Value; // 获取指定物业总公司的名称 IPropertyCompanyBLL propertyCompanyBLL = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); var company = propertyCompanyBLL.GetEntity(m => m.Id == companyId); if (company != null) { CompanyUserModel model = new CompanyUserModel() { CompanyName = company.Name }; return(View(model)); } return(View()); }
public JsonResult EditCompany(PropertyCompanyModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IPropertyCompanyBLL propertyCompanyBll = BLLFactory <IPropertyCompanyBLL> .GetBLL("PropertyCompanyBLL"); T_Company company = propertyCompanyBll.GetEntity(m => m.Id == model.Id && m.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (company != null) { company.Name = model.Name; company.Address = model.Address; company.Content = model.Content; company.Tel = model.Tel; //保存到数据库 if (propertyCompanyBll.Update(company)) { //日志记录 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)); }