Exemplo n.º 1
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCarousel")
     {
         CarouselService.DeleteCarousel(SQLDataHelper.GetInt(e.CommandArgument));
     }
 }
Exemplo n.º 2
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteCarousel")
     {
         CarouselService.DeleteCarousel(Convert.ToInt32(e.CommandArgument));
     }
 }
Exemplo n.º 3
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (CarouselService.GetCarouselsCount() == 0)
     {
         this.Visible = false;
     }
 }
Exemplo n.º 4
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     CarouselsCount = CarouselService.GetCarouselsCount();
     if ((CarouselsCount == 0 && !AdvantShop.Customers.CustomerContext.CurrentCustomer.IsAdmin && !TrialService.IsTrialEnabled) || SettingsDesign.CarouselVisibility == false)
     {
         this.Visible = false;
     }
 }
Exemplo n.º 5
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                int sortOrder = 0;
                if (int.TryParse(grid.UpdatedRow["SortOrder"], out sortOrder))
                {
                    var car = new Carousel()
                    {
                        CarouselID = SQLDataHelper.GetInt(grid.UpdatedRow["ID"]),
                        URL        = grid.UpdatedRow["URL"],
                        SortOrder  = sortOrder,
                        Enabled    = SQLDataHelper.GetBoolean(grid.UpdatedRow["Enabled"])
                    };
                    CarouselService.UpdateCarousel(car);

                    var photo = PhotoService.GetPhotoByObjId(car.CarouselID, PhotoType.Carousel);
                    photo.Description = grid.UpdatedRow["Description"];
                    PhotoService.UpdatePhoto(photo);
                }
            }
            DataTable data = _paging.PageItems;

            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool))
            {
                DefaultValue = _inverseSelection
            };

            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text          = _paging.TotalRowsCount.ToString();
        }
Exemplo n.º 6
0
 public CarouselsController(ILogger <CarouselsController> logger,
                            ServiceFacade.Controller context,
                            CarouselService carouselService) : base(context)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _carouselService = carouselService
                        ?? throw new ArgumentNullException(nameof(carouselService));
     PageTitle = "Carousels";
 }
Exemplo n.º 7
0
    protected void bthAddCarousel_Click(object sender, EventArgs e)
    {
        lblErrorImage.Text = string.Empty;
        int sort;

        if (!CarouselLoad.HasFile)
        {
            ulValidationFailed.Visible    = true;
            ulValidationFailed.InnerHtml += string.Format("<li>{0}</li>", Resource.Client_Feedback_WrongData);
            return;
        }

        if (CarouselLoad.HasFile && !FileHelpers.CheckImageExtension(CarouselLoad.FileName))
        {
            lblErrorImage.Text = Resource.Admin_ErrorMessage_WrongImageExtension;
            return;
        }

        int.TryParse(txtSortedCarousel.Text, out sort);

        if (string.IsNullOrEmpty(txtURL.Text))
        {
            txtURL.Text = "#";
        }

        var carousel = new Carousel {
            URL = txtURL.Text, SortOrder = sort, Enabled = true
        };
        int id = CarouselService.AddCarousel(carousel);

        try
        {
            if (CarouselLoad.HasFile)
            {
                var tempName = PhotoService.AddPhoto(new Photo(0, id, PhotoType.Carousel)
                {
                    OriginName = CarouselLoad.FileName
                });
                if (!string.IsNullOrWhiteSpace(tempName))
                {
                    using (System.Drawing.Image image = System.Drawing.Image.FromStream(CarouselLoad.PostedFile.InputStream))
                    {
                        FileHelpers.SaveResizePhotoFile(FoldersHelper.GetPathAbsolut(FolderType.Carousel, tempName), SettingsPictureSize.CarouselBigWidth, SettingsPictureSize.CarouselBigHeight, image);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Debug.LogError(ex, "Attempt to load not image file");
        }

        txtURL.Text            = string.Empty;
        txtSortedCarousel.Text = string.Empty;
        Response.Redirect(UrlService.GetAdminAbsoluteLink("Carousel.aspx"));
    }
Exemplo n.º 8
0
 public FirstViewModel(ProductService productservice,
                       SolutionService solutionservice,
                       CarouselService sarouselService,
                       NewService newService,
                       VideoService videoservice)
 {
     //Location = location;
     whichSite       = Common.Site.CompanyHeadquarter;
     ProductService  = productservice;
     Solutionservice = solutionservice;
     NewService      = newService;
     VideoService    = videoservice;
     CarouselService = sarouselService;
 }
Exemplo n.º 9
0
 public HomeController(ILogger <HomeController> logger,
                       ServiceFacade.Controller context,
                       ActivityService activityService,
                       AvatarService avatarService,
                       CarouselService carouselService,
                       DailyLiteracyTipService dailyLiteracyTipService,
                       DashboardContentService dashboardContentService,
                       EmailManagementService emailManagementService,
                       EmailReminderService emailReminderService,
                       EventService eventService,
                       LanguageService languageService,
                       PerformerSchedulingService performerSchedulingService,
                       SiteService siteService,
                       SocialService socialService,
                       UserService userService,
                       VendorCodeService vendorCodeService)
     : base(context)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _activityService = activityService
                        ?? throw new ArgumentNullException(nameof(activityService));
     _avatarService = avatarService
                      ?? throw new ArgumentNullException(nameof(avatarService));
     _carouselService = carouselService
                        ?? throw new ArgumentNullException(nameof(carouselService));
     _dailyLiteracyTipService = dailyLiteracyTipService
                                ?? throw new ArgumentNullException(nameof(dailyLiteracyTipService));
     _dashboardContentService = dashboardContentService
                                ?? throw new ArgumentNullException(nameof(dashboardContentService));
     _emailManagementService = emailManagementService
                               ?? throw new ArgumentNullException(nameof(emailManagementService));
     _emailReminderService = emailReminderService
                             ?? throw new ArgumentNullException(nameof(emailReminderService));
     _eventService = eventService
                     ?? throw new ArgumentNullException(nameof(eventService));
     _languageService = languageService
                        ?? throw new ArgumentNullException(nameof(languageService));
     _performerSchedulingService = performerSchedulingService
                                   ?? throw new ArgumentNullException(nameof(performerSchedulingService));
     _siteService   = siteService ?? throw new ArgumentNullException(nameof(siteService));
     _socialService = socialService
                      ?? throw new ArgumentNullException(nameof(socialService));
     _userService       = userService ?? throw new ArgumentNullException(nameof(userService));
     _vendorCodeService = vendorCodeService
                          ?? throw new ArgumentNullException(nameof(vendorCodeService));
 }
Exemplo n.º 10
0
 public CarouselController(
     IHostingEnvironment hostingEnvironment,
     IConfiguration configuration,
     CarouselService corouselService,
     UserManager <ApplicationUser> userManager
     )
 {
     this.userManager        = userManager;
     this.hostingEnvironment = hostingEnvironment;
     this.configuration      = configuration;
     this.carouselService    = corouselService;
     baseURL   = this.configuration.GetSection("BaseURL").Value;
     baseS3URL = this.configuration.GetSection("AWS:S3:Carousels:BaseURL").Value;
     bucket    = this.configuration.GetSection("AWS:S3:Carousels:BucketName").Value;
     folder    = this.configuration.GetSection("AWS:S3:Carousels:Folder").Value;
     region    = this.configuration.GetSection("AWS:Region").Value;
     accessKey = this.configuration.GetSection("AWS:AccessKey").Value;
     secretKey = this.configuration.GetSection("AWS:SecretKey").Value;
     path      = this.hostingEnvironment.WebRootPath;
 }
Exemplo n.º 11
0
 protected void lbSetNotActive_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 CarouselService.SetActive(SQLDataHelper.GetInt(id), false);
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("CarouselID as ID");
             foreach (int id in itemsIds.Where(oId => !_selectionFilter.Values.Contains(oId.ToString())))
             {
                 CarouselService.SetActive(SQLDataHelper.GetInt(id), false);
             }
         }
     }
 }
