Example #1
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (this.validateData())
            {
                int    iLen  = flLoadImage.PostedFile.ContentLength;
                byte[] btArr = new byte[iLen];
                flLoadImage.PostedFile.InputStream.Read(btArr, 0, iLen);
                String base64String = Convert.ToBase64String(btArr);
                String imageURL     = "data:image/png;base64," + base64String;

                Entities.Slider oSlider = new Entities.Slider();
                oSlider.code        = Convert.ToInt32(txtCode.Text);
                oSlider.description = txtName.Text;
                oSlider.image       = imageURL;

                //if (SliderBLL.getInstance().exists(oSlider.code)) //If the program exists in the database
                //{
                //    records = SliderBLL.getInstance().modify(oSlider);//To modify the program
                //}
                //else
                //{
                records = SliderBLL.getInstance().insert(oSlider);    //To insert a program
                //}

                loadData();
                blockControls();
            }
        }
Example #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 records = SliderBLL.getInstance().delete(slider_id);

            ScriptManager.RegisterStartupScript(this, this.GetType(), "closeConfirmMessage", "$('#confirmMessage').modal('toggle');", true);

            if (records > 0)
            {
                lblMessage.Text = "Imagen eliminada correctamente.";
            }
            loadData();
            Response.Redirect(Request.RawUrl);
        }
Example #3
0
        public void printSlider()
        {
            List <Slider> listSlider = SliderBLL.getInstance().getAll();

            if (listSlider.Count > 0)
            {
                String strList = "";

                foreach (Slider oSlider in listSlider)
                {
                    strList += "<img alt='" + oSlider.description + "' src='" + oSlider.image + "'/>";
                }
                Response.Write(strList);
            }
            else
            {
                displayDefaultOptions();
            }
        }
Example #4
0
 protected void btnNew_Click(object sender, ImageClickEventArgs e)
 {
     unlockControls();
     txtCode.Text = SliderBLL.getInstance().getNextCode().ToString();
 }
Example #5
0
 protected void loadData()
 {
     gvSlider.DataSource = SliderBLL.getInstance().getAll();
     gvSlider.DataBind();
 }