Ejemplo n.º 1
0
 public void Logout()
 {
     try
     {
         _salesforceService.logout();
     }
     catch (Exception exception)
     {
         throw new Exception("There was an error logging out from sales force.")
               {
                   Source = exception.Source
               };
     }
 }
Ejemplo n.º 2
0
 public void logout()
 {
     try
     {
         binding.logout();
         form1.updateTextBox5("");
         form1.updateTextBox4("Logged out.");
     }
     catch (SoapException e)
     {
         // Write the fault message to the console
         form1.updateTextBox4("An unexpected error has occurred: " + e.Message);
     }
 }
Ejemplo n.º 3
0
        private bool disposedValue = false;         // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    salesforceSoapService.logout();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Ejemplo n.º 4
0
        Get_syndicate_credentials(
            string inSyndicateCode,
            string inSiteID)
        {
            try
            {
                // load credentials from encrypted xml file
                getCredentialsFromXML();

                if (!sfCredentials.IsValid() ||
                    !this.loginToSalesforce(
                        sfCredentials,
                        out sfLoginResult))
                {
                    throw new Exception("Salesforce authentication failed");
                }

                // retrieve the account by site id and syndicate code
                SalesforceServiceRef.Account account = getSalesforceAccount(
                    inSiteID,
                    inSyndicateCode);

                if (account == null)
                {
                    throw new Exception("A matching account was not found on Salesforce");
                }

                // assign properties for trineo credentials from account
                trineoCredentials.Username  = account.Loyalty_Mate_Email__c;
                trineoCredentials.Password  = account.Loyalty_Mate_Password__c;
                trineoCredentials.Site_name = account.Loyalty_Mate_Subdomain__c;

                // logout from salesforce
                salesforceServiceClient.logout();
            }
            catch (Exception ex)
            {
                logger.ErrorException(
                    "Failed to get credentials for the trineo cloud",
                    ex);
                throw ex; // throwing the exception back to calling application so they know the login process failed
            }

            return(trineoCredentials);
        }
Ejemplo n.º 5
0
        private void logout()
        {
            try
            {
                binding.logout();
                Console.WriteLine("Logged out.");
            }
            catch (SoapException e)
            {
                // Write the fault code to the console
                Console.WriteLine(e.Code);

                // Write the fault message to the console
                Console.WriteLine("An unexpected error has occurred: " + e.Message);

                // Write the stack trace to the console
                Console.WriteLine(e.StackTrace);
            }
        }
Ejemplo n.º 6
0
 public void Dispose()
 {
     binding.logout();
 }
 public void logout()
 {
     binding.logout();
 }
Ejemplo n.º 8
0
 public void logout()  //function to logout
 {
     binding.logout(); //releases account from binding
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Logouts this instance.
 /// </summary>
 public void Logout()
 {
     _binding.logout();
     _binding.Dispose();
 }
Ejemplo n.º 10
0
        public IHttpActionResult Download(int id)
        {
            Models.Task task             = db.Tasks.Find(id);
            string[]    CaseNumArray     = new string[100];
            string[]    SubjectArray     = new string[100];
            string[]    OwnerArray       = new string[100];
            string[]    CreatorArray     = new string[100];
            double[]    TotalHoursArray  = new double[100];
            string[]    DescArray        = new string[100];
            DateTime[]  CreatedDateArray = new DateTime[100];
            InitializeAsync();

            void InitializeAsync()
            {
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;

                string user = "******";
                string pass = "******";

                binding         = new SforceService();
                binding.Timeout = 60000;

                WebReference.LoginResult lr;

                lr = binding.login(user, pass);

                string authEndPoint = binding.Url;

                binding.Url = lr.serverUrl;

                binding.SessionHeaderValue           = new SessionHeader();
                binding.SessionHeaderValue.sessionId = lr.sessionId;

                string soqlQuery = "SELECT Subject, CaseNumber, Owner.Name, CreatedDate, Total_Time_Logged__c, CreatedBy.Name, Description FROM Case where (Status = 'Case Opened' or Status = 'Case Assigned')" +
                                   "and (Owner.Name = 'Bradley Soverns' or Owner.Name = 'Edward Spain' or Owner.Name = 'Kyle McQuistion' or Owner.Name = 'Dan Dibble' or Owner.Name = 'Porfirio Esparra' or Owner.Name = 'Firaus Odeh')";

                QueryResult qr = binding.query(soqlQuery);

                sObject[] records = qr.records;

                if (qr.size > 0)
                {
                    Console.WriteLine("");

                    for (int i = 0; i < records.Length; i++)
                    {
                        Case T = (Case)records[i];
                        if (CaseNumArray.Contains(T.CaseNumber))
                        {
                            //Should avoid duplicate cases
                        }
                        else
                        {
                            Case c = (Case)records[i];

                            SubjectArray[i]     = c.Subject;
                            CaseNumArray[i]     = c.CaseNumber;
                            OwnerArray[i]       = c.Owner.Name1;
                            CreatorArray[i]     = c.CreatedBy.Name;
                            CreatedDateArray[i] = c.CreatedDate ?? DateTime.Now;
                            TotalHoursArray[i]  = c.Total_Time_Logged__c.Value;
                            DescArray[i]        = c.Description;

                            //Debug.WriteLine(c.CaseNumber + ": " + c.Subject + ": " + c.Owner.Name1 + ": " + c.CreatedBy.Name + ": " + c.CreatedDate + ": " + c.Total_Time_Logged__c);
                        }
                    }
                    logout();
                }
                for (int i = 0; id < records.Length; id++)
                {
                    decimal hours = (decimal)TotalHoursArray[i];
                    using (var ctx = new KanbanBoardWithSignalRAngularJSSolContext())
                    {
                        ctx.Tasks.Add(new Models.Task()
                        {
                            Id                 = task.Id,
                            Name               = SubjectArray[i],
                            Description        = DescArray[i],
                            ColumnId           = task.ColumnId,
                            EmployeeId         = task.EmployeeId,
                            DueDate            = task.DueDate,
                            selectedHours      = hours,
                            EmployeeName       = OwnerArray[i],
                            PmAssignedBy       = CreatorArray[i],
                            PercentageComplete = task.PercentageComplete,
                            CaseNumber         = CaseNumArray[i]
                        });
                        ctx.SaveChanges();
                    }
                }
            }

            void logout()
            {
                binding.logout();
            }

            return(Ok(task));
        }