/// <summary> /// 删除数据 /// </summary> /// <returns>返回Json串</returns> public string Delete() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 FindedResults <ExpenseCategoryModel> expenseCategorys = ExpenseCategoryService.Find(t => t.PhId == id); if (expenseCategorys != null && expenseCategorys.Data.Count > 0) { string dm = expenseCategorys.Data[0].Dm; FindedResults <ProjectMstModel> findedResults1 = ProjectMstService.FindProjectMst(dm); FindedResults <BudgetMstModel> findedResults2 = BudgetMstService.FindBudgetMst(dm); if (findedResults1 != null && findedResults1.Data.Count > 0) { findedResults1.Status = ResponseStatus.Error; findedResults1.Msg = "当前类别已被引用,无法删除!"; return(DataConverterHelper.SerializeObject(findedResults1)); } if (findedResults2 != null && findedResults2.Data.Count > 0) { findedResults2.Status = ResponseStatus.Error; findedResults2.Msg = "当前类别已被引用,无法删除!"; return(DataConverterHelper.SerializeObject(findedResults2)); } } var deletedresult = ExpenseCategoryService.Delete <System.Int64>(id); return(DataConverterHelper.SerializeObject(deletedresult)); }
/// <summary> /// 根据主键获取数据 /// </summary> /// <returns>返回Json串</returns> public string GetExpenseCategoryInfo() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 string tabtype = System.Web.HttpContext.Current.Request.Params["tabtype"]; //Tab类型 var findedresult = ExpenseCategoryService.Find(id); return(DataConverterHelper.ResponseResultToJson(findedresult)); }