/// <summary> /// Gets the super event images. /// </summary> /// <param name="supereventid">The supereventid.</param> /// <returns>System.String.</returns> public string GetSuperEventImages(string supereventid) { string jsondata = ""; DataTable dt = new DataTable(); try { using (supereventimagesmgmt objsuper = new supereventimagesmgmt()) { dt = objsuper.GetSuperEventImages(supereventid); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("{\"items\":["); foreach (DataRow dr in dt.Rows) { sb.Append("{\"id\":" + dr["id"].ToString() + "," + "\"title\":\"" + dr["imagename"].ToString() + "\"},"); } sb.Append("]}"); jsondata = sb.ToString(); jsondata = jsondata.Remove(jsondata.Length - 3, 1); } } } catch (Exception ex) { CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Client, "eventimage.aspx.cs GetSuperEventImages ", ex); } return(jsondata); }
public void DeleteSuperEventimages(string ids) { using (supereventimagesmgmt objsuper = new supereventimagesmgmt()) { objsuper.DeleteSuperEventImages(ids); } }
/// <summary> /// Handles the Click event of the btnsave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnsave_Click(object sender, EventArgs e) { try { int i = 0; using (supereventimagesmgmt objsuper = new supereventimagesmgmt()) { if (hdnimage1.Value.Trim().Length > 0) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmsss") + "1.jpg"; string dir = MapPath("../superevent/"); string imgpath = dir + imageName; #region :: Base64 :: string strImg = hdnimage1.Value; strImg = strImg.Replace("data:image/png;base64,", ""); if (strImg.Trim().Length > 0) { Base64ToImage(strImg).Save(imgpath, System.Drawing.Imaging.ImageFormat.Jpeg); } #endregion objsuper.SaveSuperEventImages(Request.QueryString["supereventid"], imageName); i++; } if (hdnimage2.Value.Trim().Length > 0) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmsss") + "2.jpg"; string dir = MapPath("../superevent/"); string imgpath = dir + imageName; #region :: Base64 :: string strImg = hdnimage2.Value; strImg = strImg.Replace("data:image/png;base64,", ""); if (strImg.Trim().Length > 0) { Base64ToImage(strImg).Save(imgpath, System.Drawing.Imaging.ImageFormat.Jpeg); } #endregion objsuper.SaveSuperEventImages(Request.QueryString["supereventid"], imageName); i++; } if (hdnimage3.Value.Trim().Length > 0) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmsss") + "3.jpg"; string dir = MapPath("../superevent/"); string imgpath = dir + imageName; #region :: Base64 :: string strImg = hdnimage3.Value; strImg = strImg.Replace("data:image/png;base64,", ""); if (strImg.Trim().Length > 0) { Base64ToImage(strImg).Save(imgpath, System.Drawing.Imaging.ImageFormat.Jpeg); } #endregion objsuper.SaveSuperEventImages(Request.QueryString["supereventid"], imageName); i++; } if (hdnimage4.Value.Trim().Length > 0) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmsss") + "4.jpg"; string dir = MapPath("../superevent/"); string imgpath = dir + imageName; #region :: Base64 :: string strImg = hdnimage4.Value; strImg = strImg.Replace("data:image/png;base64,", ""); if (strImg.Trim().Length > 0) { Base64ToImage(strImg).Save(imgpath, System.Drawing.Imaging.ImageFormat.Jpeg); } #endregion objsuper.SaveSuperEventImages(Request.QueryString["supereventid"], imageName); i++; } if (hdnimage5.Value.Trim().Length > 0) { string imageName = DateTime.Now.ToString("ddMMyyyyHHmmsss") + "5.jpg"; string dir = MapPath("../superevent/"); string imgpath = dir + imageName; #region :: Base64 :: string strImg = hdnimage5.Value; strImg = strImg.Replace("data:image/png;base64,", ""); if (strImg.Trim().Length > 0) { Base64ToImage(strImg).Save(imgpath, System.Drawing.Imaging.ImageFormat.Jpeg); } #endregion objsuper.SaveSuperEventImages(Request.QueryString["supereventid"], imageName); i++; } } if (i > 0) { Page.RegisterStartupScript("onsave", "<script>closePOP();</script>"); } } catch (Exception ex) { CommonLib.ExceptionHandler.WriteLog(CommonLib.Sections.Client, "eventimage.aspx.cs btnsave_Click ", ex); } }