private void copyAlbums(int id) { try { var _oldNews = DB.GetTable <ESHOP_NEWS_IMAGE>().Where(n => n.NEWS_ID == m_news_id); foreach (var item in _oldNews) { ESHOP_NEWS_IMAGE img_insert = new ESHOP_NEWS_IMAGE(); img_insert.NEWS_IMG_IMAGE1 = item.NEWS_IMG_IMAGE1; img_insert.NEWS_IMG_IMAGE2 = item.NEWS_IMG_IMAGE2; img_insert.NEWS_IMG_IMAGE3 = item.NEWS_IMG_IMAGE3; img_insert.NEWS_IMG_ORDER = item.NEWS_IMG_ORDER; img_insert.NEWS_IMG_DESC = item.NEWS_IMG_DESC; img_insert.NEWS_IMG_SHOWTYPE = item.NEWS_IMG_SHOWTYPE; img_insert.NEWS_ID = id; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(img_insert); } DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void Lnupload_Click(object sender, EventArgs e) { string strLink = ""; try { // Get the HttpFileCollection HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { ESHOP_NEWS_IMAGE g_update = new ESHOP_NEWS_IMAGE(); string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_IMG_SHOWTYPE = Utils.CIntDef(ddlType.SelectedItem.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(g_update); DB.SubmitChanges(); } } SearchResult(); strLink = "news_images.aspx?news_id=" + m_news_id; } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
protected void Lnupload_Click(object sender, EventArgs e) { try { int img_id = Utils.CIntDef(Request.QueryString["img_id"]); var img_update = DB.ESHOP_NEWS_IMAGEs.Where(n => n.NEWS_IMG_ID == img_id).ToList(); // Get the HttpFileCollection HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { if (img_update != null && img_update.Count > 0) { var g_update = img_update[0]; string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_TYPE = Utils.CIntDef(rblType.SelectedValue); g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.SubmitChanges(); } else { ESHOP_NEWS_IMAGE g_update = new ESHOP_NEWS_IMAGE(); string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_TYPE = Utils.CIntDef(rblType.SelectedValue); g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(g_update); DB.SubmitChanges(); } } } if (img_update != null && img_update.Count > 0) { var g_update = img_update[0]; g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_TYPE = Utils.CIntDef(rblType.SelectedValue); g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_ID = m_news_id; DB.SubmitChanges(); } SearchResult(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void Lnupload_Click(object sender, EventArgs e) { string strLink = ""; try { // Get the HttpFileCollection HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { ESHOP_NEWS_IMAGE g_update = new ESHOP_NEWS_IMAGE(); string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_IMG_SHOWTYPE = Utils.CIntDef(ddlType.SelectedItem.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(g_update); DB.SubmitChanges(); } } SearchResult(); strLink = "news_images.aspx?news_id=" + m_news_id; } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) Response.Redirect(strLink); } }
private void copyAlbums(int id) { try { var _oldNews = DB.GetTable<ESHOP_NEWS_IMAGE>().Where(n => n.NEWS_ID == m_news_id); foreach (var item in _oldNews) { ESHOP_NEWS_IMAGE img_insert = new ESHOP_NEWS_IMAGE(); img_insert.NEWS_IMG_IMAGE1 = item.NEWS_IMG_IMAGE1; img_insert.NEWS_IMG_IMAGE2 = item.NEWS_IMG_IMAGE2; img_insert.NEWS_IMG_IMAGE3 = item.NEWS_IMG_IMAGE3; img_insert.NEWS_IMG_ORDER = item.NEWS_IMG_ORDER; img_insert.NEWS_IMG_DESC = item.NEWS_IMG_DESC; img_insert.NEWS_IMG_SHOWTYPE = item.NEWS_IMG_SHOWTYPE; img_insert.NEWS_ID = id; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(img_insert); } DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void Lnupload_Click(object sender, EventArgs e) { try { if (m_img_id != 0) { if (trImage1.Visible) { var list = DB.ESHOP_NEWS_IMAGEs.Where(n => n.NEWS_IMG_ID == m_img_id).ToList(); if (list.Count > 0) { list[0].NEWS_IMG_DESC = txtTitle.Value; list[0].NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); DB.SubmitChanges(); } } else { HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[0]; if (hpf.ContentLength > 0) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); var list = DB.ESHOP_NEWS_IMAGEs.Where(n => n.NEWS_IMG_ID == m_img_id).ToList(); if (list.Count > 0) { list[0].NEWS_IMG_DESC = txtTitle.Value; list[0].NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); list[0].NEWS_IMG_IMAGE1 = hpf.FileName; DB.SubmitChanges(); } } } } } else { // Get the HttpFileCollection HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { ESHOP_NEWS_IMAGE g_update = new ESHOP_NEWS_IMAGE(); string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(g_update); DB.SubmitChanges(); } } } Response.Redirect("news_images.aspx?type=" + _type + "&news_id=" + m_news_id); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void Lnupload_Click(object sender, EventArgs e) { try { if (m_img_id != 0) { if (trImage1.Visible) { var list = DB.ESHOP_NEWS_IMAGEs.Where(n => n.NEWS_IMG_ID == m_img_id).ToList(); if (list.Count > 0) { list[0].NEWS_IMG_DESC = txtTitle.Value; list[0].NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); DB.SubmitChanges(); } } else { HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[0]; if (hpf.ContentLength > 0) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); var list = DB.ESHOP_NEWS_IMAGEs.Where(n => n.NEWS_IMG_ID == m_img_id).ToList(); if (list.Count > 0) { list[0].NEWS_IMG_DESC = txtTitle.Value; list[0].NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); list[0].NEWS_IMG_IMAGE1 = hpf.FileName; DB.SubmitChanges(); } } } } } else { // Get the HttpFileCollection HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { ESHOP_NEWS_IMAGE g_update = new ESHOP_NEWS_IMAGE(); string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName); if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } hpf.SaveAs(fullpathfile); g_update.NEWS_IMG_DESC = txtTitle.Value; g_update.NEWS_IMG_ORDER = Utils.CIntDef(txtOrder.Value); g_update.NEWS_ID = m_news_id; g_update.NEWS_IMG_IMAGE1 = hpf.FileName; DB.ESHOP_NEWS_IMAGEs.InsertOnSubmit(g_update); DB.SubmitChanges(); } } } Response.Redirect("news_images.aspx?type="+_type+"&news_id=" + m_news_id); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }