public string SaveClassRoom(string jsonString, string action) { try { ClassRoomInfoEntity entity = JsonConvert.DeserializeObject <ClassRoomInfoEntity>(jsonString); ClassRoomInfoManager manager = new ClassRoomInfoManager(); if (action == "add") { manager.Insert(entity); } else { ClassRoomInfoEntity oldEntity = manager.GetClassRoomInfoByCode(entity.Code); oldEntity.Name = entity.Name; oldEntity.Address = entity.Address; oldEntity.Type = entity.Type; oldEntity.SeatNum = entity.SeatNum; oldEntity.UpdateBy = SessionHelper.CurrentUser.Code; manager.Update(oldEntity); } return("success"); } catch (Exception e) { return(e.ToString()); } }
public string PutClassRoomInfo(ClassRoomInfoEntity entity) { try { if (entity == null) { return("error"); } ClassRoomInfoManager manager = new ClassRoomInfoManager(); entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now; manager.Update(entity); return("success"); } catch (Exception e) { return(e.ToString()); } }
public string DeleteClassRoomInfo(int id) { try { ClassRoomInfoManager manager = new ClassRoomInfoManager(); ClassRoomInfoEntity entity = manager.GetClassRoomInfoByID(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()); } }