protected void btnremove_Click(object sender, EventArgs e) { if (lstnotadded.SelectedValue.Equals("")) { LtMes.Visible = false; condition = " IGID = " + lstadded.SelectedValue + " AND IID = " + iid + " "; GroupsItems.DeleteGroupsItems(condition); lstnotadded.Items.Clear(); lstadded.Items.Clear(); GetGroupsPhotoAlbum(); } else { LtMes.Visible = true; LtMes.Text = "<div class='MesText'>Album này chưa trong nhóm <b>" + GroupsExtension.GetNameCategoryById(lstnotadded.SelectedValue) + "</b></div>"; return; } }
protected void btnremove_Click(object sender, EventArgs e) { int[] iidArry = new int[lstadded.Rows + 1]; iidArry = lstadded.GetSelectedIndices(); if (iidArry.Length > 0) { string listIID = ""; for (int i = 0; i < iidArry.Length; i++) { listIID += lstadded.Items[iidArry[i]].Value + ","; } listIID = listIID.Substring(0, listIID.Length - 1); condition = "IGID = '" + igid + "' AND IID in (" + listIID + ") "; GroupsItems.DeleteGroupsItems(condition); lstnotadded.Items.Clear(); lstadded.Items.Clear(); GetListItem(ddlTagModul.SelectedValue); } }
protected void btSave_Click(object sender, EventArgs e) { //Xoá các bản ghi trong groups_items có vgapp là TatThanhJsc.OtherModul.CodeApplications.Tag DataTable dt = new DataTable(); condition = DataExtension.AndConditon(GroupsItemsTSql.GetGroupsItemsByIid(iid), GroupsTSql.GetGroupsByVgapp(app)); dt = GroupsItems.GetAllData("", GroupsItemsColumns.IgiidColumn, condition, ""); for (int i = 0; i < dt.Rows.Count; i++) { //Response.Write(dt.Rows[i][GroupsItemsColumns.IgiidColumn].ToString()); GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(dt.Rows[i][GroupsItemsColumns.IgiidColumn].ToString())); } //Thêm các bản ghi vào groups_items for (int i = 0; i < cblListTag.Items.Count; i++) { if (cblListTag.Items[i].Selected) { GroupsItems.InsertGroupsItems(cblListTag.Items[i].Value, iid, "", DateTime.Now.ToString(), DateTime.Now.ToString(), DateTime.Now.ToString(), "0"); } } ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Đã lưu tag');window.close();", true); }
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 }
void DeleteProperty(string igid, string iid) { GroupsItems.DeleteGroupsItems(DataExtension.AndConditon(GroupsItemsTSql.GetByIgid(igid), GroupsItemsTSql.GetByIid(iid))); }
protected void btOK_Click(object sender, EventArgs e) { string content = StringExtension.GhepChuoi("", tbXuatPhat.Text, tbPhuongTien.Text, tbYoutubeEmbed.Text, tbMaDinhKemBanDoTour.Text, tbGioKhoiHanh.Text); #region Trạng thái string trangThai = "0"; if (cbTrangThai.Checked == true) { trangThai = "1"; } #endregion #region Seo if (tbSeoLink.Text.Trim().Equals("")) { tbSeoLink.Text = tbTenTour.Text; } if (tbSeoTitle.Text.Trim().Equals("")) { tbSeoTitle.Text = tbTenTour.Text; } if (tbSeoKeyword.Text.Trim().Equals("")) { tbSeoKeyword.Text = tbTenTour.Text; } if (tbSeoDescription.Text.Trim().Equals("")) { tbSeoDescription.Text = tbMoTa.Text; } #endregion #region Ngày đăng if (tbNgayDang.Text == "") { tbNgayDang.Text = DateTime.Now.ToString(); } #endregion string giaChuanKhiDatTour = StringExtension.GhepChuoi("", tbGiaChoNguoiLon.Text, tbGiaChoTreViThanhNien.Text, tbGiaChoTreEm.Text, tbGiaChoEmBe.Text); #region Insert if (insert) { string image = flAnhDaiDien.Save(false, tbMoTa.Text); GroupsItems.InsertItemsGroupsItems(lang, app, tbMaTour.Text, tbTenTour.Text, tbMoTa.Text, content, image, ddlThoiGianTour.SelectedValue, ddlDiemDen.SelectedValue, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, giaChuanKhiDatTour, "", tbNgayKhoiHanh.Text, "", tbGiaNiemYet.Text, tbGiaKhuyenMai.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, tbTenTour.Text, tbNgayDang.Text); #endregion #region Logs string logAuthor = CookieExtension.GetCookies("LoginSetting"); string logCreateDate = DateTime.Now.ToString(); Logs.InsertLogs(logCreateDate, Request.Url.ToString(), "", tbTenTour.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " tạo mới " + tbTenTour.Text); #endregion } #endregion #region Update else { string image = flAnhDaiDien.Save(true, tbMoTa.Text); GroupsItems.DeleteGroupsItems(GroupsItemsTSql.GetGroupsItemsByIgiid(hdGroupsItemId.Value)); GroupsItems.UpdateItemsGroupsItems(lang, app, tbMaTour.Text, tbTenTour.Text, tbMoTa.Text, content, image, ddlThoiGianTour.SelectedValue, ddlDiemDen.SelectedValue, tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, giaChuanKhiDatTour, "", tbNgayKhoiHanh.Text, "", tbGiaNiemYet.Text, tbGiaKhuyenMai.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(), "", tbTenTour.Text, logAuthor, "", logCreateDate + ": " + logAuthor + " cập nhật " + tbTenTour.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 #endregion #region After Insert/Update if (cbTiepTuc.Checked == true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alertSuccess", "ThongBao(3000,'Đã tạo: " + tbTenTour.Text + "');", true); ResetControls(); } else { Response.Redirect(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 #region Insert if (insert) { string image = flAnhDaiDien.Save(false, contentDetail); GroupsItems.InsertItemsGroupsItems(language, app, "", tbTitle.Text, tbDesc.Text, contentDetail, image, tbAdvLink.Text, "", tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", ddlMoTabMoi.SelectedValue, "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, tbAdvLink.Text, "", tbSeoTitle.Text, tbSeoLink.Text, StringExtension.ReplateTitle(tbSeoLink.Text), tbSeoKeyword.Text, tbSeoDescription.Text, "", "", "", ddlMoTabMoi.SelectedValue, "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 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) { 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 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 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 }