コード例 #1
0
    private bool ValidateInput()
    {
        List <string> errors = new List <string>();

        if (String.IsNullOrEmpty(ExternalAttributeDropDownListEx.SelectedValue))
        {
            errors.Add(GetString("sf.mapping.noexternalattributeselected"));
        }
        foreach (EntityAttributeModel attributeModel in AttributeModels.Where(x => !x.IsNullable && !x.HasDefaultValue))
        {
            MappingEditorItem control = null;
            if (MappingItems.TryGetValue(attributeModel.Name, out control))
            {
                if (control.MappingItem == null)
                {
                    string error = String.Format(GetString("sf.mapping.requiredattributemappingmissing"), attributeModel.Label);
                    errors.Add(error);
                }
            }
        }
        if (errors.Count > 0)
        {
            SalesForceError.Report(GetString("sf.mapping.validationerror"), errors);
            return(false);
        }

        return(true);
    }
コード例 #2
0
 protected void ConfirmButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(ClientIdentifierTextBox.Text) || String.IsNullOrEmpty(ClientSecretTextBox.Text))
     {
         SalesForceError.Report(GetString("sf.authorization.missingconsumerinput"));
     }
     else
     {
         Credentials.ClientId     = ClientIdentifierTextBox.Text;
         Credentials.ClientSecret = ClientSecretTextBox.Text;
         try
         {
             StoreParameters();
             SalesForceAuthorizationHelper authorizationHelper = new SalesForceAuthorizationHelper(Credentials.ClientId, Credentials.ClientSecret, RedirectUrl);
             string authorizationUrl = authorizationHelper.GetAuthorizationUrl(ParametersId);
             Response.Redirect(authorizationUrl, false);
         }
         catch (Exception exception)
         {
             HandleError(exception);
         }
     }
 }
コード例 #3
0
 private void HandleError(Exception exception)
 {
     SalesForceError.Report(exception);
     EventLogProvider.LogException("Salesforce.com Connector", "MappingEditorPage", exception);
 }
コード例 #4
0
 private void HandleError(Exception exception)
 {
     SalesForceError.Report(exception);
     EventLogProvider.LogException("Salesforce.com Connector", "ScoreFormControl", exception);
 }
コード例 #5
0
 private void HandleError(Exception exception)
 {
     SalesForceError.Report(exception);
     Service.Resolve <IEventLogService>().LogException("Salesforce.com Connector", "MappingFormControl", exception);
 }
コード例 #6
0
 private void HandleError(Exception exception)
 {
     SalesForceError.Report(exception);
     EventLogProvider.LogException("Salesforce.com Connector", "AuthorizationSetupPage", exception);
 }
コード例 #7
0
 private void HandleError(Exception exception)
 {
     SalesForceError.Report(exception);
     Service.Resolve <IEventLogService>().LogException("Salesforce.com Connector", "AuthorizationSetupPage", exception);
 }
コード例 #8
0
        /// <summary>
        /// Execute the snippet.
        /// </summary>
        public void Execute()
        {
            View.SetErrors(null);

            // check if log exists and create one if it doesn't
            bool        logExists = false;
            LogListener log       = null;

            foreach (LogListener l in Project.Client.Diagnostic.GetLogListeners())
            {
                if (l.TracedEntityId == Project.Client.User.Id)
                {
                    // if there is an expired log delete it
                    if (l.ExpirationDate < DateTime.Now)
                    {
                        Project.Client.Diagnostic.DeleteLogListener(l);
                    }
                    else
                    {
                        logExists = true;
                        log       = l;
                        break;
                    }
                }
            }

            if (!logExists)
            {
                log = Project.Client.Diagnostic.CreateLogListener(
                    Project.Client.User.Id,
                    Project.Client.User.Name,
                    Project.Client.User.Id,
                    Project.Client.User.Name,
                    DateTime.Now.AddHours(1),
                    LogLevel.Debug,
                    LogLevel.Error,
                    LogLevel.Fine,
                    LogLevel.Error,
                    LogLevel.Error,
                    LogLevel.Error,
                    LogLevel.Error,
                    LogLevel.Error);
            }

            // execute the code
            SalesForceError result = Project.Client.Diagnostic.ExecuteSnippet(View.Text);

            if (result != null)
            {
                View.SetErrors(new string[] { result.ToString() });
            }

            // show results
            if (result == null || result.StatusCode != "COMPILE FAILURE")
            {
                LogViewerDocument logViewer = null;
                IDocument[]       documents = App.Instance.Content.GetDocumentsByEntity(log);
                foreach (IDocument document in documents)
                {
                    if (document is LogViewerDocument)
                    {
                        logViewer = document as LogViewerDocument;
                        break;
                    }
                }

                if (logViewer == null)
                {
                    logViewer = new LogViewerDocument(Project, log);
                    App.Instance.Content.OpenDocument(logViewer);
                    logViewer.Refresh();
                    logViewer.SelectFirstLog();
                }
                else
                {
                    App.Instance.Content.ActiveDocument = logViewer;
                    logViewer.Refresh();
                    logViewer.SelectFirstLog();
                }
            }

            // delete log listener if it was created just for this
            if (!logExists)
            {
                Project.Client.Diagnostic.DeleteLogListener(log);
            }
        }