protected void GVDoituong_RowDeleting(object sender, GridViewDeleteEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion int _id = Convert.ToInt32(GVDoituong.DataKeys[e.RowIndex].Values["ID"].ToString()); DoituongDAL _dtDAL = new DoituongDAL(); if (_dtDAL.CheckExists_Madoituong(_id, 1) == 1) { return; } else { _dtDAL.DeleteOneFromT_Doituong(_id); action.Thaotac = "[Xóa đối tượng]-->[Mã đối tượng:" + _id.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); } BindList_Doituong(); }
protected void GVDoituong_RowDeleting(object sender, GridViewDeleteEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion int _id = Convert.ToInt32(GVDoituong.DataKeys[e.RowIndex].Values["ID"].ToString()); DoituongDAL _dtDAL = new DoituongDAL(); if (_dtDAL.CheckExists_Madoituong(_id, 1) == 1) { return; } else { _dtDAL.DeleteOneFromT_Doituong(_id); lblMessError.Text = ""; action.Thaotac = "[Xóa đối tượng]-->[Mã đối tượng:" + _id.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); } BindList_Doituong(); BinQuytrinhtheoAnPham(); UltilFunc.RunJavaScriptCode("$.fx.speeds._default = 10; var dlg = jQuery('#dialog').dialog({draggable: true, resizable: true, hide: 'scale', modal: true, width: 500 }); dlg.parent().appendTo(jQuery('form:first'));"); }
protected void GVDoituong_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); ImageButton btnAdd = (ImageButton)e.Row.FindControl("btnAdd"); if (btnAdd != null) { if (!_Role.R_Write) { btnAdd.Enabled = _Role.R_Write; } } if (btnDelete != null) { if (!_Role.R_Delete) { btnDelete.Enabled = _Role.R_Delete; } else { btnDelete.Attributes.Add("onclick", "return confirm('Bạn có chắc chắn muốn xóa?');"); } DoituongDAL _dtDAL = new DoituongDAL(); int _id = Convert.ToInt32(GVDoituong.DataKeys[e.Row.RowIndex].Value); if (_dtDAL.CheckExists_Madoituong(_id, 1) == 1) { btnDelete.Attributes.Add("onclick", "return alert(\"Đối tượng này đang được sử dụng\");"); } else { btnDelete.Attributes.Add("onclick", "return confirm(\"Bạn có chắc chắn muốn xóa không?\");"); } } Label lblSTT = (Label)e.Row.FindControl("lblSTT"); if (lblSTT != null) { lblSTT.Text = (pages.PageIndex * pages.PageSize + e.Row.RowIndex + 1).ToString(); } e.Row.Attributes.Add("onmouseover", "currColor=this.style.backgroundColor;this.style.backgroundColor='" + CommonLib.HPCOnmouseoverGrid() + "'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currColor"); } }