Exemplo n.º 12
0
 protected void lbDeleteSelected_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 CarouselService.DeleteCarousel(SQLDataHelper.GetInt(id));
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("CarouselID as ID");
             //IEnumerable<int> ids = CurrencyService.GetAllCurrencyId();
             foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
             {
                 CarouselService.DeleteCarousel(id);
             }
         }
     }
 }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Carousels_Header));

            if (!IsPostBack)
            {
                _paging = new SqlPaging {
                    TableName = "[CMS].[Carousel] left join Catalog.Photo on Photo.ObjId=Carousel.CarouselID and Type=@Type", ItemsPerPage = 10
                };

                var f = new Field {
                    Name = "CarouselID as ID", IsDistinct = true, Filter = _selectionFilter
                };
                _paging.AddField(f);

                f = new Field {
                    Name = "URL"
                };
                _paging.AddField(f);

                f = new Field {
                    Name = "SortOrder", Sorting = SortDirection.Ascending
                };
                _paging.AddField(f);

                f = new Field {
                    Name = "Enabled"
                };
                _paging.AddField(f);

                f = new Field {
                    Name = "PhotoName"
                };
                _paging.AddField(f);

                f = new Field {
                    Name = "Description"
                };
                _paging.AddField(f);

                _paging.AddParam(new SqlParam {
                    ParameterName = "@Type", Value = PhotoType.Carousel.ToString()
                });

                grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif");

                _paging.ItemsPerPage = 10;

                pageNumberer.CurrentPageIndex = 1;
                _paging.CurrentPageIndex      = 1;
                ViewState["Paging"]           = _paging;

                txtSortedCarousel.Text = CarouselService.GetMaxSortOrder().ToString(CultureInfo.InvariantCulture);
            }
            else
            {
                _paging = (SqlPaging)(ViewState["Paging"]);
                _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue);

                if (_paging == null)
                {
                    throw (new Exception("Paging lost"));
                }

                string strIds = Request.Form["SelectedIds"];


                if (!string.IsNullOrEmpty(strIds))
                {
                    strIds = strIds.Trim();
                    string[] arrids = strIds.Split(' ');

                    var ids = new string[arrids.Length];
                    _selectionFilter = new InSetFieldFilter {
                        IncludeValues = true
                    };
                    for (int idx = 0; idx <= ids.Length - 1; idx++)
                    {
                        int t = int.Parse(arrids[idx]);
                        if (t != -1)
                        {
                            ids[idx] = t.ToString();
                        }
                        else
                        {
                            _selectionFilter.IncludeValues = false;
                            _inverseSelection = true;
                        }
                    }

                    _selectionFilter.Values = ids;
                    //_InverseSelection = If(ids(0) = -1, True, False)
                }
            }
        }
Exemplo n.º 14
0
 public void Setup()
 {
     carouselService = new CarouselService(context, configuration);
 }
Exemplo n.º 15
0
 public AdminCarouselController(CarouselService carouselService, LoggingService loggingService, IUnitOfWorkManager unitOfWorkManager, MembershipService membershipService, SettingsService settingsService, LocalizationService localizationService)
     : base(loggingService, unitOfWorkManager, membershipService, settingsService, localizationService)
 {
     _carouselService = carouselService;
 }