/// <summary> /// 新增备选供货商综合评审项目定义 /// </summary> /// <param name="AlternativeProjectMC"></param> /// <returns></returns> public ActionResult InsertNoticeType(S_AlternativeProjectList sysNoticeType) { string strMsg = "falied"; if (!string.IsNullOrEmpty(sysNoticeType.AlternativeProjectMC)) { int oldCount = (from tbNoticeType in MyModels.S_AlternativeProjectList where tbNoticeType.AlternativeProjectMC == sysNoticeType.AlternativeProjectMC.Trim() select tbNoticeType).Count(); if (oldCount == 0) { try { MyModels.S_AlternativeProjectList.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 SelectNoticeTypeById(int noticeTypeId) { try { S_AlternativeProjectList noticeType = (from tbNoticeType in MyModels.S_AlternativeProjectList where tbNoticeType.AlternativeProjectID == noticeTypeId select tbNoticeType).Single(); return(Json(noticeType, JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.WriteLine(e); return(Json(null, JsonRequestBehavior.AllowGet)); } }
public ActionResult DeleteNoticeType(int noticeTypeId) { //定义返回 string strMsg = "fail"; try { S_AlternativeProjectList dbNoticeType = (from tbNoticeTypeDetails in MyModels.S_AlternativeProjectList where tbNoticeTypeDetails.AlternativeProjectID == noticeTypeId select tbNoticeTypeDetails).Single(); MyModels.S_AlternativeProjectList.Remove(dbNoticeType);//删除 if (MyModels.SaveChanges() > 0) { strMsg = "success"; } } catch (Exception) { } return(Json(strMsg, JsonRequestBehavior.AllowGet)); }