public ActionResult Edit(T_QY_Person t_qy_person) { if (ModelState.IsValid) { db.Entry(t_qy_person).State = EntityState.Modified; db.SaveChanges(); Logging("更新了详细信息", (int)OperateTypes.Edit,(int)GenerateSystem.Personal); return Json(new { statusCode = "200", message = "信息保存成功!", type = "success" }); } BindCardType(t_qy_person.CardType); BindEducation(t_qy_person.Education); BindDegree(t_qy_person.Degree); BindTitles(t_qy_person.Titles); BindTitlesGrade(t_qy_person.TitlesGrade); return Json(new { statusCode = "200", message = "信息保存失败!", type = "error" }); }
public ActionResult Create(T_QY_Person t_qy_person) { if ((bool)CheckPersonName(t_qy_person.Name).Data) { return ReturnJson(false, "该姓名已经存在", "", "", false, ""); } if (ModelState.IsValid) { t_qy_person.MemberID = Convert.ToInt32(Session["MemberID"] == null ? 0 : Session["MemberID"]); t_qy_person.CardType = t_qy_person.CardType == null ? -1 : t_qy_person.CardType; t_qy_person.IsValid = true; t_qy_person.OP = 0; t_qy_person.CreateTime = DateTime.Now; t_qy_person.UpdateTime = DateTime.Now; db.T_QY_Person.Add(t_qy_person); int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } return Json(new { }); }
public ActionResult Edit(T_QY_Person t_qy_person) { if (ModelState.IsValid) { db.Entry(t_qy_person).State = EntityState.Modified; int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } return Json(new { }); }
// // GET: /QY_Person/Create public ActionResult Create() { BindCardType(); BindEducation(); BindDegree(); BindTitles(); BindTitlesGrade(); var t_qy_person = new T_QY_Person(); return View(t_qy_person); }
public bool InitPerson(int member_id,string member_name) { try { T_QY_Person person = new T_QY_Person(); person.MemberID = member_id; person.Name = member_name; db.T_QY_Person.Add(person); if (db.SaveChanges() > 0) { return true; } return false; } catch { return false; } }