public JsonResult EditNumber(PaymentNoModel model) { JsonModel jm = new JsonModel(); //如果表单验证成功 if (ModelState.IsValid) { IPropertyExpenseNoBLL expenseNoBLL = BLLFactory <IPropertyExpenseNoBLL> .GetBLL("PropertyExpenseNoBLL"); var expenseNo = expenseNoBLL.GetEntity(u => u.Id == model.Id); if (expenseNo != null) { expenseNo.ExpenseNumber = model.ExpenseNumber; expenseNo.ExpenseTypeId = model.ExpenseTypeId; expenseNo.Memo = model.Memo; expenseNo.BuildCompanyId = model.BuildCompanyId; expenseNo.BuildDoorId = model.DoorId; //修改保存到数据库 if (expenseNoBLL.Update(expenseNo)) { //日志记录 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 ActionResult EditNumber(int id) { IPropertyExpenseNoBLL expenseNoBLL = BLLFactory <IPropertyExpenseNoBLL> .GetBLL("PropertyExpenseNoBLL"); var expenseNo = expenseNoBLL.GetEntity(u => u.Id == id); if (expenseNo != null) { PaymentNoModel model = new PaymentNoModel() { Id = expenseNo.Id, ExpenseNumber = expenseNo.ExpenseNumber, ExpenseTypeId = expenseNo.ExpenseTypeId, Memo = expenseNo.Memo, }; if (expenseNo.BuildCompanyId != null) { model.PlaceType = ConstantParam.PLACE_TYPE_COMPANY; model.BuildCompanyId = expenseNo.BuildCompanyId; model.BuildCompanyList = GetBuildCompanyList(expenseNo.BuildCompany.PropertyPlaceId); } else if (expenseNo.BuildDoorId != null) { model.PlaceType = ConstantParam.PLACE_TYPE_HOUSE; model.BuildId = expenseNo.BuildDoor.BuildUnit.Build.Id; model.BuildList = GetBuildList(expenseNo.BuildDoor.BuildUnit.Build.PropertyPlaceId); model.UnitId = expenseNo.BuildDoor.BuildUnit.Id; model.UnitList = GetUnitList(model.BuildId); model.DoorId = expenseNo.BuildDoorId; model.DoorList = GetDoorList(model.UnitId); } model.ExpenseTypeList = GetExpenseTypeList(); return(View(model)); } else { return(RedirectToAction("NumberList")); } }
public JsonResult DeleteNumber(int id) { JsonModel jm = new JsonModel(); //获取要删除的缴费编号 IPropertyExpenseNoBLL expenseNoBLL = BLLFactory <IPropertyExpenseNoBLL> .GetBLL("PropertyExpenseNoBLL"); var expenseNo = expenseNoBLL.GetEntity(u => u.Id == id); if (expenseNo == null) { jm.Msg = "该缴费编号不存在"; } else { //删除成功 if (expenseNoBLL.Delete(expenseNo)) { //记录操作日志 jm.Content = "删除缴费编号:" + expenseNo.ExpenseNumber; } } return(Json(jm, JsonRequestBehavior.AllowGet)); }