protected void btnLinkDelete_Click(object sender, EventArgs e) { HPCBusinessLogic.DAL.T_Album_CategoriesDAL objAlbumDAL = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); if (TabContainer1.ActiveTabIndex == 0) { int AlbumID = 0; try { foreach (DataGridItem m_Item in grdListCate.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { Label lblTenPS = (Label)m_Item.FindControl("lblTenPS"); AlbumID = int.Parse(grdListCate.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Xóa", Request["Menu_ID"].ToString(), "[Xóa] [Phóng sự ảnh mới] [Thao tác xóa Phóng sự ảnh: " + objAlbumDAL.load_T_Album_Categories(AlbumID).Cat_Album_Name + "]", 0, ConstAction.GocAnh); objAlbumDAL.DeleteFrom_T_Album_Categories(AlbumID); } } LoadPSmoi(); } catch (Exception ex) { } finally { objAlbumDAL = null; } } else if (TabContainer1.ActiveTabIndex == 2) { foreach (DataGridItem item in DataGrid_tralai.Items) { CheckBox chk_Select = (CheckBox)item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { int _ID = Convert.ToInt32(DataGrid_tralai.DataKeys[int.Parse(item.ItemIndex.ToString())].ToString()); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "Xóa", Request["Menu_ID"].ToString(), "[Xóa] [Phóng sự ảnh bị trả lại] [Thao tác xóa Phóng sự ảnh: " + objAlbumDAL.load_T_Album_Categories(_ID).Cat_Album_Name + "]", 0, ConstAction.GocAnh); objAlbumDAL.DeleteFrom_T_Album_Categories(_ID); } } LoadPStralai(); } }
public void grdListCategory_EditCommand(object source, DataGridCommandEventArgs e) { if (e.CommandArgument.ToString().ToLower() == "edit") { int catID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()); Session["CurrentPage_QLPS"] = pages.PageIndex; Session["CurrentTab_QLPS"] = 0; if (!string.IsNullOrEmpty(txtSearch_Cate.Text)) { Session["QLPS_TenPS"] = txtSearch_Cate.Text; } Session["PageFromID"] = 1; Session["CurrentLangid_QLPS"] = cboNgonNgu.SelectedValue; Response.Redirect("~/PhongSuAnh/Album_Edit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID + "&PageFromID=1"); } else if (e.CommandArgument.ToString().ToLower() == "delete") { HPCBusinessLogic.DAL.T_Album_CategoriesDAL obj_Cate = new HPCBusinessLogic.DAL.T_Album_CategoriesDAL(); try { if (obj_Cate.CheckDelete_T_Album_Categories(Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()))) { obj_Cate.DeleteFrom_T_Album_Categories(Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString())); Label lblTenPS = (Label)e.Item.FindControl("lblTenPS"); WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, lblTenPS.Text, Request["Menu_ID"].ToString(), "Xóa Phóng sự ảnh", 0, ConstAction.GocAnh); this.LoadPSmoi(); } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Không được xóa khi còn bài viết trong danh mục này');", true); } } catch { } finally { obj_Cate = null; } } else if (e.CommandArgument.ToString().ToLower() == "inputphoto") { int catID = Convert.ToInt32(this.grdListCate.DataKeys[e.Item.ItemIndex].ToString()); Session["CurrentPage_QLPS"] = pages.PageIndex; if (!string.IsNullOrEmpty(txtSearch_Cate.Text)) { Session["QLPS_TenPS"] = txtSearch_Cate.Text; } Session["CurrentTab_QLPS"] = 0; Session["CurrentLangid_QLPS"] = cboNgonNgu.SelectedValue; Session["PageFromID"] = 1; Response.Redirect("~/PhongSuAnh/PhotoAlbum_EditMullti.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID); } }