protected override void Execute(CodeActivityContext context) { try { string str = context.GetValue(this.StringValue); string add = context.GetValue(this.Add); string resultString = Regex.Match(str, @"\d+").Value; long num = Convert.ToInt64(resultString); Console.WriteLine(resultString); num += Convert.ToInt64(add); int length = resultString.Length; string asString = num.ToString("D" + length); Console.WriteLine("Updated num string: " + asString); string sub = str.Substring(0, 3); string final = string.Concat(sub, asString); Console.WriteLine("Final string: " + final); UpdatedValue.Set(context, final); } catch (Exception ex) { Console.WriteLine(ex.Message); Exception.Set(context, ex); throw ex; } }
protected override void Execute(CodeActivityContext context) { try { string str = context.GetValue(this.StringNum); string add = context.GetValue(this.Add); long n = Convert.ToInt64(str); long i = Convert.ToInt64(add); long sum = n + i; string final = Convert.ToString(sum); Console.WriteLine("Final string: " + final); UpdatedValue.Set(context, final); } catch (Exception ex) { Console.WriteLine(ex.Message); Exception.Set(context, ex); throw ex; } }