//Constructor: Initializes the V1 instance connection. public VersionOneClient(IntegrationConfiguration Config, Logger Logger) { _logger = Logger; _config = Config; _V1_META_URL = Config.V1Connection.Url + "/meta.v1/"; _V1_DATA_URL = Config.V1Connection.Url + "/rest-1.v1/"; V1APIConnector metaConnector = new V1APIConnector(_V1_META_URL); V1APIConnector dataConnector; //Set V1 connection based on authentication type. if (_config.V1Connection.UseWindowsAuthentication == true) { _logger.Debug("-> Connecting with Windows Authentication."); //If username is not specified, try to connect using domain credentials. if (String.IsNullOrEmpty(_config.V1Connection.Username)) { _logger.Debug("-> Connecting with default Windows domain account: {0}\\{1}", Environment.UserDomainName, Environment.UserName); dataConnector = new V1APIConnector(_V1_DATA_URL); } else { _logger.Debug("-> Connecting with specified Windows domain account: {0}", _config.V1Connection.Username); dataConnector = new V1APIConnector(_V1_DATA_URL, _config.V1Connection.Username, _config.V1Connection.Password, true); } } else { _logger.Debug("-> Connecting with V1 account credentials: {0}", _config.V1Connection.Username); dataConnector = new V1APIConnector(_V1_DATA_URL, _config.V1Connection.Username, _config.V1Connection.Password); } _v1Meta = new MetaModel(metaConnector); _v1Data = new Services(_v1Meta, dataConnector); }
static void Main(string[] args) { try { //Start logging. CreateLogHeader(); //Initialize config file. _logger.Info("Initializing configurations."); _config = (IntegrationConfiguration)ConfigurationManager.GetSection("integration"); //Verify configurations. _logger.Info("Verifying configurations."); VerifyV1Configuration(); //**** Get HelpStar tickets code goes here. Perhaps calling a stored procedure in the HS DB? **** //**** Process HelpStar tickets code goes here. Should loop through the results and process accordingly. **** _logger.Info("Integration processing complete."); } catch (Exception ex) { _logger.Error("ERROR: " + ex.Message); _logger.Info("Integration processing terminated."); } finally { _logger.Info(String.Empty); _logger.Info(String.Empty); //DEBUG ONLY: Console.Write("\nPress ENTER to close... "); Console.ReadLine(); } Environment.Exit(0); }