public string RolesUpdate(RolesModifyReq req) { RolesModifyRes res = new RolesModifyRes(); if (Session["ID"] == null) { res.ReturnStatus = new ReturnStatus(ReturnCode.SESSION_TIMEOUT); } else { try { Log("Req=" + JsonConvert.SerializeObject(req)); req.ROLES.MUSER = Session["ID"].ToString(); int i = new Roles("SCC").DataUpdate(req); res = new RolesModifyRes { ROLES = new Roles("SCC").ModificationQuery(req.ROLES.SN), ReturnStatus = new ReturnStatus(ReturnCode.EDIT_SUCCESS) }; } catch (Exception ex) { Log("Err=" + ex.Message); Log(ex.StackTrace); res.ReturnStatus = new ReturnStatus(ReturnCode.SERIOUS_ERROR); } } var json = JsonConvert.SerializeObject(res); Log("Res=" + json); return(json); }
public string RolesCreate() { Stream stream = Request.InputStream; stream.Seek(0, SeekOrigin.Begin); string input = new StreamReader(stream).ReadToEnd(); Log(input); RolesModifyReq req = new RolesModifyReq(); JsonConvert.PopulateObject(input, req); RolesModifyRes res = new RolesModifyRes(); if (Session["ID"] == null) { res.ReturnStatus = new ReturnStatus(ReturnCode.SESSION_TIMEOUT); } else { try { Log("Req=" + JsonConvert.SerializeObject(req)); req.ROLES.CUSER = Session["ID"].ToString(); req.ROLES.MUSER = Session["ID"].ToString(); int i = new Roles("SCC").DataCreate(req); res = new RolesModifyRes { ROLES = new Roles("SCC").ModificationQuery(req.ROLES.SN), ReturnStatus = new ReturnStatus(ReturnCode.ADD_SUCCESS) }; } catch (Exception ex) { Log("Err=" + ex.Message); Log(ex.StackTrace); res.ReturnStatus = new ReturnStatus(ReturnCode.SERIOUS_ERROR); } } var json = JsonConvert.SerializeObject(res); Log("Res=" + json); return(json); }