public string DicsSaveChanges(string jsonString, string action) { try { SysDicEntity entity = JsonConvert.DeserializeObject <SysDicEntity>(jsonString); SysDicManager dm = new SysDicManager(); if (action == "add") { entity.IsDisplay = "T"; entity.CreateBy = SessionHelper.CurrentUser.Code; entity.UpdateBy = SessionHelper.CurrentUser.Code; dm.Insert(entity); } else { SysDicEntity oldEntity = dm.GetDicByID(entity.ID); oldEntity.Name = entity.Name; oldEntity.ParentCode = entity.ParentCode; oldEntity.Value = entity.Value; oldEntity.Type = entity.Type; oldEntity.UpdateBy = SessionHelper.CurrentUser.Code; oldEntity.UpdateTime = DateTime.Now; dm.Update(oldEntity); } return("success"); } catch (Exception e) { return(e.ToString()); } }
public string DeleteDic(int id) { try { //DictionaryViewModel model = JsonConvert.DeserializeObject<DictionaryViewModel>(jsonString.ToString()); SysDicManager manager = new SysDicManager(); SysDicEntity entity = manager.GetDicByID(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()); } }
public string GetDicByID(int id) { SysDicManager manager = new SysDicManager(); return(new JavaScriptSerializer().Serialize(manager.GetDicByID(id))); }