public MsgBox labAdd(string lab_name) { MsgBox mb = new MsgBox(); lab_info lb = new lab_info(); lb.ID = Guid.NewGuid().ToString(); lb.lab_name = lab_name; mb = new LabDAO().saveLab(lb); return(mb); }
public MsgBox saveLab(lab_info lb) { MsgBox mb = new MsgBox(); mb.status = false; if (string.IsNullOrEmpty(lb.ID)) { lb.ID = Guid.NewGuid().ToString(); } try { new Repository <lab_info>().Insert(lb); mb.status = true; mb.msg = "实验室新增成功。"; } catch (Exception e) { mb.status = false; mb.msg = e.Message; } return(mb); }