Exemple #1
0
 public DataTable GetDataFromDBAPI(string BALMatterNo)
 {
     try
     {
         AppSettingsValues appKeys     = GetAppSettings.GetAppSettingsValues();
         string            queryString = "api/SQL9035?BALMatterNo=" + BALMatterNo;
         string            response    = api.Get(appKeys.DbAutomation_Authority, "", queryString);
         DataTable         dt          = (DataTable)JsonConvert.DeserializeObject(response, (typeof(DataTable)));
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 // GETS Orchestrator Token
 public string Authentication(bool isCloudEnv)
 {
     try
     {
         string Url = "";
         Dictionary <string, string> authBody = new Dictionary <string, string>();
         string body     = "";
         string response = "";
         //appSettings = GetAppSettings.GetInstance;
         appKeys = GetAppSettings.GetAppSettingsValues();
         if (isCloudEnv == false)
         {
             Url = appKeys.OrchestratorUrl + "api/Account/Authenticate";
             if (appKeys.tenancyName != "")
             {
                 authBody.Add("tenancyName", appKeys.tenancyName);
             }
             authBody.Add("usernameOrEmailAddress", appKeys.usernameOrEmailAddress);
             authBody.Add("password", appKeys.password);
             body     = JsonConvert.SerializeObject(authBody);
             response = api.Post(Url, body);
             OrchestratorAuthenticateModel authenticateModel = JsonConvert.DeserializeObject <OrchestratorAuthenticateModel>(response);
             return(authenticateModel.result.ToString());
         }
         else
         {
             Url      = "https://account.uipath.com/oauth/token";
             authBody = new Dictionary <string, string>();
             authBody.Add("grant_type", "refresh_token");
             authBody.Add("client_id", "8DEv1AMNXczW3y4U15LL3jYf62jK93n5");
             authBody.Add("refresh_token", "T_a1NEpX6dShm2BksNE4-eDT_-foVjJLE3ntzcz5-_sUC");
             body     = JsonConvert.SerializeObject(authBody);
             response = api.PostCloud(Url, body, true);
             OrchestratorAuthenticateModel authenticateModel = JsonConvert.DeserializeObject <OrchestratorAuthenticateModel>(response);
             return(authenticateModel.access_token.ToString());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }