private void Save_GroupMenu(int Group_ID) { NguoidungDAL _usermenuDAL = new NguoidungDAL(); UltilFunc Ulti = new UltilFunc(); bool R_Edit = false, R_Del = false, R_Add = false; T_Chucnang _objchucnang = new T_Chucnang(); ChucnangDAL _dalchucnang = new ChucnangDAL(); _nhomnguoidungDAL.XoaChucnangNhomNguoidung(Group_ID); _usermenuDAL.DeleteFromT_UserMenuDynamic(" Ma_Nhom=" + Group_ID); foreach (DataGridItem m_Item in gdListMenu.Items) { System.Web.UI.HtmlControls.HtmlInputCheckBox chk_Select = (HtmlInputCheckBox)m_Item.FindControl("optSelect"); HtmlInputCheckBox chkR_Add = (HtmlInputCheckBox)m_Item.FindControl("chkR_Add"); HtmlInputCheckBox chkR_Edit = (HtmlInputCheckBox)m_Item.FindControl("chkR_Edit"); HtmlInputCheckBox chkR_Del = (HtmlInputCheckBox)m_Item.FindControl("chkR_Del"); HtmlInputCheckBox chkR_Pub = (HtmlInputCheckBox)m_Item.FindControl("chkR_Pub"); if (chk_Select != null && chk_Select.Checked) { int Menu_ID = Convert.ToInt32(this.gdListMenu.DataKeys[m_Item.ItemIndex].ToString()); _objchucnang = _dalchucnang.GetOneFromT_ChucnangByID(Menu_ID); if (chkR_Add != null && chkR_Add.Checked) { R_Add = true; } else { R_Add = false; } if (chkR_Edit != null && chkR_Edit.Checked) { R_Edit = true; } else { R_Edit = false; } if (chkR_Del != null && chkR_Del.Checked) { R_Del = true; } else { R_Del = false; } if (_objchucnang.Ma_Chucnang_Cha > 0) { _nhomnguoidungDAL.InsertT_GroupMenu(Menu_ID, Group_ID, R_Edit, R_Del, R_Add); string _sqldelete = "delete from T_Nhom_Chucnang where Ma_Nhom=" + Group_ID + " and Ma_ChucNang=" + _objchucnang.Ma_Chucnang_Cha; Ulti.ExecSql(_sqldelete); _nhomnguoidungDAL.InsertT_GroupMenu(_objchucnang.Ma_Chucnang_Cha, Group_ID, R_Edit, R_Del, R_Add); } else { _nhomnguoidungDAL.InsertT_GroupMenu(Menu_ID, Group_ID, R_Edit, R_Del, R_Add); } } } }
private void GetItem(int _id) { T_Chucnang _objChucnang = new T_Chucnang(); ChucnangDAL _chucnangDAL = new ChucnangDAL(); _objChucnang = _chucnangDAL.GetOneFromT_ChucnangByID(_id); this.txt_Tenchucnang.Text = _objChucnang.Ten_chucnang; ddl_Chucnangcha.SelectedIndex = UltilFunc.GetIndexControl(ddl_Chucnangcha, _objChucnang.Ma_Chucnang_Cha.ToString()); this.txt_URL.Text = _objChucnang.URL_Chucnang; this.txt_Mota.Text = _objChucnang.Mota; this.txt_STT.Text = _objChucnang.STT.ToString(); this.chk_Hoatdong.Checked = _objChucnang.HoatDong; if (_objChucnang.Quytrinh) { this.chk_Quytrinh.Checked = _objChucnang.Quytrinh; } else { chk_Quytrinh.Enabled = false; } if (_objChucnang.Ma_Doituong.Length > 0) { ddl_Madoituong.SelectedValue = _objChucnang.Ma_Doituong.ToString(); } else { ddl_Madoituong.Enabled = false; } txt_lang.Text = _objChucnang.MenuEnglish; }
protected void Save_Click(object sender, EventArgs 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 this.Page.Validate(vs_Themmoi.ValidationGroup); if (!Page.IsValid) { return; } ChucnangDAL _menuDAL = new ChucnangDAL(); T_Chucnang _menu = SetItem(); int menuID = 0; if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { menuID = int.Parse(Request["ID"].ToString()); } int _return = _menuDAL.Insert_T_Chucnang(_menu); if (Page.Request.Params["id"] == null) { action.Thaotac = "[Thêm mới Menu]-->[Thao tác Thêm][Menu_ID:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); BindCombo(); Clear(); return; } if (Page.Request.Params["id"] != null) { action.Thaotac = "[Sửa Menu]-->[Thao tác sửa][Menu_ID:" + Page.Request["id"].ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); BindCombo(); Clear(); return; } }
public void gdListMenu_EditCommand(object source, DataGridCommandEventArgs 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 if (e.CommandArgument.ToString().ToLower() == "edit") { Response.Redirect("~/Menu/EditMenu.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + this.gdListMenu.DataKeys[e.Item.ItemIndex].ToString()); } if (e.CommandArgument.ToString().ToLower() == "delete") { ChucnangDAL _chucnangDAL = new ChucnangDAL(); int _menuID = Convert.ToInt32(this.gdListMenu.DataKeys[e.Item.ItemIndex].ToString()); _chucnangDAL.DeleteFromT_ChucnangByID(_menuID); action.Thaotac = "[Thao tác Xóa][Mã chức năng:" + _menuID.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); Danhsach_Chucnang(); } }