public void Each() { var dict = new Dictionary<int, string>() { { 1, "one" }, { 2, "two" } }; var res = ""; dict.Each((i, s) => res += i + s + ","); Assert.AreEqual("1one,2two,", res); }
public void Copy_Razor_files_to_AWS_Bucket() { var fs = new FileSystemVirtualPathProvider(appHost, "~/../RazorRockstars.WebHost".MapHostAbsolutePath()); var skipDirs = new[] { "bin", "obj" }; var matchingFileTypes = new[] { "cshtml", "md", "css", "js", "png", "jpg" }; var replaceHtmlTokens = new Dictionary<string, string> { { "title-bg.png", "title-bg-aws.png" }, //Title Background { "https://gist.github.com/3617557.js", "https://gist.github.com/mythz/396dbf54ce6079cc8b2d.js" }, //AppHost.cs { "https://gist.github.com/3616766.js", "https://gist.github.com/mythz/ca524426715191b8059d.js" }, //S3 RockstarsService.cs { "RazorRockstars.WebHost/RockstarsService.cs", "RazorRockstars.S3/RockstarsService.cs" }, //S3 RockstarsService.cs { "http://github.com/ServiceStackApps/RazorRockstars/", "https://github.com/ServiceStackApps/RazorRockstars/tree/master/src/RazorRockstars.S3" } //Link to GitHub project }; foreach (var file in fs.GetAllFiles()) { if (skipDirs.Any(x => file.VirtualPath.StartsWith(x))) continue; if (!matchingFileTypes.Contains(file.Extension)) continue; if (file.Extension == "cshtml") { var html = file.ReadAllText(); replaceHtmlTokens.Each(x => html = html.Replace(x.Key, x.Value)); s3.WriteFile(file.VirtualPath, html); } else { s3.WriteFile(file); } } }
private static ScriptContext LispNetContext(Dictionary <string, object> args = null) { var context = new ScriptContext { ScriptLanguages = { ScriptLisp.Language }, ScriptMethods = { new ProtectedScripts(), }, AllowScriptingOfAllTypes = true, ScriptNamespaces = { "System", "System.Collections.Generic", "ServiceStack", typeof(StaticLog).Namespace, }, ScriptTypes = { typeof(DynamicInt), } }; args?.Each((k, v) => context.Args[k] = v); return(context.Init()); }
private static List <ExcelImportErroInfo> GetDataTypeError <T>(Dictionary <PropertyInfo, string> needDataTypeValdiate, T info, dynamic originalInfo) { var errors = new List <ExcelImportErroInfo>(); needDataTypeValdiate.Each(requie => { var properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance); properties.Each(x => { var dataTypeAttribute = requie.Key.GetCustomAttribute <DataTypeValidAttribute>(); var columnNameAttribute = x.GetCustomAttribute <ColumnNameAttribute>(); if (dataTypeAttribute != null && columnNameAttribute != null && dataTypeAttribute.ColumnName == columnNameAttribute.ColumnName) { var val = x.GetValue(originalInfo, null); if (val != null && val.ToString() != string.Empty) { List <ExcelImportErroInfo> error = ConvertDataType <T>(requie, info, originalInfo, val); if (error.Any()) { errors.AddRange(error); } } } }); }); return(errors); }
/// <summary> /// Alias for RenderScriptAsync /// </summary> public static async Task <string> EvaluateScriptAsync(this ScriptContext context, string script, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.SharpScriptPage(script)); args.Each((x, y) => pageResult.Args[x] = y); return(await pageResult.RenderScriptAsync()); }
//To get all items by running this on all tickers. public static void GetAllFRItemFromNASDAQ(string[] tickers, string reportType) { string periodType = "Annual"; string numPeriods = "10"; string reportParam = FinancialReportsConfig.params_NASDAQ[reportType]; string periodParam = FinancialReportsConfig.params_NASDAQ[periodType]; var keys = (Dictionary<string, int>)FinancialReportsConfig.mappings_NASDAQ[reportType]; List<string[]> list = new List<string[]>(); list.Add(new string[] { "ticker", "not in key", "previous key", "next key", "number" }); foreach (string ticker in tickers) { Dictionary<string, object> data = new Dictionary<string, object>(); try { WebData webData = new WebData(string.Format(Constants.NASDAQFinancialReportingURL, reportParam, periodParam, numPeriods, ticker)); data = webData.ReadNASDAQFRHtmlTable().ElementAt(1); } catch { } data.Each((d, i) => { int nexti = i + 1 == data.Count ? i : i + 1; if (!keys.ContainsKey(d.Key)) list.Add(new string[] { ticker, d.Key, data.ElementAt(i - 1).Key, data.ElementAt(nexti).Key, i.ToString() }); } ); //list.Add(new string[]{"","","","",""}); } Excel.Worksheet ws = ExcelUtil.Worksheet("Test_" + reportType); ws.Range("A2").Resize(list.Count, list[0].Length).Formula = ExcelUtil.To2DArray(list); }
public void ToBool() { object o = null; Assert.AreEqual(false, o.To <bool>(false), $" [object (null)].To<bool>(false) --> { false }"); o = true; Assert.AreEqual(true, o.To <bool>(), $" [object (true)].To<bool>() --> { true }"); var dict = new Dictionary <string, Boolean> { ["1"] = true, ["TRUE"] = true, ["-1"] = true, ["0"] = false, ["FALSE"] = false, ["checked"] = true, ["yes"] = true, ["no"] = false }; dict.Each(kv => Assert.AreEqual(kv.Value, kv.Key.To <bool>())); Assert.AreEqual(true.ToString(), true.To <string>(), $"'{ true }'.To<string>() --> { true }"); Assert.AreEqual(false.ToString(), false.To <string>(), $"'{ false }'.To<string>() --> { false }"); TestInvalidInputs(true); }
public static TemplateScopeContext CreateScopedContext(this TemplateScopeContext scope, string template, Dictionary <string, object> scopeParams = null, bool cachePage = true) { TemplatePage dynamicPage = null; if (cachePage) { scope.Context.Cache.TryGetValue(template, out object value); dynamicPage = value as TemplatePage; } if (dynamicPage == null) { dynamicPage = scope.Context.OneTimePage(template); if (cachePage) { scope.Context.Cache[template] = dynamicPage; } } var newScopeParams = new Dictionary <string, object>(scope.ScopedParams); scopeParams.Each((key, val) => newScopeParams[key] = val); var pageResult = scope.PageResult.Clone(dynamicPage).Init().Result; var itemScope = new TemplateScopeContext(pageResult, scope.OutputStream, newScopeParams); return(itemScope); }
public static string EvaluateTemplate(this TemplateContext context, string template, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.OneTimePage(template)); args.Each((x, y) => pageResult.Args[x] = y); return(pageResult.Result); }
public static string EvaluateScript(this ScriptContext context, string script, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.OneTimePage(script)); args.Each((x, y) => pageResult.Args[x] = y); return(pageResult.EvaluateScript()); }
/// <summary> /// Build VMTA Mail header /// </summary> /// <param name="campaignId"></param> /// <param name="subject"></param> /// <param name="accountCode"></param> /// <param name="item"></param> /// <param name="returnPath"></param> /// <param name="unsubscribeLink"></param> /// <param name="fromName"></param> /// <param name="fromEmail"></param> /// <param name="vmtaEmail"></param> /// <param name="senderDomain"></param> /// <returns></returns> private static string BuildHeader(int campaignId, string subject, string accountCode, EmailRecipient item, string returnPath, string unsubscribeLink, string fromName, string fromEmail, string vmtaEmail, string senderDomain, byte?campaignTypeId) { var contentType = campaignTypeId == 132 ? "text/plain" : "text/html"; var mailType = "campaign"; Dictionary <string, string> utm_medium_sources = new Dictionary <string, string>(); utm_medium_sources.Add("1", "campaign"); utm_medium_sources.Add("2", "webinar"); utm_medium_sources.Add("3", "series"); utm_medium_sources.Add("4", "prospecting"); utm_medium_sources.Add("5", "reengagement"); utm_medium_sources.Add("6", "inventory"); utm_medium_sources.Each(s => { if (subject.Contains(s.Value)) { mailType = s.Value; } }); String headers = "Subject: " + subject + "\n" + "Content-Type: " + contentType + "; charset=\"utf-8\"\n" + "MIME-Version: 1.0" + "\n" + "X-Mailer: STMailer" + "\n" + "X-STCustomer: " + item.CampaignRecipientID.ToString() + "\n" + "X-Campaign: " + accountCode + "_" + campaignId + "\n" + "X-SearchCriteria: " + campaignId + "\n" + "List-Unsubscribe: " + "<" + unsubscribeLink + ">" + "\n" + "Return-Path: " + returnPath + "\n" + "Feedback-ID: " + campaignId.ToString() + ":" + mailType.ToString() + ":" + accountCode.ToString(); var includeVMTAEnvelope = ConfigurationManager.AppSettings["INCLUDE_VMTA_ENVELOPE"].ToString(); if (includeVMTAEnvelope == "YES") { headers = headers + "envelope-from: " + item.CampaignRecipientID.ToString() + "-" + accountCode + "_" + campaignId + "@bounce." + senderDomain + "\n"; } if (fromEmail == vmtaEmail) { headers = headers + "From: " + fromName + " <" + fromEmail + ">\n" + "To: " + item.EmailId + "\n" + "\n"; } else { headers = headers + "From: " + fromName + " <" + fromEmail + ">\n" + "To: " + item.EmailId + "\n" + "Sender: " + vmtaEmail + "\n" + "Reply-to: " + fromName + " <" + fromEmail + ">\n" + "\n"; } return(headers); }
public void ForEachIterationWithNoGarbage() { BuildDictionary(); foreach (var pair in actualDictionary.Each()) { Debug.LogFormat("This is an iteration. Key = {0}, Value = {1}", pair.Key, pair.Value); } }
public static string ToTypeScriptType(this Mono.Cecil.TypeReference typeReference) { typeReference = GetNullableType(typeReference); if (genericTypeMap == null) { genericTypeMap = typeMap .ToDictionary(item => "<" + item.Key + ">", item => "<" + item.Value + ">"); typeMap .ToDictionary(item => item.Key + "[]", item => item.Value + "[]") .Each(x => genericTypeMap.Add(x.Key, x.Value)); } var fromName = typeReference.FullName; // translate / in nested classes into underscores fromName = fromName.Replace("/", "_"); if (typeMap.ContainsKey(fromName)) { return(typeMap[fromName]); } var genericType = genericTypeMap.FirstOrDefault(x => fromName.Contains(x.Key)); if (!genericType.Equals(default(System.Collections.Generic.KeyValuePair <string, string>))) { fromName = fromName.Replace(genericType.Key, genericType.Value); } fromName = fromName .StripGenericTick(); // To lazy to figure out the Mono.Cecil way (or if there is a way), but do // some string search/replace on types for example: // // turn // Windows.Foundation.Collections.IMapView<System.String,System.Object>; // into // Windows.Foundation.Collections.IMapView<string,any>; // typeMap.Each(item => { fromName = fromName.Replace(item.Key, item.Value); }); // If it's an array type return it as such. var genericTypeArgName = ""; if (IsTypeArray(typeReference, out genericTypeArgName)) { return(genericTypeArgName + "[]"); } // remove the generic bit return(fromName); }
private static ScriptContext LispScriptContext(Dictionary <string, object> args = null) { var context = new ScriptContext { ScriptLanguages = { ScriptLisp.Language } }.Init(); args?.Each((k, v) => context.Args[k] = v); return(context); }
public RawFormat(string sql, Dictionary <string, object> parameters) { Sql = sql; parameters.Each(kvp => { AddParameter(new ParameterInfo { ColumnName = kvp.Key, Value = kvp.Value }); }); }
internal string GetConnectionString() { validator.ValidateAndThrow(this); var connectionString = new StringBuilder(); connectionString.Append($"ConnectTo=tcp://{userName}:{password}@{tcpEndpoint}; "); settings.Each(s => connectionString.Append($"{s.Key}={s.Value}; ")); return(connectionString.ToString()); }
private void UniqDictionaryForeach() { d.Clear(); Profiler.BeginSample("Dictionary.Each"); foreach (var p in c.Each()) { d.Add(p.Key, p.Value); } Profiler.EndSample(); }
void DisplayResults() { Dictionary <Uri, int> sources = GetWorkerLoad(); int sent = 0; int received = 0; TimeSpan totalDuration = TimeSpan.Zero; TimeSpan receiveDuration = TimeSpan.Zero; _commands.Values.Each(command => { sent++; if (command.Worker != null) { received++; totalDuration += (command.ResponseReceivedAt - command.CreatedAt); receiveDuration += (command.ResponseCreatedAt - command.CreatedAt); } }); Trace.WriteLine("Total Commands Sent = " + sent); Trace.WriteLine("Total Responses Received = " + received); Trace.WriteLine("Total Elapsed Time = " + totalDuration.TotalSeconds + "s"); if (received > 0) { Trace.WriteLine("Mean Roundtrip Time = " + (totalDuration.TotalMilliseconds / received).ToString("F0") + "ms"); } Trace.WriteLine("Receive Latency = " + receiveDuration.TotalSeconds + "s"); if (received > 0) { Trace.WriteLine("Mean Receive Latency = " + (receiveDuration.TotalMilliseconds / received).ToString("F0") + "ms"); } if (received > 0) { IOrderedEnumerable <TimeSpan> query = _commands.Values.Select(x => x.ResponseReceivedAt - x.CreatedAt).OrderBy(x => x); int count = query.Count(); int offset = Convert.ToInt32(count * 0.95); TimeSpan value = query.Skip(offset).First(); Trace.WriteLine("95th Percentile = " + value.TotalMilliseconds + "ms"); } Trace.WriteLine("Workers Utilized"); sources.Each(worker => Trace.WriteLine(worker.Key + ": " + worker.Value + " commands")); received.ShouldEqual(sent); }
public JObject DoGet(string url, Dictionary <string, object> paran, out bool success) { url += "?"; paran.Each(x => { if (x.Key != "SID") { url += $"{x.Key}={x.Value.ToJsonString().ToBase64ToGb2312()}&"; } else { url += $"{x.Key}={x.Value}&"; } }); url = url.TrimEnd('&'); var request = Unirest.get(url); HttpResponse <string> response; try { response = request.asString(); } catch (AggregateException ex) { throw new AggregateException("本地服务未开启,请检查SOAP开票服务"); } if (response.Code != 200) { throw new HttpRequestException(response.Body); } JObject obj = JsonConvert.DeserializeObject <JObject>(response.Body); var decode = Base64Decode(Encoding.GetEncoding("GB2312"), obj["ENCMSG"].ToString()); var resp = JsonConvert.DeserializeObject <BaseRespModel>(decode); if (RESULTCODE.Contains(resp.retcode)) { success = true; } else { success = false; throw new Exception(resp.retmsg); } var oboj = JsonConvert.DeserializeObject <JObject>(decode); if (resp.SID == SIDEnum.BatchDelivery) { oboj["responseMsg"] = oboj["responseMsg"].ToString().RewriteXML(); } return(oboj); }
/// <summary> /// 替换匹配字符串 /// </summary> /// <param name="value"></param> /// <param name="keyValuePairs"></param> /// <returns></returns> public static string Replace(this string value, Dictionary <string, string> keyValuePairs) { if (string.IsNullOrEmpty(value) || keyValuePairs.IsEmpty()) { return(value); } keyValuePairs.Each(item => value = value.Replace(item.Key, item.Value)); return(value); }
/// <exception cref="Exception">A delegate callback throws an exception. </exception> protected override void OnPause() { var status = new ServiceStatus(); var e = new ServiceEventArgs(); status.dwCurrentState = ServiceState.ServicePausePending; status.dwWaitHint = 100000; SetServiceStatus(ServiceHandle, ref status); if (PauseService != null) { PauseService(this, e); } Started = false; _monitors.Each(x => x.Value.Stop(true)); status.dwCurrentState = ServiceState.ServicePaused; SetServiceStatus(ServiceHandle, ref status); }
private void ApplyModifiers() { modifiedValue = originalValue; T lastValue = originalValue; foreach (var pair in modifiers.Each()) { T value = pair.Value; modifiedValue = aggregateFunction(lastValue, value); lastValue = value; } }
public void UpdateModifiedValues() { modifiedValue = originalValue; T lastValue = originalValue; foreach (var pair in modifiers.Each()) { T value = pair.Value; modifiedValue = aggregateFunction(lastValue, value); lastValue = modifiedValue; } }
private static IEnumerable <MetaDataCategory> createMetaData() { var images = new Dictionary <string, ApplicationIcon>(); var path = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location); if (path != null) { var resourcePath = Path.GetFullPath(Path.Combine(path, @"..\..\..\..\Dev\OSPSuite.Resources\Icons\")); var maleIcon = new Icon(Path.Combine(resourcePath, "MetaData.ico")); images.Add("Male", new ApplicationIcon(maleIcon)); var femaleIcon = new Icon(Path.Combine(resourcePath, "UnitInformation.ico")); images.Add("Female", new ApplicationIcon(femaleIcon)); } var genderCategory = createMetaDataCategory <string>(descriptiveName: "Gender", isMandatory: false, isListOfValuesFixed: true, fixedValuesRetriever: category => { category.ListOfValues.Add("Male", "Male"); category.ListOfValues.Add("Female", "Female"); }); images.Each(image => genderCategory.ListOfImages.Add(image.Key, image.Value)); yield return(genderCategory); yield return(speciesMetaDataCategory()); yield return(createMetaDataCategory <DateTime>(descriptiveName: "Date of Measurement", isMandatory: true)); yield return(createMetaDataCategory <bool>(descriptiveName: "GMP relavent", isMandatory: true)); var refValue = createMetaDataCategory <double>(descriptiveName: "Reference Value"); refValue.MinValue = 0; refValue.MinValueAllowed = false; refValue.MaxValue = 1; refValue.MaxValueAllowed = true; yield return(refValue); var measurements = createMetaDataCategory <int>(descriptiveName: "Number of Measurements", isMandatory: false); measurements.MinValue = 0; measurements.MinValueAllowed = true; measurements.MaxValue = 6; yield return(measurements); var remark = getRemarkCategory(); yield return(remark); }
public static async Task <object> EvaluateAsync(this ScriptContext context, string script, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.OneTimePage(script)); args.Each((x, y) => pageResult.Args[x] = y); var discard = await GetPageResultOutputAsync(pageResult); if (pageResult.ReturnValue == null) { throw new NotSupportedException(ErrorNoReturn); } return(pageResult.ReturnValue.Result); }
/// <summary> /// Evaluate #Script and return value /// </summary> public static object Evaluate(this ScriptContext context, string script, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.SharpScriptPage(script)); args.Each((x, y) => pageResult.Args[x] = y); if (!pageResult.EvaluateResult(out var returnValue)) { throw new NotSupportedException(ScriptContextUtils.ErrorNoReturn); } return(ScriptLanguage.UnwrapValue(returnValue)); }
public void Can_increment_Hash_field() { var hash = Redis.Hashes[HashId]; stringIntMap.Each(x => hash.Add(x.Key, x.Value.ToString())); stringIntMap["two"] += 10; Redis.IncrementValueInHash(HashId, "two", 10); var members = Redis.GetAllEntriesFromHash(HashId); Assert.That(members, Is.EquivalentTo(ToStringMap(stringIntMap))); }
public static string Escape(this string a) { Dictionary <string, string> d = new Dictionary <string, string> { { "\\", "\\\\" }, { "\"", "\\\"" }, { "\'", "\\\'" }, { "\n", "\\n" }, }; string r = a; d.Each(b => r = r.Replace(b.Key, b.Value)); return(r); }
public T Solve <T>(string expression, Dictionary <string, dynamic> variables = null) { var context = CreateExpressionContext(); if (variables != null) { variables.Each(x => context.Variables[x.Key] = x.Value); } var compilied = context.CompileDynamic(expression); return((T)Convert.ChangeType(compilied.Evaluate(), typeof(T))); }
private void AddHashes() { var stringMap = new Dictionary<string, string> { {"one","a"}, {"two","b"}, {"three","c"}, {"four","d"} }; var stringIntMap = new Dictionary<string, int> { {"one",1}, {"two",2}, {"three",3}, {"four",4} }; stringMap.Each(x => Redis.SetEntryInHash("testhash", x.Key, x.Value)); var hash = Redis.Hashes["testhash"]; stringIntMap.Each(x => hash.Add(x.Key, x.Value.ToString())); }
private static ScriptContext CreateContext(Dictionary <string, object> optionalArgs = null) { var context = new ScriptContext { Args = { ["numbers"] = new[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }, ["products"] = QueryData.Products, ["customers"] = QueryData.Customers, } }; optionalArgs.Each((key, val) => context.Args[key] = val); return(context.Init()); }
public IDictionary <Type, TypeSerializer> LoadBuiltInTypeSerializers() { Dictionary <Type, TypeSerializer> serializers = Assembly.GetExecutingAssembly().GetTypes() .Where(x => x.Namespace == typeof(StringSerializer).Namespace) .Where(x => x.ImplementsGeneric(typeof(TypeSerializer <>))) .Where(x => !x.ContainsGenericParameters) .Select(x => new { Type = x, SerializedType = x.GetGenericTypeDeclarations(typeof(TypeSerializer <>)).First() }) .Select(x => new { x.SerializedType, Serializer = FastActivator.Create(x.Type) as TypeSerializer }) .ToDictionary(x => x.SerializedType, x => x.Serializer); _log.Debug( x => serializers.Each(s => x.Write("Loaded serializer for {0} ({1})", s.Key.Name, s.Value.GetType().FullName))); return(serializers); }
/// <summary> /// Evaluate #Script and convert returned value to T asynchronously /// </summary> public static async Task <object> EvaluateAsync(this ScriptContext context, string script, Dictionary <string, object> args = null) { var pageResult = new PageResult(context.SharpScriptPage(script)); args.Each((x, y) => pageResult.Args[x] = y); var ret = await pageResult.EvaluateResultAsync(); if (!ret.Item1) { throw new NotSupportedException(ScriptContextUtils.ErrorNoReturn); } return(ScriptLanguage.UnwrapValue(ret.Item2)); }
private void AddHashes() { var stringMap = new Dictionary <string, string> { { "one", "a" }, { "two", "b" }, { "three", "c" }, { "four", "d" } }; var stringIntMap = new Dictionary <string, int> { { "one", 1 }, { "two", 2 }, { "three", 3 }, { "four", 4 } }; stringMap.Each(x => Redis.SetEntryInHash("testhash", x.Key, x.Value)); var hash = Redis.Hashes["testhash"]; stringIntMap.Each(x => hash.Add(x.Key, x.Value.ToString())); }
public void Start(string bootstrapperName, Dictionary<string, string> properties, MarshalByRefObject remoteListener) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var domainSetup = AppDomain.CurrentDomain.SetupInformation; System.Environment.CurrentDirectory = domainSetup.ApplicationBase; // TODO -- need to handle exceptions gracefully here EventAggregator.Start((IRemoteListener) remoteListener); properties.Each(x => PackageRegistry.Properties[x.Key] = x.Value); var loader = BottleServiceApplication.FindLoader(bootstrapperName); _shutdown = loader.Load(); EventAggregator.SendMessage(new LoaderStarted { LoaderTypeName = _shutdown.GetType().FullName }); }
public void Can_SetRangeInHash() { var newStringMap = new Dictionary<string, string> { {"five","e"}, {"six","f"}, {"seven","g"} }; stringMap.Each(x => Redis.SetEntryInHash(HashId, x.Key, x.Value)); Redis.SetRangeInHash(HashId, newStringMap); newStringMap.Each(x => stringMap.Add(x.Key, x.Value)); var members = Redis.GetAllEntriesFromHash(HashId); Assert.That(members, Is.EquivalentTo(stringMap)); }
public void Can_call_GetAllEntriesFromHash_in_transaction() { var stringMap = new Dictionary<string, string> { {"one","a"}, {"two","b"}, {"three","c"}, {"four","d"} }; stringMap.Each(x => Redis.SetEntryInHash(HashKey, x.Key, x.Value)); Dictionary<string, string> results = null; using (var trans = Redis.CreateTransaction()) { trans.QueueCommand(r => r.GetAllEntriesFromHash(HashKey), x => results = x); trans.Commit(); } Assert.That(results, Is.EquivalentTo(stringMap)); }
public void LogAction(Enum logID, int? objectID, Dictionary<string, string> additionalParams = null) { if (GetBaseModel().GetUserPolicyState<bool>(UserPolicyGlobal.IsStatisticsDisabled)) { return; } var pars = new Dictionary<string, string> { {"utm_source", UtmParam.UtmSource}, {"utm_campaign", UtmParam.UtmCampaign}, {"utm_medium", UtmParam.UtmMedium} }; if (additionalParams != null) { additionalParams.Each(kv => { pars[kv.Key] = kv.Value; }); } UserActionLogger.Log(CurrentUser.GuestID, logID, objectID, pars); }