Esempio n. 1
0
        internal static void AccountUpdateStats(this JonasPluginBag bag, Guid accountid)
        {
            var fetchexpr = new FetchExpression(string.Format(fetch, accountid));
            var results   = bag.Service.RetrieveMultiple(fetchexpr);

            var descr = new StringBuilder();

            foreach (var familystatus in results.Entities)
            {
                var status = bag.GetOptionsetLabel("contact", "familystatuscode", (int)familystatus.AttributeToBaseType("Status"));
                var count  = familystatus.AttributeToBaseType("Count");
                descr.AppendLine($"{count} {status}");
            }
            bag.Trace("Description:\n{0}", descr.ToString().Trim());
            var account = new Entity("account", accountid);

            account["description"] = descr.ToString();
            bag.Service.Update(account);
        }