public string SaveSchool(string jsonString, string action) { try { SchoolInfoEntity entity = JsonConvert.DeserializeObject <SchoolInfoEntity>(jsonString); SchoolInfoManager manager = new SchoolInfoManager(); if (action == "add") { manager.Insert(entity); } else { SchoolInfoEntity oldEntity = manager.GetSchoolInfoByCode(entity.Code); oldEntity.Name = entity.Name; oldEntity.Address = entity.Address; oldEntity.Description = entity.Description; oldEntity.UpdateBy = SessionHelper.CurrentUser.Code; manager.Update(oldEntity); } return("success"); } catch (Exception e) { return(e.ToString()); } }
public string PutSchoolInfo(SchoolInfoEntity entity) { try { if (entity == null) { return("error"); } SchoolInfoManager manager = new SchoolInfoManager(); entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now; manager.Update(entity); return("success"); } catch (Exception e) { return(e.ToString()); } }
public string DeleteSchoolInfo(int id) { try { SchoolInfoManager manager = new SchoolInfoManager(); SchoolInfoEntity entity = manager.GetSchoolInfoByID(id); if (entity != null) { entity.Valid = "F"; entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now; manager.Update(entity); } return("success"); } catch (Exception e) { return(e.ToString()); } }