protected void btSend_Click(object sender, EventArgs e) { string listEmail = GetListEmail(); string listSended = ""; string resultInfo = ""; string mailContent = ContentExtendtions.ProcessStringContent(tbContent.Text, "", pic); mailContent = mailContent.Replace("src=\"/", "src=\"" + UrlExtension.WebisteUrl); mailContent = mailContent.Replace("src='/", "src='" + UrlExtension.WebisteUrl); foreach (string email in listEmail.Split(new string[] { parramSplitString }, StringSplitOptions.None)) { if (email.Length > 0) { resultInfo = EmailExtension.SendEmail(email, tbTieuDe.Text, mailContent); if (resultInfo == "Đã gửi Email thành công") { listSended += email + ", "; } } } ltrDaGuiCho.Text = @" <div class='khungDaGui'> <span class='text1'>Đã gửi email đến</span>: " + listSended + @" </div> "; }
protected void btOK_Click(object sender, EventArgs e) { #region Bao gồm - included string baoGom = ""; for (int i = 0; i < cblBaoGom.Items.Count; i++) { if (cblBaoGom.Items[i].Selected) { baoGom += cblBaoGom.Items[i].Value + ","; } } if (baoGom != "") { baoGom = baoGom.Remove(baoGom.Length - ",".Length); } #endregion string chiTiet = ContentExtendtions.ProcessStringContent(tbChiTiet.Text, hdChiTiet.Value, pic); #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion if (isid != "") { string image = flAnhDaiDien.Save(true, chiTiet); Subitems.UpdateSubitemsFull(iid, lang, app, tbLoaiPhong.Text, chiTiet, image, baoGom, "", tbHuongPhong.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), trangThai, isid, tbGiaNiemYet.Text, tbGiaKhuyenMai.Text, "", "", "", tbSuChuaToiDa.Text, tbThuTu.Text, ddlCoTheTraPhongKhong.SelectedValue, ddlCoGomBuaSangKhong.SelectedValue, tbDienTichPhong.Text, tbLoaiGiuong.Text, DateTime.Now.ToString(), DateTime.Now.ToString()); ltrThongBao.Text = "Thông báo: đã sửa " + tbLoaiPhong.Text; } else { string image = flAnhDaiDien.Save(false, chiTiet); Subitems.InsertSubitemsFull(iid, lang, app, tbLoaiPhong.Text, chiTiet, image, baoGom, "", tbHuongPhong.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), trangThai, tbGiaNiemYet.Text, tbGiaKhuyenMai.Text, "", "", "", tbSuChuaToiDa.Text, tbThuTu.Text, ddlCoTheTraPhongKhong.SelectedValue, ddlCoGomBuaSangKhong.SelectedValue, tbDienTichPhong.Text, tbLoaiGiuong.Text, DateTime.Now.ToString(), DateTime.Now.ToString()); ltrThongBao.Text = "Thông báo: đã tạo " + tbLoaiPhong.Text; } ResetControls(); }
protected void BtnSave_Click(object sender, EventArgs e) { SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyContentContactWebsite, ContentExtendtions.ProcessStringContent(tbNoiDungTrangLienHe.Text, hdNoiDungTrangLienHe.Value, FolderPic.Contact), language); SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyThongBaoSauKhiGuiLienHe, ContentExtendtions.ProcessStringContent(tbThongBaoSauKhiGuiLienHe.Text, hdThongBaoSauKhiGuiLienHe.Value, FolderPic.Contact), language); SettingsExtension.SetOtherSettingKey("ThongBaoSauKhiGuiDKDichVu", tbThongBaoSauKhiGuiDKDichVu.Text, language); }
protected void btSave_Click(object sender, EventArgs e) { //Lay thong tin trang popup tai trang chu SettingsExtension.SetOtherSettingKey(TatThanhJsc.Extension.SettingsExtension.KeyHienThiPopupTaiTrangChu, ddlShowpopup.SelectedValue, language); string newDetail = ContentExtendtions.ProcessStringContent(tbPopupDetail.Text, hdOldDetail.Value, FolderPic.SystemWebsite); SettingsExtension.SetOtherSettingKey(TatThanhJsc.Extension.SettingsExtension.KeyChiTietTrangPopup, newDetail, language); string newContent = ContentExtendtions.ProcessStringContent(tbPopupContent.Text, hdOldContent.Value, FolderPic.SystemWebsite); SettingsExtension.SetOtherSettingKey(TatThanhJsc.Extension.SettingsExtension.KeyNoiDungPopupTaiTrangChu, newContent, language); ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "alert('Cập nhật thành công!');", true); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", SettingsExtension.KeyHienThiPopupTaiTrangChu, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật thông tin hệ thống (" + SettingsExtension.KeyHienThiPopupTaiTrangChu + ")"); #endregion }
protected void btOK_Click(object sender, EventArgs e) { string contentDetail = ContentExtendtions.ProcessStringContent(tbDetail.Text, hdOldContent.Value, pic); #region Status string status = "0"; if (cbStatus.Checked == true) { status = "1"; } #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbTitle.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbTitle.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbTitle.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = tbDesc.Text; } #endregion #region Insert if (insert) { string image = flAnhDaiDien.Save(false, contentDetail); Groups.InsertGroups(language, app, ddlParentCate.SelectedValue, tbTitle.Text, tbDesc.Text, contentDetail, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", image, "", "", tbOrder.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbTitle.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, contentDetail); Groups.UpdateGroups(language, app, tbTitle.Text, tbDesc.Text, contentDetail, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", image, "", "", tbOrder.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status, igid); if (ddlParentCate.SelectedValue != hd_parent) { Groups.UpdateParentOfGroups(igid, ddlParentCate.SelectedValue); } #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbTitle.Text); #endregion } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTitle.Text + "');", true); ResetControls(); LoadParentCate(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btn_insert_update_Click(object sender, EventArgs e) { string contentDetail = ContentExtendtions.ProcessStringContent(txt_content.Text, hdOldSupportOnline.Value, pic); #region Image string vimg = ""; string vimg_thumb = ""; if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } else { if (hd_img.Value.Length < 1 || cbLayAnhTuNoiDung.Checked)//nếu không upload ảnh và cũng không có ảnh cũ -> tìm ảnh đầu tiên trong nội dung làm ảnh đại diện { if (hd_img.Value.Length > 0) { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } string urlImg = ImagesExtension.GetFirstImageInContent(contentDetail); if (urlImg.Length > 0) { string filename = urlImg; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb"; } else { vimg = fileNotEx + "_" + ticks; } if (ImagesExtension.SaveImageFromUrl(path + vimg, urlImg).Length > 0) { vimg += fileex; #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } else { vimg = ""; } #endregion } } } } #endregion #region Status string status = "0"; if (chk_status.Checked == true) { status = "1"; } #endregion #region Time Create Date string timeCreateDate = ""; timeCreateDate = txtCreateDate.Text; #endregion #region Seo if (textLinkRewrite.Text.Trim().Equals("")) { textLinkRewrite.Text = txt_title.Text; } if (textTagTitle.Text.Trim().Equals("")) { textTagTitle.Text = txt_title.Text; } if (textTagKeyword.Text.Trim().Equals("")) { textTagKeyword.Text = txt_title.Text; } if (textTagDescription.Text.Trim().Equals("")) { textTagDescription.Text = txt_description.Text; } #endregion string phoneMobileEmail = StringExtension.GhepChuoi("", tbPhone.Text, tbMobile.Text, tbEmail.Text, tbZalo.Text, tbViber.Text, tbFacebook.Text, tbLoaiKhac.Text); #region Insert if (insert) { GroupsItems.InsertItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, tbYahoo.Text, tbSkype.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", phoneMobileEmail, "0", "0", "", "", timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), "", ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), "", status); #region Lay ra iid cua item vua duoc luu condition = DataExtension.AndConditon( ItemsTSql.GetItemsByDicreatedate(timeCreateDate), ItemsTSql.GetItemsByViapp(app)); DataTable dtInsertedItems = new DataTable(); dtInsertedItems = GroupsItems.GetAllData("1", "Items.iid", condition, ItemsColumns.IidColumn + " desc"); if (dtInsertedItems.Rows.Count > 0) { iid = dtInsertedItems.Rows[0][ItemsColumns.IidColumn].ToString(); } #endregion } #endregion #region Update else { if (vimg.Equals("")) { vimg = hd_img.Value; } else { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } GroupsItems.UpdateItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, tbYahoo.Text, tbSkype.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", phoneMobileEmail, "0", "0", "", HdIitotalview.Value, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), "", ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), "", status, iid); } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + txt_title.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void WebUserControl1_btnHandler(string strValue) { string subconten = StringExtension.GhepChuoi("", txtLinkQC.Text, ddl_type_open.SelectedValue); string contentDetail = StringExtension.GhepChuoi("", ContentExtendtions.ProcessStringContent(txt_content.Text, hdOldContent.Value, pic), txtTitleQC.Text, txtGiaLienHe.Text, txtLienHeNgay.Text); #region Image string vimg = ""; string vimg_thumb = ""; if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } #endregion #region Status string status = "0"; string checkDisplayHome = "0"; if (chk_status.Checked == true) { status = "1"; } if (chk_DisplayHome.Checked) { checkDisplayHome = "1"; } #endregion #region Seo if (textLinkRewrite.Text.Trim().Equals("")) { textLinkRewrite.Text = txt_title_modul.Text; } if (textTagTitle.Text.Trim().Equals("")) { textTagTitle.Text = txt_title_modul.Text; } if (textTagKeyword.Text.Trim().Equals("")) { textTagKeyword.Text = txt_title_modul.Text; } if (textTagDescription.Text.Trim().Equals("")) { textTagDescription.Text = txtDesc.Text; } #endregion #region Insert if (insert) { Groups.InsertGroups(language, app, DdlGroupProduct.SelectedValue, txt_title_modul.Text, txtDesc.Text, contentDetail, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, checkDisplayHome, subconten, dlTypeGroup.SelectedValue, vimg, "", "", txt_ordermodul.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", txt_title_modul.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + txt_title_modul.Text); #endregion } #endregion #region Update else { if (vimg.Equals("")) { vimg = hd_img.Value; } else { ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } Groups.UpdateGroups(language, app, txt_title_modul.Text, txtDesc.Text, contentDetail, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, checkDisplayHome, subconten, dlTypeGroup.SelectedValue, vimg, "", "", txt_ordermodul.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), status, igid); if (DdlGroupProduct.SelectedValue != hd_parent) { Groups.UpdateParentOfGroups(igid, DdlGroupProduct.SelectedValue); } #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", txt_title_modul.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + txt_title_modul.Text); #endregion } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", // "ThongBao(3000,'Đã tạo: " + txt_title.Text + "');", true); //Lưu vào session để gọi đến bên api Session["CotinuteCreateCate"] = true; Session["CotinuteCreateTitleCate"] = txt_title_modul.Text; ResetControls(); GetGroupsInDdl(); } else { Session["CotinuteCreateCate"] = false; Session["CotinuteCreateRedirectLinkCate"] = LinkRedrect(); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { string tongQuan = ContentExtendtions.ProcessStringContent(tbTongQuan.Text, hdTongQuan.Value, pic); string lichTrinh = ContentExtendtions.ProcessStringContent(tbLichTrinh.Text, hdLichTrinh.Value, pic); string bangGia = ContentExtendtions.ProcessStringContent(tbBangGiaVaChoO.Text, hdBangGiaVaChoO.Value, pic); #region Bao gồm - included string baoGom = ContentExtendtions.ProcessStringContent(tbBaoGom.Text, hdBaoGom.Value, pic); if (baoGom.Trim() == "")//Nếu không nhập bao gồm thì lấy danh sách id tích chọn { for (int i = 0; i < cblBaoGom.Items.Count; i++) { if (cblBaoGom.Items[i].Selected) { baoGom += cblBaoGom.Items[i].Value + ","; } } if (baoGom != "") { baoGom = "id-" + baoGom; } } else { baoGom = "text-" + baoGom; } #endregion #region Không bao gồm - excluded string khongBaoGom = ContentExtendtions.ProcessStringContent(tbKhongBaoGom.Text, hdKhongBaoGom.Value, pic); if (khongBaoGom.Trim() == "")//Nếu không nhập không bao gồm thì lấy danh sách id tích chọn { for (int i = 0; i < cblKhongBaoGom.Items.Count; i++) { if (cblKhongBaoGom.Items[i].Selected) { khongBaoGom += cblKhongBaoGom.Items[i].Value + ","; } } if (khongBaoGom != "") { khongBaoGom = "id-" + khongBaoGom; } } else { khongBaoGom = "text-" + khongBaoGom; } #endregion string dieuKhoanKhac = ContentExtendtions.ProcessStringContent(tbDieuKhoanKhac.Text, hdDieuKhoanKhac.Value, pic); string cabin = "";//Chuyển sang lưu ở subitem tương tự loại phòng của hotel string services = ContentExtendtions.ProcessStringContent(tbServices.Text, hdServices.Value, pic); string content = StringExtension.GhepChuoi("", tongQuan, lichTrinh, bangGia, tbMaDinhKemBanDoCruises.Text, GoogleMapMarkLocation.ViDo, GoogleMapMarkLocation.KinhDo, baoGom, khongBaoGom, dieuKhoanKhac, cabin, services); string thoiGian = tbSoNgay.Text + "-" + tbSoDem.Text; #region Các điểm đến string cacDiemDen = tbCacDiemDenSeQua.Text; if (cacDiemDen.Trim() == "")//Nếu không nhập thì lấy danh sách id tích chọn { cacDiemDen = hdIdCacDiemDenSeQua.Value; if (cacDiemDen != "") { cacDiemDen = "id-" + cacDiemDen; } } else { cacDiemDen = "text-" + cacDiemDen; } #endregion #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbTenCruises.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbTenCruises.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbTenCruises.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = tbMoTa.Text; } #endregion #region Ngày đăng if (tbNgayDang.Text == "") { tbNgayDang.Text = DateTime.Now.ToString(); } #endregion #region Insert if (insert) { string image = flAnhDaiDien.Save(false, tongQuan); GroupsItems.InsertItemsGroupsItems(lang, app, tbMaCruises.Text, tbTenCruises.Text, tbMoTa.Text, content, image, cacDiemDen, thoiGian, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", tbNgayKhoiHanh.Text, "", tbGiaNiemYet.Text, tbGiaKhuyenMai.Text, tbTongSoKhach.Text, "", tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai); #region Lấy ra id của items vừa được thêm iid = GetInsertedId(app, tbTenCruises.Text, tbNgayDang.Text); #endregion #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTenCruises.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbTenCruises.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, tongQuan); GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(hdGroupsItemId.Value)); GroupsItems.UpdateItemsGroupsItems(lang, app, tbMaCruises.Text, tbTenCruises.Text, tbMoTa.Text, content, image, cacDiemDen, thoiGian, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", tbNgayKhoiHanh.Text, "", tbGiaNiemYet.Text, tbGiaKhuyenMai.Text, tbTongSoKhach.Text, hdTotalView.Value, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai, iid); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTenCruises.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbTenCruises.Text); #endregion } #endregion #region Thuộc tính tour, mỗi thuộc tính làm một bản ghi liên kết Groups_Items //Lặp qua mỗi thuộc tính --> gọi hàm thêm mới, cập nhật thuộc tính for (int i = 0; i < cblThuocTinh.Items.Count; i++) { if (cblThuocTinh.Items[i].Selected) { InsertProperty(cblThuocTinh.Items[i].Value, iid); } else { DeleteProperty(cblThuocTinh.Items[i].Value, iid); } } #endregion #region After Insert/Update if (cbTiepTuc.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTenCruises.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { #region Các điểm đến string cacDiemDen = tbCacDiemDenSeQua.Text; if (cacDiemDen.Trim() == "")//Nếu không nhập thì lấy danh sách id tích chọn { cacDiemDen = hdIdCacDiemDenSeQua.Value; if (cacDiemDen != "") { cacDiemDen = "id-" + cacDiemDen; } } else { cacDiemDen = "text-" + cacDiemDen; } #endregion string hoatDongChiTiet = ContentExtendtions.ProcessStringContent(tbHoatDongChiTiet.Text, hdHoatDongChiTiet.Value, pic); string tenHoatDong = StringExtension.GhepChuoi("", tbNgay.Text, tbTenHoatDong.Text); #region Bữa ăn string buaAn = ""; for (int i = 0; i < cblBuaAn.Items.Count; i++) { if (cblBuaAn.Items[i].Selected) { buaAn += cblBuaAn.Items[i].Value + ","; } } #endregion #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion if (isid != "") { string image = flAnhDaiDien.Save(true, hoatDongChiTiet); Subitems.UpdateSubitems(iid, lang, app, tenHoatDong, hoatDongChiTiet, image, buaAn, tbThuTu.Text, cacDiemDen, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), trangThai, isid); //ScriptManager.RegisterStartupScript(this, this.GetType(), "", //"jAlert('Đã sửa: " + tbNgay.Text + ": " + tbTenHoatDong.Text + "','Thông báo')", true); ltrThongBao.Text = "Thông báo: đã sửa " + tbTenHoatDong.Text; } else { string image = flAnhDaiDien.Save(false, hoatDongChiTiet); Subitems.InsertSubitems(iid, lang, app, tenHoatDong, hoatDongChiTiet, image, buaAn, tbThuTu.Text, cacDiemDen, DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), trangThai); //ScriptManager.RegisterStartupScript(this, this.GetType(), "", //"jAlert('Đã tạo: " + tbNgay.Text + ": " + tbTenHoatDong.Text + "','Thông báo')", true); ltrThongBao.Text = "Thông báo: đã tạo " + tbTenHoatDong.Text; } ResetControls(); }
//protected void btn_insert_update_Click(object sender, EventArgs e) protected void WebUserControl1_btnHandler(string strValue) { #region Image string vimg = ""; string vimg_thumb = ""; string contentDetail = ContentExtendtions.ProcessStringContent(txt_content.Text, hdOldContent.Value, pic); if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } else { if (hd_img.Value.Length < 1 || cbLayAnhTuNoiDung.Checked)//nếu không upload ảnh và cũng không có ảnh cũ -> tìm ảnh đầu tiên trong nội dung làm ảnh đại diện { if (hd_img.Value.Length > 0) { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } string urlImg = ImagesExtension.GetFirstImageInContent(contentDetail); if (urlImg.Length > 0) { string filename = urlImg; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb"; } else { vimg = fileNotEx + "_" + ticks; } if (ImagesExtension.SaveImageFromUrl(path + vimg, urlImg).Length > 0) { vimg += fileex; #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } else { vimg = ""; } #endregion } } } } #endregion string specProduct = ContentExtendtions.ProcessStringContent(txt_spec.Text, hdOldSpec.Value, pic); string conditionProduct = ContentExtendtions.ProcessStringContent(txt_condition.Text, hdOldCondition.Value, pic); string storeProduct = ContentExtendtions.ProcessStringContent(txt_store.Text, hdOldStore.Value, pic); #region Status string status = "0"; if (chk_status.Checked == true) { status = "1"; } #region IID người đăng string iidNguoiDang = ""; string thongtindangbai = ""; string ngayxuatban = ""; if (DealConfig.KeyDuyetTin) { if (HorizaMenuConfig.ShowDuyetTin1 || HorizaMenuConfig.ShowDuyetTin2) { iidNguoiDang = CookieExtension.GetCookies("userId"); ngayxuatban = DateTime.Now.ToString(); } } #endregion #endregion #region Time Create Date string timeCreateDate = ""; timeCreateDate = txt_startdate.Text; #endregion #region End Date string end_date = "0"; if (chk_EndDate.Checked == true) { end_date = "1"; } #endregion #region Seo if (textLinkRewrite.Text.Trim().Equals("")) { textLinkRewrite.Text = txt_title.Text; } if (textTagTitle.Text.Trim().Equals("")) { textTagTitle.Text = txt_title.Text; } if (textTagKeyword.Text.Trim().Equals("")) { textTagKeyword.Text = txt_title.Text; } if (textTagDescription.Text.Trim().Equals("")) { textTagDescription.Text = txt_description.Text; } #endregion #region Insert if (insert) { GroupsItems.InsertItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, StringExtension.GhepChuoi("", contentDetail, specProduct, conditionProduct, storeProduct), vimg, iidNguoiDang, tbSoNguoiMuaToiThieu.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, thongtindangbai, ngayxuatban, ddlHinhThucNhan.SelectedValue, end_date, tbPrice.Text, tbPriceOld.Text, txt_quantity.Text, "", timeCreateDate, DateTime.Now.ToString(), txt_endDate.Text + " " + ddl_hour.SelectedValue + ":" + ddl_minute.SelectedValue, tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), txt_endDate.Text + " " + ddl_hour.SelectedValue + ":" + ddl_minute.SelectedValue, tbOrder.Text, status); #region Lay ra iid cua item vua duoc luu condition = DataExtension.AndConditon( ItemsTSql.GetItemsByDicreatedate(timeCreateDate), ItemsTSql.GetItemsByViapp(app)); DataTable dtInsertedItems = new DataTable(); dtInsertedItems = GroupsItems.GetAllData("1", "Items.iid", condition, ItemsColumns.IidColumn + " desc"); if (dtInsertedItems.Rows.Count > 0) { iid = dtInsertedItems.Rows[0][ItemsColumns.IidColumn].ToString(); } #endregion } #endregion #region Update else { if (vimg.Equals("")) { vimg = hd_img.Value; } else { ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } if (DealConfig.KeyDuyetTin) { string userRole = CookieExtension.GetCookies("RolesUser"); if (HorizaMenuConfig.ShowDuyetTin2) { if (hdEnable.Value == PhanQuyen.DuyetTin.Cap1 && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap1, userRole)) { status = "0"; } else if (hdEnable.Value == "1" && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole)) { status = "1"; } else if (hdEnable.Value != "0" && hdEnable.Value != "1") { status = hdEnable.Value; } } else { if (hdEnable.Value == PhanQuyen.DuyetTin.Cap2 && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole)) { status = "0"; } else if (hdEnable.Value != "0" && hdEnable.Value != "1") { status = hdEnable.Value; } } } string nguoiDangCu = hdNguoiDangCu.Value; string thongtincu = hdThongTinThem.Value; string ngayxuatbancu = hdNgayXuatBan.Value; GroupsItems.UpdateItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, StringExtension.GhepChuoi("", contentDetail, specProduct, conditionProduct, storeProduct), vimg, nguoiDangCu, tbSoNguoiMuaToiThieu.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, thongtincu, ngayxuatbancu, ddlHinhThucNhan.SelectedValue, end_date, tbPrice.Text, tbPriceOld.Text, txt_quantity.Text, HdIitotalview.Value, timeCreateDate, DateTime.Now.ToString(), txt_endDate.Text + " " + ddl_hour.SelectedValue + ":" + ddl_minute.SelectedValue, tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), txt_endDate.Text + " " + ddl_hour.SelectedValue + ":" + ddl_minute.SelectedValue, tbOrder.Text, status, iid); } #endregion #region Properties-Chi thực hiện khi chức năng Quản lý thuộc tính được hiển thị if (DealConfig.KeyHienThiQuanLyThuocTinhDeal) { string properties = parramSpitString; for (int i = 0; i < rptProperties.Items.Count; i++) { CheckBox checkBoxProperties = (CheckBox)rptProperties.Items[i].FindControl("checkBoxProperties"); if (checkBoxProperties.Checked == true) { properties += checkBoxProperties.ToolTip + parramSpitString; } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(propertyModul)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region Nicks - Chỉ hiển thị khi chức năng add nick được hiển thị if (DealConfig.KeyHienThiAddNickChoDeal) { string nicks = parramSpitString; for (int i = 0; i < rptNicks.Items.Count; i++) { CheckBox checkBoxNicks = (CheckBox)rptNicks.Items[i].FindControl("checkBoxNicks"); if (checkBoxNicks.Checked == true) { nicks += checkBoxNicks.ToolTip + parramSpitString; } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(TatThanhJsc.OtherModul.CodeApplications.SupportOnline)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, TatThanhJsc.OtherModul.CodeApplications.SupportOnline, "", nicks, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, TatThanhJsc.OtherModul.CodeApplications.SupportOnline, "", nicks, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region FilterProperties - Chỉ hiển thị khi tính năng lọc deal được hiển thị if (DealConfig.KeyHienThiThuocTinhLocDeal) { string filterProperties = parramSpitString; for (int i = 0; i < rptParentFilter.Items.Count; i++) { RadioButtonList rdblListAnswer = (RadioButtonList)rptParentFilter.Items[i].FindControl("rdblAnswer"); if (rdblListAnswer != null) { if (rdblListAnswer.SelectedValue.Length > 0) { filterProperties += rdblListAnswer.SelectedValue + parramSpitString; } } CheckBoxList cblListAnswer = (CheckBoxList)rptParentFilter.Items[i].FindControl("cblAnswer"); if (cblListAnswer != null) { for (int j = 0; j < cblListAnswer.Items.Count; j++) { if (cblListAnswer.Items[j].Selected == true) { filterProperties += cblListAnswer.Items[j].Value + parramSpitString; } } } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(CodeApplications.DealFilterProperties)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, CodeApplications.DealFilterProperties, "", filterProperties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, CodeApplications.DealFilterProperties, "", filterProperties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", // "ThongBao(3000,'Đã tạo: " + txt_title.Text + "');", true); //Lưu vào session để gọi đến bên api Session["CotinuteCreate"] = true; Session["CotinuteCreateTitle"] = txt_title.Text; ResetControls(); } else { Session["CotinuteCreate"] = false; Session["CotinuteCreateRedirectLink"] = LinkRedrect(); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { string contentDetail = ContentExtendtions.ProcessStringContent(tbContent.Text, hdOldContent.Value, pic); #region Status string status = "0"; if (cbStatus.Checked == true) { status = "1"; } #endregion #region Time Create Date string timeCreateDate = ""; timeCreateDate = tbCreateDate.Text; #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbTitle.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbTitle.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbTitle.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = tbDesc.Text; } #endregion string videoCode = tbYouTube.Text; //viauthor: Mã nhúng video do người dùng nhập vào string videoKey = TatThanhJsc.Extension.VideoExtension.GetVideoKey(videoCode); //viurl: Mã của video được tách ra từ khối mã người dùng nhập vào (chỉ chứa id của video đó, không chứa các thông tin khác -> phục vụ khi lấy ra hiển thị dễ dàng hơn) #region Insert if (insert) { string image = flAnhDaiDien.Save(false, contentDetail); GroupsItems.InsertItemsGroupsItems(language, app, "", tbTitle.Text, tbDesc.Text, contentDetail, image, videoKey, videoCode, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", "", "0", "0", "", "", timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddlParentCate.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbTitle.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, contentDetail); GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(hdGroupsItemId.Value)); GroupsItems.UpdateItemsGroupsItems(language, app, "", tbTitle.Text, tbDesc.Text, contentDetail, image, videoKey, videoCode, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", "", "0", "0", "", hdTotalView.Value, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddlParentCate.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status, iid); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbTitle.Text); #endregion } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTitle.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btn_save_Click(object sender, EventArgs e) { #region Image string vimg = ""; if (flimg.FileName.Length > 0 && flimg.PostedFile.ContentLength > 0) { string filename = ""; filename = System.IO.Path.GetFileName(flimg.PostedFile.FileName); string fileex = ""; fileex = System.IO.Path.GetExtension(filename).ToLower(); if (fileex == ".jpg" || fileex == ".gif" || fileex == ".png" || fileex == ".bmp") { string fileNotEx = System.IO.Path.GetFileNameWithoutExtension(flimg.PostedFile.FileName); vimg = StringExtension.ReplateTitle(fileNotEx) + DateTime.Now.Ticks.ToString() + fileex; flimg.SaveAs(Request.PhysicalApplicationPath + "/" + FolderPic.SystemWebsite + "/" + vimg); } } #endregion if (vimg.Equals("")) { vimg = hd_img.Value; } if (!vimg.Equals(hd_img.Value)) { ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyLogoAdminWebsite, vimg, language); #region Image Map string vImageMap = ""; if (FlMap.FileName.Length > 0 && FlMap.PostedFile.ContentLength > 0) { string filename = ""; filename = System.IO.Path.GetFileName(FlMap.PostedFile.FileName); string fileex = ""; fileex = System.IO.Path.GetExtension(filename).ToLower(); if (fileex == ".ico") { string fileNotEx = System.IO.Path.GetFileNameWithoutExtension(FlMap.PostedFile.FileName); vImageMap = fileNotEx + DateTime.Now.Ticks.ToString() + fileex; FlMap.SaveAs(Request.PhysicalApplicationPath + "/" + FolderPic.SystemWebsite + "/" + vImageMap); } } #endregion if (vImageMap.Equals("")) { vImageMap = HdImageMap.Value; } if (!vImageMap.Equals(HdImageMap.Value)) { ImagesExtension.DeleteImageWhenDeleteItem(pic, HdImageMap.Value); } SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyFavicon, vImageMap, language); #region Image share string vimgFacebook = ""; if (flimgFacebook.FileName.Length > 0 && flimgFacebook.PostedFile.ContentLength > 0) { string filename = ""; filename = System.IO.Path.GetFileName(flimgFacebook.PostedFile.FileName); string fileex = ""; fileex = System.IO.Path.GetExtension(filename).ToLower(); if (fileex == ".jpg" || fileex == ".gif" || fileex == ".png" || fileex == ".bmp") { string fileNotEx = System.IO.Path.GetFileNameWithoutExtension(flimgFacebook.PostedFile.FileName); vimgFacebook = StringExtension.ReplateTitle(fileNotEx) + DateTime.Now.Ticks.ToString() + fileex; flimgFacebook.SaveAs(Request.PhysicalApplicationPath + "/" + FolderPic.SystemWebsite + "/" + vimgFacebook); } } #endregion if (vimgFacebook.Equals("")) { vimgFacebook = hd_imgFacebook.Value; } if (!vimgFacebook.Equals(hd_imgFacebook.Value)) { ImagesExtension.DeleteImageWhenDeleteItem(pic, HdImageMap.Value); } SettingsExtension.SetOtherSettingKey("LogoShareHomepage", vimgFacebook, language); string content1 = ContentExtendtions.ProcessStringContent(txt_content_footer.Text, hdOldValue.Value, pic); string contenttop = ContentExtendtions.ProcessStringContent(txt_content_footer_top.Text, hdOldValueTop.Value, pic); SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyContentFooterWebsite, content1, language); SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyContentFooterWebsite + "Top", contenttop, language); SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyPhoneContact, TextPhoneContact.Text, language); SettingsExtension.SetOtherSettingKey(SettingsExtension.KeyHotLine, TextHotLine.Text, language); SettingsExtension.SetOtherSettingKey("KeyContactEmail", tbEmail.Text, language); SettingsExtension.SetOtherSettingKey("YoutubeVideo", tbYoutubeVideo.Text, language); SettingsExtension.SetOtherSettingKey("KeyLinkFanPageFaceBook", tbKeyLinkFanPageFaceBook.Text, language); SettingsExtension.SetOtherSettingKey("KeyLinkFanPageGPlus", tbKeyLinkFanPageGPlus.Text, language); SettingsExtension.SetOtherSettingKey("KeyLinkFanPageTwitter", tbKeyLinkFanPageTwitter.Text, language); SettingsExtension.SetOtherSettingKey("KeyCurrency", ddlCurrency.SelectedValue, language); GetContentInControl(); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", "Thông tin chung", logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật thông tin hệ thống (Thông tin chung)"); #endregion }
protected void WebUserControl1_btnHandler(string strValue) { #region Image string vimg = ""; string vimg_thumb = ""; string contentDetail = StringExtension.GhepChuoi("", ContentExtendtions.ProcessStringContent(txt_content.Text, hdOldProduct.Value, pic), ContentExtendtions.ProcessStringContent(txtThongSoKyThuat.Text, hdThongSoKyThua.Value, pic), ContentExtendtions.ProcessStringContent(txtVideoGioiThieu.Text, hdVideoGioiThieu.Value, pic), txtXuatXu.Text, txtCongXuat.Text, txtDienAp.Text, txtLuuLuong.Text, txtCotAp.Text, txtTruynDong.Text, txtVatLieu.Text, txtBaoHanh.Text); if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } else { if (hd_img.Value.Length < 1 || cbLayAnhTuNoiDung.Checked)//nếu không upload ảnh và cũng không có ảnh cũ -> tìm ảnh đầu tiên trong nội dung làm ảnh đại diện { if (hd_img.Value.Length > 0) { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } string urlImg = ImagesExtension.GetFirstImageInContent(contentDetail); if (urlImg.Length > 0) { string filename = urlImg; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb"; } else { vimg = fileNotEx + "_" + ticks; } if (ImagesExtension.SaveImageFromUrl(path + vimg, urlImg).Length > 0) { vimg += fileex; #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } else { vimg = ""; } #endregion } } } } #endregion #region file // file Catalog string fileNameCatalog = ""; string fileLink = txtLinkCatalog.Text; if (fileCatalog.PostedFile.ContentLength > 0) { string filename = fileCatalog.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } // lấy giá trị random, tránh trường hợp đường dẫn trùng nhau string ticks = DateTime.Now.Ticks.ToString(); #region Lưu tệp đính kèm fileNameCatalog = fileNotEx + "_" + ticks + fileex; fileCatalog.SaveAs(path + fileNameCatalog); #endregion } //file Document string fileNameDocument = ""; string fileLinkCatalog = txtLinkDocument.Text; if (fileDocument.PostedFile.ContentLength > 0) { string filename = fileDocument.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } // lấy giá trị random, tránh trường hợp đường dẫn trùng nhau string ticks = DateTime.Now.Ticks.ToString(); #region Lưu tệp đính kèm fileNameDocument = fileNotEx + "_" + ticks + fileex; fileDocument.SaveAs(path + fileNameDocument); #endregion } #endregion #region Status string status = "0"; string conhang = "0"; string hangmoi = "0"; if (chk_status.Checked == true) { status = "1"; } if (ckbConHang.Checked) { conhang = "1"; } if (ckCheckHot.Checked) { hangmoi = "1"; } #endregion #region Time Create Date string timeCreateDate = ""; timeCreateDate = txtCreateDate.Text; #endregion #region Seo if (textLinkRewrite.Text.Trim().Equals("")) { textLinkRewrite.Text = txt_title.Text; } if (textTagTitle.Text.Trim().Equals("")) { textTagTitle.Text = txt_title.Text; } if (textTagKeyword.Text.Trim().Equals("")) { textTagKeyword.Text = txt_title.Text; } if (textTagDescription.Text.Trim().Equals("")) { textTagDescription.Text = txt_description.Text; } #endregion string viparams = StringExtension.GhepChuoi("", tbThongSo.Text, conhang, hangmoi); // Check lưu file Document and catalog if (fileNameCatalog.Equals("")) { fileNameCatalog = hdFileCatalog.Value; } if (fileNameDocument.Equals("")) { fileNameDocument = hdFileDocument.Value; } string viUrl = StringExtension.GhepChuoi("", fileNameCatalog, txtLinkCatalog.Text, fileNameDocument, txtLinkDocument.Text); #region Insert if (insert) { GroupsItems.InsertItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, viUrl, tbThuongHieu.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, txtXuatXu.Text, "", "", viparams, tbPrice.Text, tbPriceOld.Text, "", "", timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status); #region Lay ra iid cua item vua duoc luu condition = DataExtension.AndConditon( ItemsTSql.GetItemsByDicreatedate(timeCreateDate), ItemsTSql.GetItemsByViapp(app)); DataTable dtInsertedItems = new DataTable(); dtInsertedItems = GroupsItems.GetAllData("1", "Items.iid", condition, ItemsColumns.IidColumn + " desc"); if (dtInsertedItems.Rows.Count > 0) { iid = dtInsertedItems.Rows[0][ItemsColumns.IidColumn].ToString(); } #endregion } #endregion #region Update else { if (vimg.Equals("")) { vimg = hd_img.Value; } else { ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetByIgiid(hdigi_id.Value)); GroupsItems.UpdateItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, viUrl, tbThuongHieu.Text, textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, txtXuatXu.Text, "", "", viparams, tbPrice.Text, tbPriceOld.Text, "", HdIitotalview.Value, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status, iid); } #endregion #region Thêm vào các danh mục khác //string igparentsid = ""; //foreach (ListItem item in cbListCates.Items) //{ // if(item.Selected && item.Value != ddl_group_product.SelectedValue) // { // igparentsid = GetParentsId(item.Value); // GroupsItems.InsertGroupsItems(item.Value, iid, igparentsid, DateTime.Now.ToString(), // DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text); // } //} #endregion #region Properties-Chi thực hiện khi chức năng Quản lý thuộc tính được hiển thị if (ProductConfig.KeyHienThiQuanLyThuocTinhSanPham) { string properties = parramSpitString; for (int i = 0; i < rptProperties.Items.Count; i++) { CheckBox checkBoxProperties = (CheckBox)rptProperties.Items[i].FindControl("checkBoxProperties"); if (checkBoxProperties.Checked == true) { properties += checkBoxProperties.ToolTip + parramSpitString; } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(propertyModul)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region Nicks - Chỉ hiển thị khi chức năng add nick được hiển thị if (ProductConfig.KeyHienThiAddNickChoSanPham) { string nicks = parramSpitString; for (int i = 0; i < rptNicks.Items.Count; i++) { CheckBox checkBoxNicks = (CheckBox)rptNicks.Items[i].FindControl("checkBoxNicks"); if (checkBoxNicks.Checked == true) { nicks += checkBoxNicks.ToolTip + parramSpitString; } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(TatThanhJsc.OtherModul.CodeApplications.SupportOnline)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, TatThanhJsc.OtherModul.CodeApplications.SupportOnline, "", nicks, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, TatThanhJsc.OtherModul.CodeApplications.SupportOnline, "", nicks, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region FilterProperties - Chỉ hiển thị khi tính năng lọc sản phẩm được hiển thị if (ProductConfig.KeyHienThiThuocTinhLocSanPham) { string filterProperties = parramSpitString; for (int i = 0; i < rptParentFilter.Items.Count; i++) { RadioButtonList rdblListAnswer = (RadioButtonList)rptParentFilter.Items[i].FindControl("rdblAnswer"); if (rdblListAnswer != null) { if (rdblListAnswer.SelectedValue.Length > 0) { filterProperties += rdblListAnswer.SelectedValue + parramSpitString; } } CheckBoxList cblListAnswer = (CheckBoxList)rptParentFilter.Items[i].FindControl("cblAnswer"); if (cblListAnswer != null) { for (int j = 0; j < cblListAnswer.Items.Count; j++) { if (cblListAnswer.Items[j].Selected == true) { filterProperties += cblListAnswer.Items[j].Value + parramSpitString; } } } } condition = DataExtension.AndConditon( SubitemsTSql.GetSubitemsByIid(iid), SubitemsTSql.GetSubitemsByVskey(CodeApplications.ProductFilterProperties)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, CodeApplications.ProductFilterProperties, "", filterProperties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, CodeApplications.ProductFilterProperties, "", filterProperties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", // "ThongBao(3000,'Đã tạo: " + txt_title.Text + "');", true); //Lưu vào session để gọi đến bên api Session["CotinuteCreate"] = true; Session["CotinuteCreateTitle"] = txt_title.Text; ResetControls(); } else { Session["CotinuteCreate"] = false; Session["CotinuteCreateRedirectLink"] = LinkRedrect(); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { string chiTiet = ContentExtendtions.ProcessStringContent(tbChiTiet.Text, hdChiTiet.Value, pic); #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbHoTen.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbHoTen.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbHoTen.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = ""; } #endregion #region Ngày đăng if (tbNgayDang.Text == "") { tbNgayDang.Text = DateTime.Now.ToString(); } #endregion string viparams = StringExtension.GhepChuoi("", tbCongTy.Text, tbChucVu.Text, tbTieuDeYKien.Text); #region Insert if (insert) { string image = flAnhDaiDien.Save(false, chiTiet); GroupsItems.InsertItemsGroupsItems(lang, app, "", tbHoTen.Text, "", chiTiet, image, tbDiaChi.Text, tbEmail.Text, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", viparams, "", "", "", "", tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbHoTen.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbHoTen.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, chiTiet); GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(hdGroupsItemId.Value)); GroupsItems.UpdateItemsGroupsItems(lang, app, "", tbHoTen.Text, "", chiTiet, image, tbDiaChi.Text, tbEmail.Text, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", viparams, "", "", "", hdTotalView.Value, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai, iid); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbHoTen.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbHoTen.Text); #endregion } #endregion #region After Insert/Update if (cbTiepTuc.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbHoTen.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { string chiTiet = ContentExtendtions.ProcessStringContent(tbChiTiet.Text, hdChiTiet.Value, pic); #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion #region IID người đăng string iidNguoiDang = ""; string thongtindangbai = ""; string ngayxuatban = ""; if (AboutUsConfig.KeyDuyetTin) { if (HorizaMenuConfig.ShowDuyetTin1 || HorizaMenuConfig.ShowDuyetTin2) { iidNguoiDang = CookieExtension.GetCookies("userId"); ngayxuatban = DateTime.Now.ToString(); } } #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbTitle.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbTitle.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbTitle.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = tbDesc.Text; } #endregion #region Ngày đăng if (tbNgayDang.Text == "") { tbNgayDang.Text = DateTime.Now.ToString(); } #endregion #region Các thông tin liên hệ khác như Facebook, Google +, Twitter,... string subInfos = StringExtension.GhepChuoi("", tbFacebook.Text, tbGooglePlus.Text, tbTwitter.Text, tbYoutube.Text, tbInstagram.Text, tbPhone.Text, tbEmail.Text, tbSkype.Text, tbViber.Text, tbZalo.Text); #endregion #region Insert if (insert) { string image = flAnhDaiDien.Save(false, chiTiet); GroupsItems.InsertItemsGroupsItems(lang, app, tbKey.Text, tbTitle.Text, tbDesc.Text, chiTiet, image, iidNguoiDang, "", tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, thongtindangbai, ngayxuatban, "", subInfos, "", "", "", "", tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbTitle.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, chiTiet); if (AboutUsConfig.KeyDuyetTin) { string userRole = CookieExtension.GetCookies("RolesUser"); if (HorizaMenuConfig.ShowDuyetTin2) { if (hdEnable.Value == PhanQuyen.DuyetTin.Cap1 && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap1, userRole)) { trangThai = "0"; } else if (hdEnable.Value == "1" && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole)) { trangThai = "1"; } else if (hdEnable.Value != "0" && hdEnable.Value != "1") { trangThai = hdEnable.Value; } } else { if (hdEnable.Value == PhanQuyen.DuyetTin.Cap2 && StringExtension.RoleInListRoles(PhanQuyen.DuyetTin.Cap2, userRole)) { trangThai = "0"; } else if (hdEnable.Value != "0" && hdEnable.Value != "1") { trangThai = hdEnable.Value; } } } string nguoiDangCu = hdNguoiDangCu.Value; string thongtincu = hdThongTinThem.Value; string ngayxuatbancu = hdNgayXuatBan.Value; GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(hdGroupsItemId.Value)); GroupsItems.UpdateItemsGroupsItems(lang, app, tbKey.Text, tbTitle.Text, tbDesc.Text, chiTiet, image, nguoiDangCu, "", tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, thongtincu, ngayxuatbancu, "", subInfos, "", "", "", hdTotalView.Value, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, ddlParentCate.SelectedValue, tbNgayDang.Text, DateTime.Now.ToString(), DateTime.Now.ToString(), tbThuTu.Text, trangThai, iid); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTitle.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbTitle.Text); #endregion } #endregion #region After Insert/Update if (cbTiepTuc.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTitle.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btn_insert_update_Click(object sender, EventArgs e) { string contentDetail = ContentExtendtions.ProcessStringContent(txt_content.Text, hdOldService.Value, pic); #region Image string vimg = ""; string vimg_thumb = ""; if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } else { if (hd_img.Value.Length < 1 || cbLayAnhTuNoiDung.Checked)//nếu không upload ảnh và cũng không có ảnh cũ -> tìm ảnh đầu tiên trong nội dung làm ảnh đại diện { if (hd_img.Value.Length > 0) { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } string urlImg = ImagesExtension.GetFirstImageInContent(contentDetail); if (urlImg.Length > 0) { string filename = urlImg; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (TatThanhJsc.Extension.ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi TatThanhJsc.Extension.ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb"; } else { vimg = fileNotEx + "_" + ticks; } if (ImagesExtension.SaveImageFromUrl(path + vimg, urlImg).Length > 0) { vimg += fileex; #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } else { vimg = ""; } #endregion } } } } #endregion #region Status string status = "0"; if (chk_status.Checked == true) { status = "1"; } #endregion #region Time Create Date string timeCreateDate = ""; timeCreateDate = txtCreateDate.Text; #endregion #region Seo if (textLinkRewrite.Text.Trim().Equals("")) { textLinkRewrite.Text = txt_title.Text; } if (textTagTitle.Text.Trim().Equals("")) { textTagTitle.Text = txt_title.Text; } if (textTagKeyword.Text.Trim().Equals("")) { textTagKeyword.Text = txt_title.Text; } if (textTagDescription.Text.Trim().Equals("")) { textTagDescription.Text = txt_description.Text; } #endregion #region Insert if (insert) { GroupsItems.InsertItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, tbDanhSachTepDinhKem.Text, "", textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", "", "0", "0", "", "", timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status); #region Lay ra iid cua item vua duoc luu condition = DataExtension.AndConditon( ItemsTSql.GetItemsByDicreatedate(timeCreateDate), ItemsTSql.GetItemsByViapp(app)); DataTable dtInsertedItems = new DataTable(); dtInsertedItems = GroupsItems.GetAllData("1", "Items.iid", condition, ItemsColumns.IidColumn + " desc"); if (dtInsertedItems.Rows.Count > 0) { iid = dtInsertedItems.Rows[0][ItemsColumns.IidColumn].ToString(); } #endregion #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", txt_title.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + txt_title.Text); #endregion } #endregion #region Update else { if (vimg.Equals("")) { vimg = hd_img.Value; } else { TatThanhJsc.Extension.ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } GroupsItems.UpdateItemsGroupsItems(language, app, tbKey.Text, txt_title.Text, txt_description.Text, contentDetail, vimg, tbDanhSachTepDinhKem.Text, "", textTagTitle.Text, textLinkRewrite.Text, StringExtension.ReplateTitle(textLinkRewrite.Text), textTagKeyword.Text, textTagDescription.Text, "", "", "", "", "0", "0", "", HdIitotalview.Value, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, ddl_group_product.SelectedValue, timeCreateDate, DateTime.Now.ToString(), DateTime.Now.ToString(), tbOrder.Text, status, iid); #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", txt_title.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + txt_title.Text); #endregion } #endregion #region Properties-Chi thực hiện khi chức năng Quản lý thuộc tính được hiển thị if (ServiceConfig.KeyHienThiQuanLyThuocTinhDichVu) { string properties = parramSpitString; for (int i = 0; i < rptProperties.Items.Count; i++) { CheckBox checkBoxProperties = (CheckBox)rptProperties.Items[i].FindControl("checkBoxProperties"); if (checkBoxProperties.Checked == true) { properties += checkBoxProperties.ToolTip + parramSpitString; } } condition = TatThanhJsc.Extension.DataExtension.AndConditon( TatThanhJsc.TSql.SubitemsTSql.GetSubitemsByIid(iid), TatThanhJsc.TSql.SubitemsTSql.GetSubitemsByVskey(propertyModul)); fields = DataExtension.GetListColumns(SubitemsColumns.IsidColumn, SubitemsColumns.VscontentColumn); DataTable dt = new DataTable(); dt = Subitems.GetSubItems("", fields, condition, ""); if (dt.Rows.Count > 0) { string isid = dt.Rows[0][SubitemsColumns.IsidColumn].ToString(); //Cap nhat Subitems.UpdateSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1", isid); } else { //Them moi Subitems.InsertSubitems(iid, language, propertyModul, "", properties, "", "", "", "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "1"); } } #endregion #region After Insert/Update if (ckbContinue.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + txt_title.Text + "');", true); ResetControls(); } else { Response.Redirect(LinkRedrect()); } #endregion }
protected void btOK_Click(object sender, EventArgs e) { #region Image string vimg = ""; string vimg_thumb = ""; if (flimg.PostedFile.ContentLength > 0) { string filename = flimg.FileName; string fileex = filename.Substring(filename.LastIndexOf(".")); string path = Request.PhysicalApplicationPath + "/" + pic + "/"; if (ImagesExtension.ValidType(fileex)) { string fileNotEx = StringExtension.ReplateTitle(filename.Remove(filename.LastIndexOf(".") - 1)); if (fileNotEx.Length > 9) { fileNotEx = fileNotEx.Remove(9); } string ticks = System.DateTime.Now.Ticks.ToString(); #region Lưu ảnh đại diện theo 2 trường hợp: tạo ảnh nhỏ hoặc không. //Kiểm tra xem có tạo ảnh nhỏ hay ko //Nếu không tạo ảnh nhỏ, tên tệp lưu bình thường theo kiểu: tên_tệp.phần_mở_rộng //Nếu tạo ảnh nhỏ, tên tệp sẽ theo kiểu: tên_tệp_HasThumb.phần_mở_rộng //Khi đó tên tệp ảnh nhỏ sẽ theo kiểu: tên_tệp_HasThumb_Thumb.phần_mở_rộng //Với cách lưu tên ảnh này, khi thực hiện lưu vào csdl chỉ cần lưu tên ảnh gốc //khi hiển thị chỉ cần dựa vào tên ảnh gốc để biết ảnh đó có ảnh nhỏ hay không, việc này được thực hiện bởi ImagesExtension.GetImage, lập trình không cần làm gì thêm. if (cbTaoAnhNho.Checked) { vimg = fileNotEx + "_" + ticks + "_HasThumb" + fileex; } else { vimg = fileNotEx + "_" + ticks + fileex; } flimg.SaveAs(path + vimg); #endregion #region Hạn chế kích thước if (cbHanCheKichThuoc.Checked) { ImagesExtension.ResizeImage(path + vimg, "", tbHanCheW.Text, tbHanCheH.Text); } #endregion #region Đóng dấu ảnh if (cbDongDauAnh.Checked) { ImagesExtension.CreateWatermark(path + vimg, path + hdLogoImage.Value, hdViTriDongDau.Value, hdLeX.Value, hdLeY.Value, hdTyLe.Value, hdTrongSuot.Value); } #endregion #region Tạo ảnh nhỏ: Thực hiện cuối để đảm bảo ảnh nhỏ cũng có con dấu if (cbTaoAnhNho.Checked) { vimg_thumb = fileNotEx + "_" + ticks + "_HasThumb_Thumb" + fileex; ImagesExtension.ResizeImage(path + vimg, path + vimg_thumb, tbAnhNhoW.Text, tbAnhNhoH.Text); } #endregion } } #endregion /* * Thêm mới bài viết * modul - vskey, vstitle - tên, vsimage - bài viết, vsauthor - thứ tự, isenable - trạng thái */ string content = ContentExtendtions.ProcessStringContent(tbContent.Text, hdOldContent.Value, pic); if (Request.QueryString["isid"] != null && Request.QueryString["isid"] != "") { if (vimg.Equals("")) { vimg = hd_img.Value; } else { ImagesExtension.DeleteImageWhenDeleteItem(pic, hd_img.Value); } Subitems.UpdateSubitems(iid, language, app, tbName.Text, content, vimg, tbDesc.Text, tbOrder.Text, "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), ddlStatus.SelectedValue, currentIsid.Value); } else { Subitems.InsertSubitems(iid, language, app, tbName.Text, content, vimg, tbDesc.Text, tbOrder.Text, "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), ddlStatus.SelectedValue); } ResetControls(); GetList(); pnList.Visible = true; pnInsert.Visible = false; }