//[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))] public HttpResponseMessage AddPZForJson(string token, string jsonStr) { ReturnMessage msg = new ReturnMessage(); vouMag = (VoucherManager)HttpContext.Current.Application.Get(token); if (vouMag == null) { msg.Success = false; msg.Msg = "参数token无效或已过期"; msg.Code = 500; } else { GLAccVouchManager glMag = new GLAccVouchManager(vouMag.UFDataConnstringForNet); GL_accvouch glAcc = (GL_accvouch)JsonConvert.DeserializeObject(jsonStr, typeof(GL_accvouch)); string xml = glMag.getVoucherXml(vouMag.AccId, glAcc); msg = glMag.AddForGL(vouMag, xml); } HttpContext.Current.Application.Remove(vouMag.GetGUID); string str = msg.ToJson(); return(new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") }); }
//[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))] public HttpResponseMessage AddPZForXML(string token, string xmlDoc) { ReturnMessage msg = new ReturnMessage(); vouMag = (VoucherManager)HttpContext.Current.Application.Get(token); if (vouMag == null) { msg.Success = false; msg.Msg = "参数token无效或已过期"; msg.Code = 500; } else { GLAccVouchManager glMag = new GLAccVouchManager(vouMag.UFDataConnstringForNet); msg = glMag.AddForGL(vouMag, xmlDoc); } HttpContext.Current.Application.Remove(vouMag.GetGUID); string str = msg.ToJson(); return(new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") }); }