protected override string GetQuery(CodeActivityContext context) { string tableId = TableID.Get(context); DateTime dueDate = DueDate.Get(context); string title = Title.Get(context); if (dueDate == null || dueDate == DateTime.MinValue) { dueDate = DateTime.Now.AddMonths(1); } var dict = DictionaryFields.Get(context); if (dict == null || dict.Count == 0) { var dataRow = DataRowFields.Get(context); var tempDict = dataRow.ToDictionary(); if (tempDict != null) { dict = tempDict; } } if (string.IsNullOrWhiteSpace(title) && dict?.Count > 0) { title = dict.First().Value.ToString(); } return(BuildQuery(tableId, title, dict, dueDate)); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var tableid = TableID.Get(context); var rownumber = RowNumber.Get(context); /////////////////////////// // Add execution logic HERE SAPAuto objSAPAuto = new SAPAuto(); objSAPAuto.TableRow_Select(tableid, rownumber); /////////////////////////// // Outputs return((ctx) => { }); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var tableid = TableID.Get(context); var rowindex = RowIndex.Get(context); var columnindex = ColumnIndex.Get(context); /////////////////////////// // Add execution logic HERE SAPAuto objSAPAuto = new SAPAuto(); context.SetValue(CellValue, objSAPAuto.Table_GetCellValue(tableid, rowindex, columnindex)); /////////////////////////// // Outputs return((ctx) => { CellValue.Set(ctx, null); }); }
protected override string GetQuery(CodeActivityContext context) { var tableId = TableID.Get(context); return(string.Format(GetTableQuery, tableId)); }
protected override void Execute(CodeActivityContext context) { System.Net.WebRequest req = System.Net.WebRequest.Create("https://app.pipefy.com/queries"); req.Proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; req.Timeout = 120000; req.Headers.Add("authorization", "Bearer " + Bearer.Get(context)); req.ContentType = "application/json"; req.Method = "POST"; byte[] bytes = System.Text.Encoding.UTF8.GetBytes("{ \"query\": \"mutation { deleteTable(input: { id: \"" + TableID.Get(context) + "\" }) { success } }\" }"); req.ContentLength = bytes.Length; System.IO.Stream os = req.GetRequestStream(); os.Write(bytes, 0, bytes.Length); os.Close(); System.Net.WebResponse resp = req.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream()); JArray array = new JArray(); JObject joResponse = JObject.Parse(sr.ReadToEnd()); Return.Set(context, joResponse.ToString()); }