private void Save_GroupCategorys(int Group_ID) { NguoidungDAL _usermenuDAL = new NguoidungDAL(); ChuyenmucDAL _ChuyenmucDAL = new ChuyenmucDAL(); T_ChuyenMuc _objcm = new T_ChuyenMuc(); UltilFunc ulti = new UltilFunc(); int Cate_ID = 0; string[] arrCate; char[] sepparator; sepparator = ";".ToCharArray(); if (txtCateAccess.Value.Trim() != "") { arrCate = txtCateAccess.Value.Split(sepparator); string txt = ""; if (txtCateAccess.Value.StartsWith("on;")) { txt = txtCateAccess.Value.Remove(0, 3); arrCate = txt.Split(sepparator); } _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); string _sqldelete = string.Empty; for (int x = 0; x < arrCate.Length; x++) { Cate_ID = Convert.ToInt32(arrCate[x].ToString()); _objcm = _ChuyenmucDAL.GetOneFromT_ChuyenmucByID(Cate_ID); if (_objcm.Ma_Chuyenmuc_Cha > 0) { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); _sqldelete = "delete from T_Nhom_Chuyenmuc where Ma_Nhom=" + Group_ID + " and Ma_Chuyenmuc=" + _objcm.Ma_Chuyenmuc_Cha; ulti.ExecSql(_sqldelete); _nhomnguoidungDAL.InsertT_GroupCategory(_objcm.Ma_Chuyenmuc_Cha, Group_ID); } else { _nhomnguoidungDAL.InsertT_GroupCategory(Cate_ID, Group_ID); } } } else { _usermenuDAL.DeleteFromT_UserCategoryDynamic(" Ma_Nhom=" + Group_ID); _nhomnguoidungDAL.DeleteFromT_GroupCategory(Group_ID); } }