private void Button_Click(object sender, RoutedEventArgs e) { if (Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN) { AuthToken = Salesforce_Marketing_Cloud_Scope.Design_AUTH; ServiceURL = Salesforce_Marketing_Cloud_Scope.Design_SERVICES; } ConvertModelToString tmp = new ConvertModelToString(); String search = tmp.ConvertModelItem(ModelItem.Properties["Search"].ComputedValue); if (search == null) { search = ""; } if (search.Trim().Length < 2) { search = "SELECT ID,EmailAddress,CreatedDate,Client.ID,PartnerKey,SubscriberKey FROM Subscriber WHERE ID>1"; } SelectWizard wizard = new SelectWizard(AuthToken, ServiceURL, search, "Subscriber"); wizard.ShowDialog(); if (wizard.SaveSearch) { ModelItem.Properties["Search"].SetValue(new InArgument <string> { Expression = new Literal <string>(wizard.SelectCMD) }); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN) { AuthToken = Salesforce_Marketing_Cloud_Scope.Design_AUTH; ServiceURL = Salesforce_Marketing_Cloud_Scope.Design_SERVICES; } ConvertModelToString tmp = new ConvertModelToString(); String search = tmp.ConvertModelItem(ModelItem.Properties["Search"].ComputedValue); if (search == null) { search = ""; } if (search.Trim().Length < 2) { search = "SELECT Name,Type,Status,ExpectedResponse,NumberSent,NumberOfLeads,NumberOfConvertedLeads,NumberOfContacts,NumberOfResponses,NumberOfOpportunities,NumberOfWonOpportunities,AmountAllOpportunities,AmountWonOpportunities,Owner.Name,CreatedDate,LastModifiedDate FROM Campaign WHERE isActive=TRUE LIMIT 100"; } SelectWizard wizard = new SelectWizard(AuthToken, ServiceURL, search, "campaigns"); wizard.ShowDialog(); if (wizard.SaveSearch) { ModelItem.Properties["Search"].SetValue(new InArgument <string> { Expression = new Literal <string>(wizard.SelectCMD) }); } }
private async void btConnection_Click(object sender, RoutedEventArgs e) { ConvertModelToString tmp = new ConvertModelToString(); Salesforce_Marketing_Cloud_Scope.Design_ServiceURL = "" + tmp.ConvertModelItem(ModelItem.Properties["ServiceURL"].ComputedValue); Salesforce_Marketing_Cloud_Scope.Design_KEY = "" + tmp.ConvertModelItem(ModelItem.Properties["ConsumerKey"].ComputedValue); Salesforce_Marketing_Cloud_Scope.Design_SECRET = "" + tmp.ConvertModelItem(ModelItem.Properties["ConsumerSecret"].ComputedValue); Salesforce_Marketing_Cloud_Scope.Design_USER = "" + tmp.ConvertModelItem(ModelItem.Properties["UserName"].ComputedValue); Salesforce_Marketing_Cloud_Scope.Design_PASSWORD = "" + tmp.ConvertModelItem(ModelItem.Properties["Password"].ComputedValue); btConnection.IsEnabled = false; var task2 = await(new CmdRestAPI(new InitConnectionData().ReturnDict())).ExecuteAsync(); CommandResult tmpwindow; if (task2.ValidConnection) { Salesforce_Marketing_Cloud_Scope.Design_AUTH = task2.RespAuthToken; Salesforce_Marketing_Cloud_Scope.Design_SERVICES = task2.RespServiceURL; Salesforce_Marketing_Cloud_Scope.Design_SOAP = task2.RespSoapClient; Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN = true; tmpwindow = new CommandResult(true, task2.RespAuthToken, task2.RespServiceURL, task2.RespAuthToken, task2.RespServiceURL, "", Type_of_Command.Connection); } else { Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN = false; tmpwindow = new CommandResult(false, task2.RespAuthToken, task2.RespServiceURL, task2.RespAuthToken, task2.RespServiceURL, "", Type_of_Command.Connection); } tmpwindow.Show(); btConnection.IsEnabled = true; }
private void Button_Click(object sender, RoutedEventArgs e) { if (Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN) { AuthToken = Salesforce_Marketing_Cloud_Scope.Design_AUTH; ServiceURL = Salesforce_Marketing_Cloud_Scope.Design_SERVICES; } //Command has issues ConvertModelToString tmp = new ConvertModelToString(); String search = tmp.ConvertModelItem(ModelItem.Properties["Search"].ComputedValue); if (search == null) { search = ""; } if (search.Trim().Length < 2) { search = "SELECT ID,Name,Client.ID,PartnerKey,Type,CreatedDate,ModifiedDate,CustomerKey,ObjectID,ObjectState FROM DataExtension WHERE ID>1"; } SelectWizard wizard = new SelectWizard(AuthToken, ServiceURL, search, "DataExtensionObject"); wizard.ShowDialog(); if (wizard.SaveSearch) { ModelItem.Properties["Search"].SetValue(new InArgument <string> { Expression = new Literal <string>(wizard.SelectCMD) }); } }
private void Button_Click(object sender, RoutedEventArgs e) { ConvertModelToString tmp = new ConvertModelToString(); Int32 cmd_Type = Convert.ToInt32(ModelItem.Properties["cmdTYPE"].ComputedValue); ParametersWizard wizard = new ParametersWizard(ModelItem, cmd_Type, "", ""); wizard.ShowOkCancel(); }
private void Button_Click(object sender, RoutedEventArgs e) { ConvertModelToString tmp = new ConvertModelToString(); Int32 cmd_Type = Convert.ToInt32(ModelItem.Properties["cmdTYPE"].ComputedValue); String ID2 = tmp.ConvertModelItem(ModelItem.Properties["CampaignID"].ComputedValue); if (ID2 == null) { ID2 = ""; } ParametersWizard wizard = new ParametersWizard(ModelItem, cmd_Type, "", ID2); wizard.ShowOkCancel(); }
private async void Button_Click(object sender, RoutedEventArgs e) { String Error = ""; btTest.IsEnabled = false; try { if ((Salesforce_Marketing_Cloud_Scope.Design_AUTH == null) || (Salesforce_Marketing_Cloud_Scope.Design_AUTH.Trim().Length < 1)) { var task2 = await(new CmdRestAPI(new InitConnectionData().ReturnDict())).ExecuteAsync(); if (task2.ValidConnection) { Salesforce_Marketing_Cloud_Scope.Design_AUTH = task2.RespAuthToken; Salesforce_Marketing_Cloud_Scope.Design_SERVICES = task2.RespServiceURL; Salesforce_Marketing_Cloud_Scope.Design_SOAP = task2.RespSoapClient; Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN = true; } } } catch (Exception ex) { Error = ex.ToString(); } btTest.IsEnabled = true; ConvertModelToString tmp = new ConvertModelToString(); String search = tmp.ConvertModelItem(ModelItem.Properties["Search"].ComputedValue); if (search == null) { search = ""; } SelectWizard wizard = new SelectWizard(Salesforce_Marketing_Cloud_Scope.Design_AUTH, Salesforce_Marketing_Cloud_Scope.Design_SERVICES, search); wizard.ShowDialog(); if (wizard.SaveSearch) { ModelItem.Properties["Search"].SetValue(new InArgument <string> { Expression = new Literal <string>(wizard.SelectCMD) }); } }
private async void Run_cmd_Click(object sender, RoutedEventArgs e) { String Error = ""; btnRunCMD.Content = "Wait ..."; btnMandatory.IsEnabled = false; btnAddParam.IsEnabled = false; btnGetExample.IsEnabled = false; btnRunCMD.IsEnabled = false; var newDataTable = new System.Data.DataTable(); newDataTable.Columns.Add(new DataColumn("Parameter", typeof(string)) { MaxLength = 200 }); newDataTable.Columns.Add(new DataColumn("Value", typeof(string)) { MaxLength = 60000 }); newDataTable.Columns.Add(new DataColumn("isEnabled", typeof(Boolean)) { DefaultValue = true }); ConvertModelToString tmp = new ConvertModelToString(); Boolean ValidParam; foreach (ParametersViewModel item in Parameters) { ValidParam = true; try { var row = newDataTable.NewRow(); String str = tmp.ConvertModelItem(ModelItemToArgument(item.Parameter)); if (str.Length > 1) { if (str[0] == '"') { str = str.Remove(0, 1); str = str.Remove(str.Length - 1, 1); } } if (str.Trim().Length < 1) { ValidParam = false; } row["Parameter"] = str; str = tmp.ConvertModelItem(ModelItemToArgument(item.ValueData)); if (str.Length > 1) { if (str[0] == '"') { str = str.Remove(0, 1); str = str.Remove(str.Length - 1, 1); } } row["Value"] = str; row["isEnabled"] = item.isEnabled; if (ValidParam) { newDataTable.Rows.Add(row); } } catch (Exception ex) { Error = ex.ToString(); } } Boolean valid = false; var task = await(new CmdRestAPI(AuthToken, ServiceURL, Salesforce_Marketing_Cloud_Scope.Design_SOAP, newDataTable, ServiceName, IdDecision, NameDecision, CmdTYPE)).ExecuteAsync(); if (task.ValidConnection) { valid = true; } else { if (!Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN) { Init_Connection(); var task2 = await(new CmdRestAPI(dictionaryForUrl)).ExecuteAsync(); if (task2.ValidConnection) { AuthToken = task2.RespAuthToken; ServiceURL = task2.RespServiceURL; Salesforce_Marketing_Cloud_Scope.Design_AUTH = AuthToken; Salesforce_Marketing_Cloud_Scope.Design_SERVICES = ServiceURL; Salesforce_Marketing_Cloud_Scope.Design_SOAP = task2.RespSoapClient; Salesforce_Marketing_Cloud_Scope.Design_VALIDCONN = true; } System.Threading.Thread.Sleep(500); task = await(new CmdRestAPI(AuthToken, ServiceURL, task2.RespSoapClient, newDataTable, ServiceName, IdDecision, NameDecision, CmdTYPE)).ExecuteAsync(); if (task.ValidConnection) { valid = true; } } else { CommandResult tmpwindow = new CommandResult(false, task.Response, task.ID, AuthToken, ServiceURL, ServiceName, CmdTYPE); tmpwindow.Show(); } } if (valid) //MessageBox.Show("Valid command." + Environment.NewLine + Environment.NewLine + "Response: " + task.Response + Environment.NewLine + Environment.NewLine + "ID: " + task.ID); { CommandResult tmpwindow = new CommandResult(true, task.Response, task.ID, AuthToken, ServiceURL, ServiceName, CmdTYPE); tmpwindow.Show(); } btnRunCMD.Content = "Run command"; btnMandatory.IsEnabled = true; btnAddParam.IsEnabled = true; btnGetExample.IsEnabled = true; btnRunCMD.IsEnabled = true; }