protected override void LoadCache(string tableType, CacheUpdater updateCache)
        {
            Dictionary<string, Dictionary<string, Header>> data = new Dictionary<string, Dictionary<string, Header>>();
            foreach (PersonCreditCard_ReadListOutput row in ReadList())
            {
                string type = "person credit card";
                Dictionary<string, Header> tbl;
                if (!data.TryGetValue(type, out tbl)) data[type] = tbl = new Dictionary<string, Header>();

                string id = "" + row.CreditCardId;
                Header h;
                if (!tbl.TryGetValue(id, out h))
                {
                    tbl[id] = h = new Header(type, id, row.CreditCardName);
                }
                h.AddToAttribute("person name", row.PersonName);
                h.AddToAttribute("card type", row.CardType);
                h.AddToAttribute("card number", row.CardNumber);
                h.AddToAttribute("exp month", row.ExpMonth);
                h.AddToAttribute("exp year", row.ExpYear);
            }
            // if no data is returned we still need to update cache to get the notify listener removed
            if (data.Count == 0) updateCache(new LookupTable(tableType, new List<Header>(), true));
            foreach (string type in data.Keys)
                updateCache(new LookupTable(type, data[type].Values, true));
        }
        protected override void LoadCache(string tableType, CacheUpdater updateCache)
        {
            Dictionary<string, Dictionary<string, Header>> data = new Dictionary<string, Dictionary<string, Header>>();
            foreach (BusinessEntityAddress_ReadListOutput row in ReadList())
            {
                string type = "business entity address";
                Dictionary<string, Header> tbl;
                if (!data.TryGetValue(type, out tbl)) data[type] = tbl = new Dictionary<string, Header>();

                string id = "" + row.AddressId;
                Header h;
                if (!tbl.TryGetValue(id, out h))
                {
                    tbl[id] = h = new Header(type, id, row.AddressType);
                }
                h.AddToAttribute("address line1", row.AddressLine1);
                h.AddToAttribute("address line2", row.AddressLine2);
                h.AddToAttribute("city", row.City);
                h.AddToAttribute("state", row.State);
                h.AddToAttribute("postal code", row.PostalCode);
                h.AddToAttribute("country", row.Country);
            }
            // if no data is returned we still need to update cache to get the notify listener removed
            if (data.Count == 0) updateCache(new LookupTable(tableType, new List<Header>(), true));
            foreach (string type in data.Keys)
                updateCache(new LookupTable(type, data[type].Values, true));
        }
        protected override void LoadCache(string tableType, CacheUpdater updateCache)
        {
            Dictionary<string, Dictionary<string, Header>> data = new Dictionary<string, Dictionary<string, Header>>();
            foreach (ShipMethod_ReadListOutput row in ReadList())
            {
                string type = "ship method";
                Dictionary<string, Header> tbl;
                if (!data.TryGetValue(type, out tbl)) data[type] = tbl = new Dictionary<string, Header>();

                string id = "" + row.ShipMethodId;
                Header h;
                if (!tbl.TryGetValue(id, out h))
                {
                    tbl[id] = h = new Header(type, id, row.Name);
                }
            }
            // if no data is returned we still need to update cache to get the notify listener removed
            if (data.Count == 0) updateCache(new LookupTable(tableType, new List<Header>(), true));
            foreach (string type in data.Keys)
                updateCache(new LookupTable(type, data[type].Values, true));
        }
        protected override void LoadCache(string tableType, CacheUpdater updateCache)
        {
            Dictionary<string, Dictionary<string, Header>> data = new Dictionary<string, Dictionary<string, Header>>();
            foreach (SpecialOffer_ReadListOutput row in ReadList())
            {
                string type = "special offer";
                Dictionary<string, Header> tbl;
                if (!data.TryGetValue(type, out tbl)) data[type] = tbl = new Dictionary<string, Header>();

                string id = "" + row.SpecialOfferId;
                Header h;
                if (!tbl.TryGetValue(id, out h))
                {
                    tbl[id] = h = new Header(type, id, row.Description);
                    h.IsActive = row.IsActive;
                }
                h.AddToAttribute("category", row.Category);
            }
            // if no data is returned we still need to update cache to get the notify listener removed
            if (data.Count == 0) updateCache(new LookupTable(tableType, new List<Header>(), true));
            foreach (string type in data.Keys)
                updateCache(new LookupTable(type, data[type].Values, true));
        }
        protected override void LoadCache(string tableType, CacheUpdater updateCache)
        {
            Dictionary<string, Dictionary<string, Header>> data = new Dictionary<string, Dictionary<string, Header>>();
            foreach (SalesPerson_ReadListOutput row in ReadList())
            {
                string type = "sales person";
                Dictionary<string, Header> tbl;
                if (!data.TryGetValue(type, out tbl)) data[type] = tbl = new Dictionary<string, Header>();

                string id = "" + row.BusinessEntityId;
                Header h;
                if (!tbl.TryGetValue(id, out h))
                {
                    tbl[id] = h = new Header(type, id, row.Name);
                    h.IsActive = row.IsCurrent;
                }
                h.AddToAttribute("territory id", row.TerritoryId);
            }
            // if no data is returned we still need to update cache to get the notify listener removed
            if (data.Count == 0) updateCache(new LookupTable(tableType, new List<Header>(), true));
            foreach (string type in data.Keys)
                updateCache(new LookupTable(type, data[type].Values, true));
        }
Esempio n. 6
0
        /// <summary>
        /// Constructs a deep copy of a header from another header.
        /// The copies of the attribute values are shallow though.
        /// </summary>
        /// <param name="hdr">Another header to copy from.</param>
        public Header(Header hdr)
        {
            Type = hdr.Type;
            Id = hdr.Id;
            Text = hdr.Text;
            IsValid = hdr.IsValid;
            IsActive = hdr.IsActive;
            DefaultFormat = hdr.DefaultFormat;

            foreach (string attr in hdr.attributes.Keys)
                this[attr] = hdr[attr];
        }