private void SaveInfo(string strLink = "") { try { if (m_news_id > 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_CODE = txtcode.Value; //Kho //news_insert.NEWS_QUANTITY = Utils.CIntDef(txtquantity.Value); //news_insert.NEWS_INVENTORY = Utils.CIntDef(txtton.Value); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; //news_insert.UNIT_ID1 = Utils.CIntDef(drNhanHieu.SelectedValue); //news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); //news_insert.NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); //news_insert.UNIT_ID3 = Utils.CIntDef(txtcountbuy.Value); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; //news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; // news_insert.NEWS_FIELD1 = txtStatus.Value; //news_insert.NEWS_FIELD2 = txtbaohanh.Value; //news_insert.NEWS_FIELD3 = Rdstatus.SelectedValue; //news_insert.NEWS_FIELD4 = txtdesc_bot.Value; //news_insert.NEWS_FIELD4 = txtManufacture.Value; //news_insert.NEWS_FIELD5 = txtWeight.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); //save catefory SaveNewsCategory(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1 || Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1 || Utils.CIntDef(rblNewsContent.SelectedValue) == 1 || Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) { copyAllFiles(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1) { copyImage(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1) { copyAlbums(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsContent.SelectedValue) == 1) { copyHtml(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) { copyAtt(_new.Single().NEWS_ID); } strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + _new.Single().NEWS_ID : strLink; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { //get image //string News_Image1; //if (trUploadImage1.Visible == true) //{ // if (fileImage1.PostedFile != null) // { // News_Image1 = Path.GetFileName(fileImage1.PostedFile.FileName); // } // else // { // News_Image1 = ""; // } //} //else //{ // News_Image1 = hplImage1.Text; //} //string News_Image2; //if (trUploadImage2.Visible == true) //{ // if (fileImage2.PostedFile != null) // { // News_Image2 = Path.GetFileName(fileImage2.PostedFile.FileName); // } // else // { // News_Image2 = ""; // } //} //else //{ // News_Image2 = hplImage2.Text; //} string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } int _iType = Utils.CIntDef(rblNewsType.SelectedValue); if (_iType == 0 || _iType == 2) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_CODE = txtCode.Value; news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); news_insert.NEWS_FIELD1 = Utils.CStrDef(rdTinhtrang.SelectedValue); news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); news_insert.NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable<ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].NEWS_CODE = txtCode.Value; c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update.ToList()[0].NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //c_update.ToList()[0].NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); c_update.ToList()[0].NEWS_FIELD1 = Utils.CStrDef(rdTinhtrang.SelectedValue); //c_update.ToList()[0].UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; //c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} //if (trUploadImage2.Visible) //{ // if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image2; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage2.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } else { if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_CODE = txtCode.Value; news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); news_insert.NEWS_FIELD1 = Utils.CStrDef(rdTinhtrang.SelectedValue); news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); news_insert.NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //news_insert.NEWS_PRICE3 = Utils.CDecDef(TextBox1.Text); //news_insert.NEWS_PRICE2 = Utils.CDecDef(txtgiamgia.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; // news_insert.NEWS_FIELD1 = txtStatus.Value; //news_insert.NEWS_FIELD2 = txtWarranty.Value; //news_insert.NEWS_FIELD3 = txtOrigin.Value; //news_insert.NEWS_FIELD4 = txtManufacture.Value; //news_insert.NEWS_FIELD5 = txtWeight.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable<ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].NEWS_CODE = txtCode.Value; c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update.ToList()[0].NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //c_update.ToList()[0].NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); c_update.ToList()[0].NEWS_FIELD1 = Utils.CStrDef(rdTinhtrang.SelectedValue); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtgiamgia.Value); //c_update.ToList()[0].NEWS_PRICE3 = Utils.CDecDef(TextBox1.Text); //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; //c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} //if (trUploadImage2.Visible) //{ // if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image2; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage2.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } //else //{ // lblError.Text = "Vui lòng chọn màu sắc - kích cỡ!"; //} } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { if (m_news_id > 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlCategory.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_LANGUAGE = Utils.CIntDef(rblLanguage.SelectedValue); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CIntDef(txtPrice.Value); news_insert.UNIT_ID1 = Utils.CIntDef(ddlUnit1.SelectedValue); news_insert.NEWS_PRICE2 = Utils.CIntDef(txtPriceSub.Value); news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); //save catefory SaveNewsCategory(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1 || Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1 || Utils.CIntDef(rblNewsContent.SelectedValue) == 1 || Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) copyAllFiles(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1) copyImage(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1) copyAlbums(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsContent.SelectedValue) == 1) copyHtml(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) copyAtt(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + _new.Single().NEWS_ID : strLink; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { int _CATID = Utils.CIntDef(ddlCategory.SelectedValue); string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_VIDEO_URL = txtVideo.Value; news_insert.NEWS_COUNT = 1; news_insert.NEWS_FIELD1 = rblNoiBat.SelectedValue; news_insert.UNIT_ID1 = 0; news_insert.NEWS_LANGUAGE = getlangbycatid(_CATID); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.NEWS_TYPE = _type; news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); //news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; news_insert.NEWS_FIELD4 = ddl_kenh.SelectedValue; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?type=" + _type + "&news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable <ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id).ToList(); if (c_update.ToList().Count > 0) { c_update[0].NEWS_UPDATE = DateTime.Now; c_update[0].NEWS_TITLE = txtTitle.Value; c_update[0].NEWS_VIDEO_URL = txtVideo.Value; c_update[0].NEWS_FIELD1 = rblNoiBat.SelectedValue; c_update[0].NEWS_LANGUAGE = getlangbycatid(_CATID); c_update[0].NEWS_DESC = txtDesc.Value; c_update[0].NEWS_URL = txtUrl.Value; c_update[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update[0].NEWS_TYPE = _type; c_update[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); //c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx?type=" + _type + "" : strLink; } } if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { //get image //string News_Image1; //if (trUploadImage1.Visible == true) //{ // if (fileImage1.PostedFile != null) // { // News_Image1 = Path.GetFileName(fileImage1.PostedFile.FileName); // } // else // { // News_Image1 = ""; // } //} //else //{ // News_Image1 = hplImage1.Text; //} //string News_Image2; //if (trUploadImage2.Visible == true) //{ // if (fileImage2.PostedFile != null) // { // News_Image2 = Path.GetFileName(fileImage2.PostedFile.FileName); // } // else // { // News_Image2 = ""; // } //} //else //{ // News_Image2 = hplImage2.Text; //} string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } int _iType = Utils.CIntDef(rblNewsType.SelectedValue); if (_iType == 0 || _iType == 2) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_CODE = txtCode.Value; news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); //news_insert.NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); news_insert.NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable <ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].NEWS_CODE = txtCode.Value; c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update.ToList()[0].NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //c_update.ToList()[0].NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); //c_update.ToList()[0].NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); //c_update.ToList()[0].UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; //c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} //if (trUploadImage2.Visible) //{ // if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image2; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage2.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } else { if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_CODE = txtCode.Value; news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); //news_insert.NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); news_insert.NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //news_insert.NEWS_PRICE3 = Utils.CDecDef(TextBox1.Text); //news_insert.NEWS_PRICE2 = Utils.CDecDef(txtgiamgia.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; // news_insert.NEWS_FIELD1 = txtStatus.Value; //news_insert.NEWS_FIELD2 = txtWarranty.Value; //news_insert.NEWS_FIELD3 = txtOrigin.Value; //news_insert.NEWS_FIELD4 = txtManufacture.Value; //news_insert.NEWS_FIELD5 = txtWeight.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable <ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].NEWS_CODE = txtCode.Value; c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update.ToList()[0].NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //c_update.ToList()[0].NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); //c_update.ToList()[0].NEWS_FIELD2 = Utils.CStrDef(txtWebsite.Value); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].UNIT_ID1 = Utils.CIntDef(ddlBrand.SelectedValue); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value.Replace(",", "")); c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtPriceNew.Value.Replace(",", "")); //c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(txtgiamgia.Value); //c_update.ToList()[0].NEWS_PRICE3 = Utils.CDecDef(TextBox1.Text); //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; //c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} //if (trUploadImage2.Visible) //{ // if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image2; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage2.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } //else //{ // lblError.Text = "Vui lòng chọn màu sắc - kích cỡ!"; //} } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { //get image //string News_Image2; //if (trUploadImage2.Visible == true) //{ // if (fileImage2.PostedFile != null) // { // News_Image2 = Path.GetFileName(fileImage2.PostedFile.FileName); // } // else // { // News_Image2 = ""; // } //} //else //{ // News_Image2 = hplImage2.Text; //} string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_CODE = txtcode.Value; news_insert.NEWS_VIDEO_URL = txtVideo.Value; news_insert.NEWS_COUNT = 1; //Kho //news_insert.NEWS_QUANTITY = Utils.CIntDef(txtquantity.Value); //news_insert.NEWS_INVENTORY = Utils.CIntDef(txtton.Value); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; //news_insert.UNIT_ID1 = Utils.CIntDef(drNhanHieu.SelectedValue); news_insert.NEWS_TYPE = _type; news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); //news_insert.NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); //news_insert.UNIT_ID3 = Utils.CIntDef(txtcountbuy.Value); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; // news_insert.NEWS_FIELD1 = txtStatus.Value; //news_insert.NEWS_FIELD2 = txtbaohanh.Value; //news_insert.NEWS_FIELD3 = Rdstatus.SelectedValue; //news_insert.NEWS_FIELD4 = txtdesc_bot.Value; //news_insert.NEWS_FIELD4 = txtManufacture.Value; //news_insert.NEWS_FIELD5 = txtWeight.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?type=" + _type + "&news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable<ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_CODE = txtcode.Value; c_update.ToList()[0].NEWS_VIDEO_URL = txtVideo.Value; c_update.ToList()[0].NEWS_COUNT = 1; //Kho //c_update.ToList()[0].NEWS_QUANTITY =Utils.CIntDef(txtquantity.Value); //c_update.ToList()[0].NEWS_INVENTORY = Utils.CIntDef(txtton.Value); c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; //c_update.ToList()[0].NEWS_FIELD2 = txtbaohanh.Value; //c_update.ToList()[0].NEWS_FIELD3 = Rdstatus.SelectedValue; //c_update.ToList()[0].NEWS_FIELD4 = txtdesc_bot.Value; c_update.ToList()[0].NEWS_TYPE = _type; c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //c_update.ToList()[0].NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); //c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); //c_update.ToList()[0].UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); //c_update.ToList()[0].UNIT_ID3 = Utils.CIntDef(txtcountbuy.Value); //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; //c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx?type=" + _type + "" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} //if (trUploadImage2.Visible) //{ // if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image2; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage2.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { if (m_news_id > 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_CODE = txtcode.Value; //Kho //news_insert.NEWS_QUANTITY = Utils.CIntDef(txtquantity.Value); //news_insert.NEWS_INVENTORY = Utils.CIntDef(txtton.Value); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; //news_insert.UNIT_ID1 = Utils.CIntDef(drNhanHieu.SelectedValue); //news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); //news_insert.NEWS_FIELD1 = Utils.CStrDef(rblField1.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); //news_insert.NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); //news_insert.UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); //news_insert.UNIT_ID3 = Utils.CIntDef(txtcountbuy.Value); //news_insert.NEWS_IMAGE1 = News_Image1; //news_insert.NEWS_IMAGE2 = News_Image2; //news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; // news_insert.NEWS_FIELD1 = txtStatus.Value; //news_insert.NEWS_FIELD2 = txtbaohanh.Value; //news_insert.NEWS_FIELD3 = Rdstatus.SelectedValue; //news_insert.NEWS_FIELD4 = txtdesc_bot.Value; //news_insert.NEWS_FIELD4 = txtManufacture.Value; //news_insert.NEWS_FIELD5 = txtWeight.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); //save catefory SaveNewsCategory(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1 || Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1 || Utils.CIntDef(rblNewsContent.SelectedValue) == 1 || Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) copyAllFiles(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1) copyImage(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1) copyAlbums(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsContent.SelectedValue) == 1) copyHtml(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) copyAtt(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + _new.Single().NEWS_ID : strLink; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { if (m_news_id > 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlCategory.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); news_insert.NEWS_LANGUAGE = Utils.CIntDef(rblLanguage.SelectedValue); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CIntDef(txtPrice.Value); news_insert.UNIT_ID1 = Utils.CIntDef(ddlUnit1.SelectedValue); news_insert.NEWS_PRICE2 = Utils.CIntDef(txtPriceSub.Value); news_insert.UNIT_ID2 = Utils.CIntDef(ddlUnit2.SelectedValue); news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); //save catefory SaveNewsCategory(_new.Single().NEWS_ID); if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1 || Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1 || Utils.CIntDef(rblNewsContent.SelectedValue) == 1 || Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) { copyAllFiles(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsImage.SelectedValue) == 1) { copyImage(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsAlbum.SelectedValue) == 1) { copyAlbums(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsContent.SelectedValue) == 1) { copyHtml(_new.Single().NEWS_ID); } if (Utils.CIntDef(rblNewsAtt.SelectedValue) == 1) { copyAtt(_new.Single().NEWS_ID); } strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?news_id=" + _new.Single().NEWS_ID : strLink; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { //get image string News_Image2; if (trUploadImage2.Visible == true) { if (fileImage2.PostedFile != null) { News_Image2 = Path.GetFileName(fileImage2.PostedFile.FileName); } else { News_Image2 = ""; } } else { News_Image2 = hplImage2.Text; } string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.SHOP_ID = Utils.CIntDef(ddlShop.SelectedValue); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_CODE = txtcode.Value; //news_insert.NEWS_VIDEO_URL = txtVideo.Value; news_insert.NEWS_COUNT = 1; //Kho //news_insert.NEWS_QUANTITY = Utils.CIntDef(txtquantity.Value); //news_insert.NEWS_INVENTORY = Utils.CIntDef(txtton.Value); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); news_insert.NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); news_insert.NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); news_insert.UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); news_insert.UNIT_ID1 = Utils.CIntDef(rdVAT.SelectedValue); news_insert.NEWS_FIELD2 = txtBaohanh.Value; news_insert.NEWS_FIELD3 = Rdstatus.SelectedValue; //news_insert.UNIT_ID3 = Utils.CIntDef(txtcountbuy.Value); //news_insert.NEWS_IMAGE1 = News_Image1; news_insert.NEWS_IMAGE2 = News_Image2; news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; news_insert.NEWS_FIELD4 = txtdesc_bot.Value; news_insert.NEWS_IMAGE4 = txtTenspKhuyenmai.Value; news_insert.NEWS_FIELD5 = txtLienket.Value; news_insert.NEWS_IMAGE1 = txtTrigia.Value; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable <ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?type=" + _type + "&news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable <ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id); if (c_update.ToList().Count > 0) { c_update.ToList()[0].SHOP_ID = Utils.CIntDef(ddlShop.SelectedValue); c_update.ToList()[0].NEWS_TITLE = txtTitle.Value; c_update.ToList()[0].NEWS_CODE = txtcode.Value; //c_update.ToList()[0].NEWS_VIDEO_URL = txtVideo.Value; //Kho //c_update.ToList()[0].NEWS_QUANTITY =Utils.CIntDef(txtquantity.Value); //c_update.ToList()[0].NEWS_INVENTORY = Utils.CIntDef(txtton.Value); c_update.ToList()[0].NEWS_DESC = txtDesc.Value; c_update.ToList()[0].NEWS_URL = txtUrl.Value; c_update.ToList()[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update.ToList()[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update.ToList()[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update.ToList()[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update.ToList()[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update.ToList()[0].NEWS_TYPE = Utils.CIntDef(rblNewsType.SelectedValue); c_update.ToList()[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); c_update.ToList()[0].NEWS_PERIOD = Utils.CIntDef(rblNewsPeriod.SelectedValue); c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update.ToList()[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update.ToList()[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update.ToList()[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update.ToList()[0].NEWS_PRICE1 = Utils.CDecDef(txtPrice.Value); c_update.ToList()[0].NEWS_PRICE2 = Utils.CDecDef(Txtprice_promos.Value); c_update.ToList()[0].UNIT_ID2 = Utils.CIntDef(Drhangsx.SelectedValue); c_update.ToList()[0].UNIT_ID1 = Utils.CIntDef(rdVAT.SelectedValue); c_update.ToList()[0].NEWS_FIELD2 = txtBaohanh.Value; c_update.ToList()[0].NEWS_FIELD3 = Rdstatus.SelectedValue; c_update.ToList()[0].NEWS_FIELD4 = txtdesc_bot.Value; c_update.ToList()[0].NEWS_IMAGE4 = txtTenspKhuyenmai.Value; c_update.ToList()[0].NEWS_FIELD5 = txtLienket.Value; c_update.ToList()[0].NEWS_IMAGE1 = txtTrigia.Value; //c_update.ToList()[0].NEWS_IMAGE1 = News_Image1; c_update.ToList()[0].NEWS_IMAGE2 = News_Image2; c_update.ToList()[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx?type=" + _type + "" : strLink; } } //update images //if (trUploadImage1.Visible) //{ // if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName)) // { // string pathfile = Server.MapPath("/data/news/" + m_news_id); // string fullpathfile = pathfile + "/" + News_Image1; // if (!Directory.Exists(pathfile)) // { // Directory.CreateDirectory(pathfile); // } // fileImage1.PostedFile.SaveAs(fullpathfile); // } //} if (trUploadImage2.Visible) { if (!string.IsNullOrEmpty(fileImage2.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image2; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage2.PostedFile.SaveAs(fullpathfile); } } if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { int _CATID = Utils.CIntDef(ddlCategory.SelectedValue); string News_Image3; if (trUploadImage3.Visible == true) { if (fileImage3.PostedFile != null) { News_Image3 = Path.GetFileName(fileImage3.PostedFile.FileName); } else { News_Image3 = ""; } } else { News_Image3 = hplImage3.Text; } if (CheckError()) { if (m_news_id == 0) { //insert ESHOP_NEW news_insert = new ESHOP_NEW(); news_insert.NEWS_TITLE = txtTitle.Value; news_insert.NEWS_VIDEO_URL = txtVideo.Value; news_insert.NEWS_COUNT = 1; news_insert.NEWS_FIELD1 = rblNoiBat.SelectedValue; news_insert.UNIT_ID1 = 0; news_insert.NEWS_LANGUAGE = getlangbycatid(_CATID); news_insert.NEWS_DESC = txtDesc.Value; news_insert.NEWS_URL = txtUrl.Value; news_insert.NEWS_TARGET = ddlTarget.SelectedValue; news_insert.NEWS_SEO_URL = txtSeoUrl.Value; news_insert.NEWS_SEO_TITLE = txtSeoTitle.Value; news_insert.NEWS_SEO_KEYWORD = txtSeoKeyword.Value; news_insert.NEWS_SEO_DESC = txtSeoDescription.Value; news_insert.NEWS_TYPE = _type; news_insert.NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); //news_insert.NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); news_insert.NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //news_insert.NEWS_COUNT = Utils.CIntDef(txtCount.Value); news_insert.NEWS_ORDER = Utils.CIntDef(txtOrder.Value); news_insert.NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); news_insert.NEWS_IMAGE3 = News_Image3; news_insert.USER_ID = Utils.CIntDef(Session["USER_ID"]); news_insert.NEWS_PUBLISHDATE = DateTime.Now; news_insert.NEWS_FIELD4 = ddl_kenh.SelectedValue; DB.ESHOP_NEWs.InsertOnSubmit(news_insert); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); m_news_id = _new.Single().NEWS_ID; SaveNewsCategory(_new.Single().NEWS_ID); strLink = string.IsNullOrEmpty(strLink) ? "news.aspx?type=" + _type + "&news_id=" + m_news_id : strLink; } else { //update var c_update = DB.GetTable<ESHOP_NEW>().Where(g => g.NEWS_ID == m_news_id).ToList(); if (c_update.ToList().Count > 0) { c_update[0].NEWS_UPDATE = DateTime.Now; c_update[0].NEWS_TITLE = txtTitle.Value; c_update[0].NEWS_VIDEO_URL = txtVideo.Value; c_update[0].NEWS_FIELD1 = rblNoiBat.SelectedValue; c_update[0].NEWS_LANGUAGE = getlangbycatid(_CATID); c_update[0].NEWS_DESC = txtDesc.Value; c_update[0].NEWS_URL = txtUrl.Value; c_update[0].NEWS_TARGET = ddlTarget.SelectedValue; c_update[0].NEWS_SEO_URL = txtSeoUrl.Value; c_update[0].NEWS_SEO_TITLE = txtSeoTitle.Value; c_update[0].NEWS_SEO_KEYWORD = txtSeoKeyword.Value; c_update[0].NEWS_SEO_DESC = txtSeoDescription.Value; c_update[0].NEWS_TYPE = _type; c_update[0].NEWS_SHOWTYPE = Utils.CIntDef(rblStatus.SelectedValue); //c_update.ToList()[0].NEWS_SHOWINDETAIL = Utils.CIntDef(rblShowDetail.SelectedValue); c_update[0].NEWS_FEEDBACKTYPE = Utils.CIntDef(rblFeefback.SelectedValue); //c_update.ToList()[0].NEWS_COUNT = Utils.CIntDef(txtCount.Value); c_update[0].NEWS_ORDER = Utils.CIntDef(txtOrder.Value); c_update[0].NEWS_ORDER_PERIOD = Utils.CIntDef(txtOrderPeriod.Value); c_update[0].NEWS_IMAGE3 = News_Image3; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "news_list.aspx?type=" + _type + "" : strLink; } } if (trUploadImage3.Visible) { if (!string.IsNullOrEmpty(fileImage3.PostedFile.FileName)) { string pathfile = Server.MapPath("/data/news/" + m_news_id); string fullpathfile = pathfile + "/" + News_Image3; if (!Directory.Exists(pathfile)) { Directory.CreateDirectory(pathfile); } fileImage3.PostedFile.SaveAs(fullpathfile); } } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void UpdateProduct(string path) { try { Workbook workBook; SharedStringTable sharedStrings; IEnumerable<Sheet> workSheets; WorksheetPart custSheet; //WorksheetPart orderSheet; //Declare helper variables. string custID; //string orderID; List<NewsEntity> listnews; //List<Order> orders; //Open the Excel workbook. using (SpreadsheetDocument document = SpreadsheetDocument.Open(@""+path+"", true)) { //References to the workbook and Shared String Table. workBook = document.WorkbookPart.Workbook; workSheets = workBook.Descendants<Sheet>(); sharedStrings = document.WorkbookPart.SharedStringTablePart.SharedStringTable; //Reference to Excel Worksheet with Customer data. custID = workSheets.First(s => s.Name == @"Sheet1").Id; custSheet = (WorksheetPart)document.WorkbookPart.GetPartById(custID); //Load customer data to business object. listnews = LoadListnews(custSheet.Worksheet, sharedStrings); foreach (var i in listnews) { var list = DB.ESHOP_NEWs.Where(n => n.NEWS_CODE == i._news_code && !String.IsNullOrEmpty(i._news_code)).ToList(); if (list.Count > 0) { list[0].NEWS_TITLE = i._news_tile; list[0].NEWS_CODE = i._news_code; list[0].NEWS_FIELD5 = i._news_congnghe; list[0].NEWS_FIELD4 = i._news_weight; list[0].UNIT_ID2 = i._news_hangsx; list[0].UNIT_ID1 = i._news_xuatxu; list[0].NEWS_FIELD2 = i._news_baohanh; list[0].NEWS_FIELD3 = i._news_status.ToString(); list[0].UNIT_ID3 = i._news_vat; list[0].NEWS_PERIOD = i._news_period; list[0].NEWS_PRICE1 = i._news_price; list[0].NEWS_PRICE2 = i._news_priceMos; list[0].NEWS_PRICE3 = i._news_priceGiovang; list[0].NEWS_PRICEMUAVAO = i._news_priceMuavao; list[0].NEWS_SEO_URL = CpanelUtils.ClearUnicodeSeo(i._news_tile); list[0].NEWS_SEO_TITLE = i._news_tile; list[0].NEWS_KEYWORD_ASCII = CpanelUtils.ClearUnicode(i._news_tile); DB.SubmitChanges(); } else { ESHOP_NEW news = new ESHOP_NEW(); news.NEWS_TITLE = i._news_tile; news.NEWS_CODE = i._news_code; news.NEWS_FIELD5 = i._news_congnghe; news.NEWS_FIELD4 = i._news_weight; news.UNIT_ID2 = i._news_hangsx; news.UNIT_ID1 = i._news_xuatxu; news.NEWS_FIELD2 = i._news_baohanh; news.NEWS_FIELD3 = i._news_status.ToString(); news.UNIT_ID3 = i._news_vat; news.NEWS_PERIOD = i._news_period; news.NEWS_PRICE1 = i._news_price; news.NEWS_PRICE2 = i._news_priceMos; news.NEWS_PRICE3 = i._news_priceGiovang; news.NEWS_PRICEMUAVAO = i._news_priceMuavao; news.NEWS_TYPE = 1; news.NEWS_SHOWTYPE = 1; news.NEWS_PUBLISHDATE = DateTime.Now; news.NEWS_COUNT = 1; news.NEWS_ORDER = 1; news.NEWS_SEO_URL = CpanelUtils.ClearUnicodeSeo(i._news_tile); news.NEWS_SEO_TITLE = i._news_tile; news.NEWS_SEO_KEYWORD = i._news_tile; news.USER_ID = 1; news.NEWS_KEYWORD_ASCII = CpanelUtils.ClearUnicode(i._news_tile); DB.ESHOP_NEWs.InsertOnSubmit(news); DB.SubmitChanges(); //update cat news var _new = DB.GetTable<ESHOP_NEW>().OrderByDescending(g => g.NEWS_ID).Take(1); SaveNewsCategory(_new.Single().NEWS_ID, i._catid); } } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }