コード例 #1
0
        /// <summary>
        /// Get the list of LDB stores.
        /// </summary>
        /// <returns></returns>
        private List <EstablishmentMapData> GetLDBStores(string search)
        {
            List <EstablishmentMapData> result = new List <EstablishmentMapData>();
            // find master account.
            var account = _dynamicsClient.GetAccountByNameWithEstablishments(LDB_ACCOUNT_NAME);

            if (account != null && account.AdoxioAccountAdoxioEstablishmentLicencee != null)
            {
                foreach (var establishment in account.AdoxioAccountAdoxioEstablishmentLicencee)
                {
                    if (establishment.Statuscode != null && establishment.Statuscode.Value == 845280000 && establishment.AdoxioLatitude != null && establishment.AdoxioLongitude != null &&
                        (
                            search == null || (establishment.AdoxioAddresscity != null &&
                                               establishment.AdoxioAddresscity.ToUpper().Contains(search.ToUpper()))
                        )
                        ) // Licensed
                    {
                        result.Add(new EstablishmentMapData
                        {
                            id            = establishment.AdoxioEstablishmentid,
                            Name          = "BC Cannabis Store",
                            IsOpen        = establishment.AdoxioIsopen.Value,
                            License       = "Public Store",
                            AddressStreet = establishment.AdoxioAddressstreet,
                            AddressCity   = establishment.AdoxioAddresscity,
                            AddressPostal = establishment.AdoxioAddresspostalcode,
                            Latitude      = establishment.AdoxioLatitude.Value,
                            Longitude     = establishment.AdoxioLongitude.Value
                        });
                    }
                }
            }

            return(result);
        }