/// <summary> /// 新增备选供货商综合评审项目定义 /// </summary> /// <param name="AlternativeProjectMC"></param> /// <returns></returns> public ActionResult InsertAlternativeList(S_AlternativeList sysNoticeType) { string strMsg = "falied"; if (!string.IsNullOrEmpty(sysNoticeType.AlternativeName)) { int oldCount = (from tbNoticeType in MyModels.S_AlternativeList where tbNoticeType.AlternativeName == sysNoticeType.AlternativeName.Trim() select tbNoticeType).Count(); if (oldCount == 0) { try { MyModels.S_AlternativeList.Add(sysNoticeType); if (MyModels.SaveChanges() > 0) { strMsg = "success"; } } catch (Exception) { } } else { strMsg = "exist";//已经存在 } } else { strMsg = "nofull";//数据不完整 } return(Json(strMsg, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 查询备选供货商综合评审项目定义类型 By Id /// </summary> /// <param name="noticeTypeId"></param> /// <returns></returns> public ActionResult SelectAlternativeListId(int noticeTypeId) { try { S_AlternativeList noticeType = (from tbNoticeType in MyModels.S_AlternativeList where tbNoticeType.AlternativeID == noticeTypeId select tbNoticeType).Single(); return(Json(noticeType, JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.WriteLine(e); return(Json(null, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteAlternativeList(int noticeTypeId) { //定义返回 string strMsg = "fail"; try { S_AlternativeList dbNoticeType = (from tbNoticeTypeDetails in MyModels.S_AlternativeList where tbNoticeTypeDetails.AlternativeID == noticeTypeId select tbNoticeTypeDetails).Single(); MyModels.S_AlternativeList.Remove(dbNoticeType);//删除 if (MyModels.SaveChanges() > 0) { strMsg = "success"; } } catch (Exception) { } return(Json(strMsg, JsonRequestBehavior.AllowGet)); }