Ejemplo n.º 1
0
        protected void dgvSliders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SliderBL sliderBL = new SliderBL();
            int status = sliderBL.DeleteSlider(int.Parse(dgvSliders.DataKeys[e.RowIndex].Values[0].ToString()));

            Response.Redirect("/administrator/sliders.aspx");
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (User.Identity.IsAuthenticated && User.IsInRole("administrator"))
     {
         SliderBL sliderBL = new SliderBL();
         dgvSliders.DataSource = sliderBL.GetSliders();
         dgvSliders.DataBind();
     }
     else
         Response.Redirect("/administrator/login.aspx?returnUrl=" + Page.Request.RawUrl.Substring(15, Page.Request.RawUrl.Length - 15));
 }
Ejemplo n.º 3
0
        private void SaveSlider()
        {
            Slider slider = new Slider();
            slider.SliderID = (lblSliderID.Value != null && lblSliderID.Value != string.Empty) ? int.Parse(lblSliderID.Value) : -1;
            slider.Name = txtName.Text;
            slider.Active = chkActive.Checked;
            slider.InsertDate = DateTime.Now.ToUniversalTime();
            slider.UpdateDate = DateTime.Now.ToUniversalTime();

            if (ViewState["images"] != null)
            {
                List<SliderItem> images = (List<SliderItem>)ViewState["images"];
                slider.Items = new List<SliderItem>();
                foreach (SliderItem item in images)
                    slider.Items.Add(item);
            }

            SliderBL sliderBL = new SliderBL();
            slider.SliderID = sliderBL.SaveSlider(slider);
            if (slider.SliderID > 0)
            {
                lblSliderID.Value = slider.SliderID.ToString();
                //fluImage.Enabled = true;
                //btnImageUpload.Enabled = true;
            }

            setStatus("Slider uspešno sačuvan.", System.Drawing.Color.Green, true);
        }
Ejemplo n.º 4
0
        private void reorderSliderItems(int sliderItemID, int index)
        {
            SliderBL sliderBL = new SliderBL();
            sliderBL.ReorderSliderItems(sliderItemID, index, int.Parse(lblSliderID.Value));

            loadSlider(int.Parse(lblSliderID.Value));
        }
Ejemplo n.º 5
0
        private void loadSlider(int sliderID)
        {
            SliderBL sliderBL = new SliderBL();
            Slider slider = sliderBL.GetSlider(sliderID);

            txtName.Text = slider.Name;
            chkActive.Checked = slider.Active;

            if (slider.Items != null)
            {
                ViewState["images"] = slider.Items;
                loadImages();
            }

            lblSliderID.Value = slider.SliderID.ToString();
        }
Ejemplo n.º 6
0
        private void SaveSlider()
        {
            Slider slider = new Slider();
            slider.SliderID = (lblSliderID.Value != null && lblSliderID.Value != string.Empty) ? int.Parse(lblSliderID.Value) : -1;
            slider.Name = txtName.Text;
            slider.Active = chkActive.Checked;
            slider.InsertDate = DateTime.Now.ToUniversalTime();
            slider.UpdateDate = DateTime.Now.ToUniversalTime();

            if (ViewState["images"] != null)
            {
                int index = 0;
                foreach (GridViewRow row in dgvImages.Rows) {
                    ((List<SliderItem>)ViewState["images"])[index].Url = ((TextBox)row.FindControl("txtUrl")).Text;
                    ((List<SliderItem>)ViewState["images"])[index].SortIndex = index;
                    index++;
                }
                List<SliderItem> images = (List<SliderItem>)ViewState["images"];
                slider.Items = new List<SliderItem>();
                foreach (SliderItem item in images)
                    slider.Items.Add(item);
            }

            SliderBL sliderBL = new SliderBL();
            slider.SliderID = sliderBL.SaveSlider(slider);
            if (slider.SliderID > 0)
            {
                lblSliderID.Value = slider.SliderID.ToString();
                //fluImage.Enabled = true;
                //btnImageUpload.Enabled = true;
            }

            setStatus("Slider uspešno sačuvan.", System.Drawing.Color.Green, true);
        }