public VoucherBaseResp ExecuteAll(VoucherBaseReq baseReq) { if (baseReq == null) { return(VoucherBaseResp.CreateNotValidSignResp()); } var validResp = VoucherBaseResp.CreateErrorResp(); try { var requestReqDict = baseReq.ToStringDictionary(true); validResp = this.VerifyRequest(requestReqDict); //验证签名 if (validResp.isSignValidResp()) { // 验证通过, 执行方法 validResp = this.Execute(baseReq); validResp.SetExecuteSuccess(true); } } catch (Exception e) { validResp.SetExecuteSuccess(false); var message = string.Format("Error occured when executing voucher method, message: {0}, source: {1}", e.Message, e.Source); validResp.SetMsgAndMsgNo(WebServiceLib.SubStr(message, 1000), "99"); LogHelper.Error(string.Format("Error occured when executing voucher method, message: {0}, source: {1}, stackTrace: {2}", e.Message, e.Source, e.StackTrace)); } validResp.Sign = this.gate.CreateSign(validResp.ToStringDictionary(true)); //生成签名 return(validResp); }
protected override VoucherBaseResp Execute(VoucherBaseReq baseReq) { var newReq = baseReq as VoucherQueryNewReq; var resp = new VoucherQueryNewResp(); string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"]; using (OracleConnection dbConn = new OracleConnection(databasedws)) { dbConn.Open(); OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERQUERY_NEW", dbConn); //调用存储过程的方法 oralceComm.CommandType = CommandType.StoredProcedure; //存储过程名称 try { oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo; OracleParameter PVoucherType = new OracleParameter("V_VOUCHERTYPE", OracleType.VarChar); PVoucherType.Direction = ParameterDirection.Output; PVoucherType.Size = 500; oralceComm.Parameters.Add(PVoucherType); OracleParameter PVoucherItemNo = new OracleParameter("V_VOUCHERITEMNO", OracleType.VarChar); PVoucherItemNo.Direction = ParameterDirection.Output; PVoucherItemNo.Size = 500; oralceComm.Parameters.Add(PVoucherItemNo); OracleParameter PVoucherNos = new OracleParameter("V_VOUCHERNO", OracleType.VarChar); PVoucherNos.Direction = ParameterDirection.Output; PVoucherNos.Size = 500; oralceComm.Parameters.Add(PVoucherNos); OracleParameter PVoucherStatus = new OracleParameter("V_VOUCHERSTATUS", OracleType.VarChar); PVoucherStatus.Direction = ParameterDirection.Output; PVoucherStatus.Size = 500; oralceComm.Parameters.Add(PVoucherStatus); OracleParameter PStoreNo = new OracleParameter("V_STORENO", OracleType.VarChar); PStoreNo.Direction = ParameterDirection.Output; PStoreNo.Size = 500; oralceComm.Parameters.Add(PStoreNo); OracleParameter PActivedTime = new OracleParameter("V_ACTIVEDTIME", OracleType.VarChar); PActivedTime.Direction = ParameterDirection.Output; PActivedTime.Size = 500; oralceComm.Parameters.Add(PActivedTime); OracleParameter PCertificatedTime = new OracleParameter("V_CERTIFICATEDTIME", OracleType.VarChar); PCertificatedTime.Direction = ParameterDirection.Output; PCertificatedTime.Size = 500; oralceComm.Parameters.Add(PCertificatedTime); OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar); PRtnMsg.Direction = ParameterDirection.Output; PRtnMsg.Size = 500; oralceComm.Parameters.Add(PRtnMsg); OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar); PRTNMSGNO.Size = 100; PRTNMSGNO.Direction = ParameterDirection.Output; oralceComm.Parameters.Add(PRTNMSGNO); oralceComm.ExecuteNonQuery(); resp.VoucherType = PVoucherType.Value.ToString(); resp.VoucherItemNo = PVoucherItemNo.Value.ToString(); resp.VoucherNos = PVoucherNos.Value.ToString(); resp.VoucherStatus = PVoucherStatus.Value.ToString(); resp.StoreNo = PStoreNo.Value.ToString(); resp.ActivedTime = PActivedTime.Value.ToString(); resp.CertificatedTime = PCertificatedTime.Value.ToString(); resp.RtnMsg = PRtnMsg.Value.ToString(); //RtnMsg = RtnMsg.Replace("~", "\r\n"); resp.RtnMsgNo = PRTNMSGNO.Value.ToString(); // dbConn.Close(); //result = RtnMsgNo; //return RtnMsgNo; } catch (Exception e) { // dbConn.Close(); resp.RtnMsgNo = "0"; resp.RtnMsg = "异常情况:" + e.Message.ToString(); //result = RtnMsgNo; } finally { resp.RtnMsg = WebServiceLib.NewLineString(resp.RtnMsg); } } return(resp); }
protected override VoucherBaseResp Execute(VoucherBaseReq baseReq) { var newReq = baseReq as VoucherQueryReq; var resp = new VoucherQueryResp(); string databasedws = System.Configuration.ConfigurationManager.AppSettings["DbConn"]; using (OracleConnection dbConn = new OracleConnection(databasedws)) { // OracleConnection dbConn = new OracleConnection(databasedws); dbConn.Open(); OracleCommand oralceComm = new OracleCommand("PG_VOUCHER.SP_VOUCHERQUERY", dbConn); //调用存储过程的方法 oralceComm.CommandType = CommandType.StoredProcedure; //存储过程名称 try { oralceComm.Parameters.Add(new OracleParameter("P_VOUCHERNO", OracleType.VarChar)).Value = newReq.VoucherNo; oralceComm.Parameters.Add(new OracleParameter("P_STORENO", OracleType.VarChar)).Value = newReq.StoreNo; OracleParameter PRtnMsg = new OracleParameter("V_RTNMSG", OracleType.VarChar); PRtnMsg.Direction = ParameterDirection.Output; PRtnMsg.Size = 500; oralceComm.Parameters.Add(PRtnMsg); OracleParameter PRTNMSGNO = new OracleParameter("V_RTNMSGNO", OracleType.VarChar); PRTNMSGNO.Size = 100; PRTNMSGNO.Direction = ParameterDirection.Output; oralceComm.Parameters.Add(PRTNMSGNO); oralceComm.ExecuteNonQuery(); resp.RtnMsg = PRtnMsg.Value.ToString(); //RtnMsg = RtnMsg.Replace("~", "\r\n"); // RtnMsg = RtnMsg + "\r\n sdsaddsa"; resp.RtnMsgNo = PRTNMSGNO.Value.ToString(); // dbConn.Close(); //result = RtnMsgNo; //return RtnMsgNo; } catch (Exception e) { // dbConn.Close(); resp.RtnMsg = "异常情况:" + e.Message.ToString(); //Sign = this.serviceCommon.CreateSign(string.Format("rtnMsg={0}&rtnMsgNo={1}", RtnMsg, RtnMsgNo)); resp.RtnMsgNo = "0"; //result = RtnMsgNo; } finally { resp.RtnMsg = WebServiceLib.NewLineString(resp.RtnMsg); } } return(resp); }