예제 #1
0
        protected void Page_Load( object sender, EventArgs e )
        {
            Shop [] shops = new Shop [0];

                shops = ShopsDac.GetShops("").ToArray();
                ShopsLoaded = shops.Length;

                _listView.DataSource = getShops(ref shops);
                _listView.DataBind();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Shop[] shops = null;
            Shop[] Allshops = null;

            Allshops = ShopsDac.GetShops("").ToArray();
            ShopsLoaded = Allshops.Count();
            firstShop = Allshops.FirstOrDefault();

            CityRepeater.DataSource = getShops(ref Allshops);
            CityRepeater.DataBind();
        }
예제 #3
0
        protected void Page_PreRender( object sender, EventArgs e )
        {
            using(var dc = new DCFactory<CmsDataContext>())
            {
                DataLoadOptions dlo = new DataLoadOptions();
                dlo.LoadWith<Shop>(s => s.ShopMapFile);
                dlo.LoadWith<Shop>(s => s.ShopGalleryFolder);
                dlo.LoadWith<Folder>(f => f.Files);
                dc.DataContext.LoadOptions = dlo;
                dc.DataContext.DeferredLoadingEnabled = true;

                _item = dc.DataContext.Shops.Where(s => s.ShopID == ShopId && s.ShopVisible).SingleOrDefault();

                if( _item == null )
                    throw new HttpException((int)HttpStatusCode.NotFound, "Not found" );

                _shopVacancyBriefList1.ShopID = _item.ShopID;

                if( _item.ShopMapFile != null )
                {
                    _mapLink.Visible = true;
                    _mapLink.NavigateUrl = UrlManager.GetFileUrl( _item.ShopMapFile.FileID );
                    _mapLink.Attributes[ "onclick" ] = string.Format( "info=window.open(this.href,'','width={0},height={1},scrollbars=yes,resizable=yes'); info.focus(); return false;",
                        _item.ShopMapFile.ImageWidth.Value + 40,
                        _item.ShopMapFile.ImageHeight.Value + 30 );
                    _mapImage.ImageUrl = UrlManager.GetThumbnailUrl( _item.ShopMapFile.FileID, "map", "" );
                }
                else
                {
                    _mapLink.Visible = false;
                }

                if( _item.ShopGalleryFolder != null && _item.ShopGalleryFolder.Files.Count != 0 )
                {
                    _galleryRow.Visible = true;
                    List<File> AllPhotos = _item.ShopGalleryFolder.Files.Where(f => f.IsImage == true).ToList();
                    var firstPhoto = AllPhotos.Take(1);
                    GalleryHeader.DataSource = firstPhoto;
                    GalleryHeader.DataBind();
                    _galleryRepeater.DataSource = AllPhotos.Except(firstPhoto);
                    _galleryRepeater.DataBind();
                }
                else
                {
                    _galleryRow.Visible = false;
                }
            }

            lVacancy.Visible = _shopVacancyBriefList1.Count > 0;
        }
예제 #4
0
        protected void Page_Load( object sender, EventArgs e )
        {
            Shop [] shops = new Shop [0];
            Shop[] Allshops = new Shop[0];
            List<City> Cities = null;

            if (CmsContext.Current.PageParameters["Region"] == "City")
            {
                using (var Ctx = new dcCommonDataContext())
                {
                    Cities = Ctx.Cities.Where(x => x.CityID.ToString() == CmsContext.Current.PageParameters["ID"]).ToList();
                }

                shops = ShopsDac.GetShopByCityID(Convert.ToInt32(CmsContext.Current.PageParameters["ID"])).ToArray();
                shops = shops.Where(s => s.isRMS != true).ToArray();
                ShopsLoaded = shops.Length;
                firstShop = shops.FirstOrDefault();

                _listView.DataSource = getShops(ref shops);
                _listView.DataBind();
            }

            if (CmsContext.Current.PageParameters["Region"] == "Region")
            {
                // Ссылка "Центральный офис" использует алгоритм отображения магазинов по региону
                // "100" - 'регион' "Центральный офис"
                if ("100" == CmsContext.Current.PageParameters["ID"])
                {
                    Shop[] sl = (new CmsDataContext()).Shops.Where(x => x.isRMS == true).ToArray();
                    _listView.DataSource = getShops(ref sl);
                    _listView.DataBind(); return;
                }
                Region r;
                using (var Ctx = new dcCommonDataContext())
                {
                    Cities = Ctx.Cities.Where(x => x.RegionID.ToString() == CmsContext.Current.PageParameters["ID"]).ToList();
                    r = Ctx.Regions.Where(x => x.RegionID.ToString() == CmsContext.Current.PageParameters["ID"]).FirstOrDefault();
                }

                Cities.Add(new City() { CityID = null });
                Allshops = ShopsDac.GetShopByRegionID(Convert.ToInt32(CmsContext.Current.PageParameters["ID"])).ToArray();
                ShopsLoaded = Allshops.Count();

                firstShop = Allshops.FirstOrDefault();

                _listView.DataSource = getShops(ref Allshops);
                _listView.DataBind();
            }
        }
예제 #5
0
        object[] getShops(ref Shop[] sl)
        {
            List<object> ol = new List<object>();
            foreach (Shop sh in sl)
            {

                string ShopString = sh.ShopName + ", " +
                       sh.ShopAddress + (sh.ShopMetro != null && sh.ShopMetro.Length > 0 ? ", " + sh.ShopMetro : "");
                ol.Add(new
                {
                    ShopId = sh.ShopID,
                    ShopString = sh.ShopName + ", " +
                    sh.ShopAddress + (sh.ShopMetro != null && sh.ShopMetro.Length > 0 ? ", " + sh.ShopMetro : "")
                });
            }
            return ol.ToArray();
        }
예제 #6
0
 object[] getShops(ref Shop[] sl)
 {
     var Ctx = new dcCommonDataContext();
     List<object> ol = new List<object>();
     foreach (Shop sh in sl)
     {
         string CityName = Ctx.Cities.FirstOrDefault(c => c.CityID == sh.CityID).Name, RegionName = "";
         if (sh.RegionID != null) RegionName = Ctx.Regions.FirstOrDefault(c => c.RegionID == sh.RegionID).RegionName;
         string ShopString = CityName + (!string.IsNullOrEmpty(CityName) ? ", " : RegionName + ", ") + sh.ShopName + ", " +
                sh.ShopAddress + (sh.ShopMetro != null && sh.ShopMetro.Length > 0 ? ", " + sh.ShopMetro : "");
         ol.Add(new
         {
             ShopId = sh.ShopID,
             ShopString = CityName + (!string.IsNullOrEmpty(CityName) ? ", " : RegionName + ", ") + sh.ShopName + ", " +
             sh.ShopAddress + (sh.ShopMetro != null && sh.ShopMetro.Length > 0 ? ", " + sh.ShopMetro : "")
         });
     }
     return ol.ToArray();
 }