/// <summary> /// 保存数据 /// </summary> /// <returns>返回Json串</returns> public string Save() { string performevaltargetclassformData = System.Web.HttpContext.Current.Request.Form["performevaltargetclassformData"]; var performevaltargetclassforminfo = DataConverterHelper.JsonToEntity <PerformEvalTargetClassModel>(performevaltargetclassformData); SavedResult <Int64> savedresult = new SavedResult <Int64>(); PagedResult <PerformEvalTargetClassModel> result = this.GetList(); try { foreach (PerformEvalTargetClassModel performEvalTargetClass in performevaltargetclassforminfo.AllRow) { //where条件已经包括新增以及修改,反证法 var pt = from pt1 in result.Results where (pt1.FName == performEvalTargetClass.FName || pt1.FCode == performEvalTargetClass.FCode) && pt1.PhId != performEvalTargetClass.PhId select pt1; if (pt.Count() > 0) { throw new Exception("代码或名称重复"); } } savedresult = PerformEvalTargetClassService.Save <Int64>(performevaltargetclassforminfo.AllRow, ""); } catch (Exception ex) { savedresult.Status = ResponseStatus.Error; savedresult.Msg = ex.Message.ToString(); } return(DataConverterHelper.SerializeObject(savedresult)); }
/// <summary> /// 根据主键获取数据 /// </summary> /// <returns>返回Json串</returns> public string GetPerformEvalTargetClassInfo() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 string tabtype = System.Web.HttpContext.Current.Request.Params["tabtype"]; //Tab类型 var findedresult = PerformEvalTargetClassService.Find(id); return(DataConverterHelper.ResponseResultToJson(findedresult)); }
public PagedResult <PerformEvalTargetClassModel> GetList() { string clientJsonQuery = System.Web.HttpContext.Current.Request.Params["queryfilter"]; //查询条件 Dictionary <string, object> dicWhere = DataConverterHelper.ConvertToDic(clientJsonQuery); //查询条件转Dictionary DataStoreParam storeparam = this.GetDataStoreParam(); var result = PerformEvalTargetClassService.LoadWithPage(storeparam.PageIndex, storeparam.PageSize, dicWhere); return(result); }
/// <summary> /// 删除数据 /// </summary> /// <returns>返回Json串</returns> public string Delete() { long id = Convert.ToInt64(System.Web.HttpContext.Current.Request.Params["id"]); //主表主键 string codes = System.Web.HttpContext.Current.Request.Params["code"].ToString(); string names = ""; if (CanDelete(codes, out names)) { var deletedresult = PerformEvalTargetClassService.Delete <System.Int64>(id); return(DataConverterHelper.SerializeObject(deletedresult)); } else { return("{\"result\":\"fail\",\"names\":\"" + names + "\"}"); } //var deletedresult = PerformEvalTargetClassService.Delete<System.Int64>(id); //return DataConverterHelper.SerializeObject(deletedresult); }