protected internal string[] AuthenticateInternal(AuthenticatedTicket authenticatedTicket)
        {
            var ret = new string[4];

            ret[0] = authenticatedTicket.Ticket;
            ret[2] = string.Empty;
            ret[3] = string.Empty; // Not used

            if (authenticatedTicket.Authenticated == false)
            {
                ret[1] = "nvu"; // Invalid user
            }
            else
            {
                var waitTime = GetWaitTime(authenticatedTicket);
                if (waitTime == 0)
                {
                    ret[1] = GetCompanyFile(authenticatedTicket);
                }
                else
                {
                    ret[1] = "none"; // No work is necessary
                    ret[2] = waitTime.ToString();
                }
            }

            return(ret);
        }
示例#2
0
 /// <summary>
 /// Gets the options for the SyncManager.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <returns>Options.</returns>
 protected internal virtual QbXmlResponseOptions GetOptions(AuthenticatedTicket authenticatedTicket)
 {
     return(null);
 }
示例#3
0
 /// <summary>
 /// Process the response sent for the first time by the WebConnector.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <param name="response">First Message.</param>
 protected virtual void ProcessClientInformation(AuthenticatedTicket authenticatedTicket, string response)
 {
 }
示例#4
0
 /// <summary>
 /// Logs messages to a database.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket which has the ticket string. The ticket could also be not authenticated if an error happened.</param>
 /// <param name="messageType">Type of message.</param>
 /// <param name="direction">Direction of the message (In the WebService, or Out the WebService).</param>
 /// <param name="arguments">Other arguments to save.</param>
 protected internal virtual void LogMessage(AuthenticatedTicket authenticatedTicket, LogMessageType messageType, LogDirection direction, string ticket, params string[] arguments)
 {
 }
示例#5
0
 /// <summary>
 /// Indicates if there is anything to be done with the current ticket.
 /// Return 0 if you have work to do immediately. Otherwise return the number of seconds
 /// when you want the Web Connector to come back.
 /// </summary>
 /// <returns>Number of seconds to wait before the Web Connector comes back, or 0 to do some work right now.</returns>
 protected internal virtual int GetWaitTime(AuthenticatedTicket authenticatedTicket)
 {
     return(0);
 }
示例#6
0
 /// <summary>
 /// Called when an exception occurs.
 /// </summary>
 /// <param name="ticket">The ticket if found. It might be null if no ticket has been provided or if the code failed when trying to create the authenticated ticket.</param>
 /// <param name="exception">Exception.</param>
 protected internal virtual void OnException(AuthenticatedTicket ticket, Exception exception)
 {
 }
 /// <summary>
 /// Returns the path where the client company file is located.
 /// Override this method if you wish to open a different file than the current one open on the client.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <returns>Path where company file is located.</returns>
 protected internal virtual string GetCompanyFile(AuthenticatedTicket authenticatedTicket)
 {
     return(string.Empty); // Use the company that is opened on the client.
 }
示例#8
0
 public QbSyncException(AuthenticatedTicket ticket, Exception innerException)
     : base(null, innerException)
 {
     this.Ticket = ticket;
 }
示例#9
0
 /// <summary>
 /// Called when an exception occurs.
 /// </summary>
 /// <param name="ticket">The ticket if found. It might be null if no ticket has been provided or if the code failed when trying to create the authenticated ticket.</param>
 /// <param name="exception">Exception.</param>
 protected internal virtual void OnException(AuthenticatedTicket ticket, Exception exception)
 {
 }
示例#10
0
 /// <summary>
 /// Process the response sent for the first time by the WebConnector.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <param name="response">First Message.</param>
 protected virtual void ProcessClientInformation(AuthenticatedTicket authenticatedTicket, string response)
 {
 }
示例#11
0
 /// <summary>
 /// Logs messages to a database.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket which has the ticket string. The ticket could also be not authenticated if an error happened.</param>
 /// <param name="messageType">Type of message.</param>
 /// <param name="direction">Direction of the message (In the WebService, or Out the WebService).</param>
 /// <param name="arguments">Other arguments to save.</param>
 protected internal virtual void LogMessage(AuthenticatedTicket authenticatedTicket, LogMessageType messageType, LogDirection direction, string ticket, params string[] arguments)
 {
 }
示例#12
0
 /// <summary>
 /// Indicates if there is anything to be done with the current ticket.
 /// Return 0 if you have work to do immediately. Otherwise return the number of seconds
 /// when you want the Web Connector to come back.
 /// </summary>
 /// <returns>Number of seconds to wait before the Web Connector comes back, or 0 to do some work right now.</returns>
 protected internal virtual int GetWaitTime(AuthenticatedTicket authenticatedTicket)
 {
     return 0;
 }
示例#13
0
 /// <summary>
 /// Gets the options for the SyncManager.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <returns>Options.</returns>
 protected internal virtual QbXmlResponseOptions GetOptions(AuthenticatedTicket authenticatedTicket)
 {
     return null;
 }
示例#14
0
 /// <summary>
 /// Returns the path where the client company file is located.
 /// Override this method if you wish to open a different file than the current one open on the client.
 /// </summary>
 /// <param name="authenticatedTicket">The ticket.</param>
 /// <returns>Path where company file is located.</returns>
 protected internal virtual string GetCompanyFile(AuthenticatedTicket authenticatedTicket)
 {
     return string.Empty; // Use the company that is opened on the client.
 }
示例#15
0
 public QbSyncException(AuthenticatedTicket ticket, Exception innerException)
     : base(null, innerException)
 {
     this.Ticket = ticket;
 }