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(); } }
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); }
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(); } }
protected void btnNew_Click(object sender, ImageClickEventArgs e) { unlockControls(); txtCode.Text = SliderBLL.getInstance().getNextCode().ToString(); }
protected void loadData() { gvSlider.DataSource = SliderBLL.getInstance().getAll(); gvSlider.DataBind(); }