public MdoQuery buildRpcRequest(string rpcName, string[] paramValues, int[] paramTypes, bool[] paramEncrypted) { if (String.IsNullOrEmpty(rpcName)) { throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "rpcName must be specified"); } if (paramValues.Length != paramTypes.Length || paramValues.Length != paramEncrypted.Length) { throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "paramValues, paramTypes and paramEncrpted must be the same size"); } VistaQuery vq = new VistaQuery(rpcName); for (int n = 0; n < paramValues.Length; n++) { if (paramEncrypted[n]) { vq.addEncryptedParameter(paramTypes[n], paramValues[n]); } else { vq.addParameter(paramTypes[n], paramValues[n]); } } return(vq); }
internal string login(AbstractCredentials credentials) { if (String.IsNullOrEmpty(credentials.AccountName)) { throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Missing Access Code"); } if (String.IsNullOrEmpty(credentials.AccountPassword)) { throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Missing Verify Code"); } VistaQuery vq = new VistaQuery("XUS SIGNON SETUP"); string rtn = (string)Cxn.query(vq); if (rtn == null) { throw new UnexpectedDataException("Unable to setup authentication"); } vq = new VistaQuery("XUS AV CODE"); // This is here so we can test with MockConnection if (Cxn.GetType().Name != "MockConnection") { vq.addEncryptedParameter(vq.LITERAL, credentials.AccountName + ';' + credentials.AccountPassword); } else { vq.addParameter(vq.LITERAL, credentials.AccountName + ';' + credentials.AccountPassword); } rtn = (string)Cxn.query(vq); //TODO - need to catch renew verify id error string[] flds = StringUtils.split(rtn, StringUtils.CRLF); if (flds[0] == "0") { throw new UnauthorizedAccessException(flds[3]); } AccountId = flds[0]; // Set the connection's UID Cxn.Uid = AccountId; // Save the credentials credentials.LocalUid = AccountId; credentials.AuthenticationSource = Cxn.DataSource; credentials.AuthenticationToken = Cxn.DataSource.SiteId.Id + '_' + AccountId; IsAuthenticated = true; Cxn.IsRemote = false; // Set the greeting if there is one if (flds.Length > 7) { return(flds[7]); } return("OK"); }
internal MdoQuery buildSetContextRequest(string context) { VistaQuery vq = new VistaQuery("XWB CREATE CONTEXT"); if (Cxn.GetType().Name != "MockConnection") { vq.addEncryptedParameter(vq.LITERAL, context); } else { vq.addParameter(vq.LITERAL, context); } return(vq); }
public MdoQuery buildRpcRequest(string rpcName, string[] paramValues, int[] paramTypes, bool[] paramEncrypted) { if (String.IsNullOrEmpty(rpcName)) { throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "rpcName must be specified"); } if (paramValues.Length != paramTypes.Length || paramValues.Length != paramEncrypted.Length) { throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "paramValues, paramTypes and paramEncrpted must be the same size"); } VistaQuery vq = new VistaQuery(rpcName); for (int n = 0; n < paramValues.Length; n++) { if (paramEncrypted[n]) vq.addEncryptedParameter(paramTypes[n], paramValues[n]); else vq.addParameter(paramTypes[n], paramValues[n]); } return vq; }
internal MdoQuery buildSendOrderByPolicyRequest(string dfn, string locIen, string esig, Order order) { VistaQuery vq = new VistaQuery("ORWDX SEND"); vq.addParameter(vq.LITERAL, dfn); vq.addParameter(vq.LITERAL, "0"); vq.addParameter(vq.LITERAL, locIen); vq.addEncryptedParameter(vq.LITERAL, ' ' + esig); //' ' apparently needed to avoid a bug in Vista? See CPRS. DictionaryHashList lst = new DictionaryHashList(); String value = order.Id + '^' + VistaConstants.SS_ESIGNED + '^' + VistaConstants.RS_RELEASE + '^' + VistaConstants.NO_POLICY; lst.Add("1", value); vq.addParameter(vq.LIST, lst); return vq; }
internal void sendOrder(String locIen, String esig, Order order) { VistaQuery vq = new VistaQuery("ORWDX SEND"); vq.addParameter(vq.LITERAL, cxn.Pid); vq.addParameter(vq.LITERAL, "0"); vq.addParameter(vq.LITERAL, locIen); vq.addEncryptedParameter(vq.LITERAL, ' ' + esig); //' ' apparently needed to avoid a bug in Vista? See CPRS. DictionaryHashList lst = new DictionaryHashList(); string value = order.Id + '^' + VistaConstants.SS_ESIGNED + '^' + VistaConstants.RS_RELEASE + '^' + VistaConstants.NO_POLICY; lst.Add("1", value); vq.addParameter(vq.LIST, lst); string rtn = (string)cxn.query(vq); string[] flds = StringUtils.split(rtn, StringUtils.CARET); flds[1] = flds[1].TrimEnd(null); if (flds[1] == "RS") { order.Status = "Released"; } else { order.Status = "Error: " + flds[3]; throw new MdoException(MdoExceptionCode.ARGUMENT_INVALID, "Error: This order has been signed!"); } }
internal string login(AbstractCredentials credentials) { if (String.IsNullOrEmpty(credentials.AccountName)) { throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Missing Access Code"); } if (String.IsNullOrEmpty(credentials.AccountPassword)) { throw new MdoException(MdoExceptionCode.ARGUMENT_NULL, "Missing Verify Code"); } VistaQuery vq = new VistaQuery("XUS SIGNON SETUP"); string rtn = (string)Cxn.query(vq); if (rtn == null) { throw new UnexpectedDataException("Unable to setup authentication"); } vq = new VistaQuery("XUS AV CODE"); // This is here so we can test with MockConnection if (Cxn.GetType().Name != "MockConnection") { vq.addEncryptedParameter(vq.LITERAL, credentials.AccountName + ';' + credentials.AccountPassword); } else { vq.addParameter(vq.LITERAL, credentials.AccountName + ';' + credentials.AccountPassword); } rtn = (string)Cxn.query(vq); //TODO - need to catch renew verify id error string[] flds = StringUtils.split(rtn, StringUtils.CRLF); if (flds[0] == "0") { throw new UnauthorizedAccessException(flds[3]); } AccountId = flds[0]; // Set the connection's UID Cxn.Uid = AccountId; // Save the credentials credentials.LocalUid = AccountId; credentials.AuthenticationSource = Cxn.DataSource; credentials.AuthenticationToken = Cxn.DataSource.SiteId.Id + '_' + AccountId; IsAuthenticated = true; Cxn.IsRemote = false; // Set the greeting if there is one if (flds.Length > 7) { return flds[7]; } return "OK"; }
internal MdoQuery buildSetContextRequest(string context) { VistaQuery vq = new VistaQuery("XWB CREATE CONTEXT"); if (Cxn.GetType().Name != "MockConnection") { vq.addEncryptedParameter(vq.LITERAL, context); } else { vq.addParameter(vq.LITERAL, context); } return vq; }
//----------------------------------------------------------------------------------------- internal MdoQuery buildSetContextRequest(string context) { VistaQuery vq = new VistaQuery("XWB CREATE CONTEXT"); vq.addEncryptedParameter(vq.LITERAL, context); return vq; }
//DP 5/23/2011 Added guard clause to this query builder methos so it will not save a (one time valid) //encrypted string in the mock connection file. internal MdoQuery buildIsValidEsigRequest(string esig) { VistaQuery vq = new VistaQuery("ORWU VALIDSIG"); if (cxn.GetType().Name != "MockConnection") { vq.addEncryptedParameter(vq.LITERAL, esig); } else { vq.addParameter(vq.LITERAL, esig); } //vq.addParameter(vq.LITERAL, esig); return vq; }