protected void GV_Users_Roles_RowCommand(object sender, GridViewCommandEventArgs e) { string[] mKey = e.CommandArgument.ToString().Split('+'); User_Role_Info info = new User_Role_Info(mKey[0], mKey[1]); //Session["UserKey"] = mKey[0]; if (e.CommandName == "Read") { if (info.Read) { info.Read = false; } else { info.Read = true; } info.Update(); LoadData(); } if (e.CommandName == "Add") { if (info.Add) { info.Add = false; } else { info.Add = true; } info.Update(); LoadData(); } if (e.CommandName == "Del") { if (info.Del) { info.Del = false; } else { info.Del = true; } info.Update(); LoadData(); } if (e.CommandName == "Sua") { if (info.Edit) { info.Edit = false; } else { info.Edit = true; } info.Update(); LoadData(); } }
protected void LoadInfo(string Key) { User_Role_Info info; if (Key == "0") { info = new User_Role_Info(); } else { string[] sl = Key.Split(' '); info = new User_Role_Info(sl[0], sl[1]); } DDLRoles.SelectedValue = info.Key; DDLUsers.SelectedValue = info.UserKey; }
protected void GrDelete(object sender, CommandEventArgs e) { try { string[] mKey = e.CommandArgument.ToString().Split('+'); User_Role_Info info = new User_Role_Info(mKey[0], mKey[1]); info.Delete(); DataTable nTable = Users_Roles_Data.GetList(txtSearch.Text); GV_Users_Roles.DataSource = nTable; GV_Users_Roles.DataBind(); LoadPages(); } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } }
protected void SaveInfo() { User_Role_Info info; if (txtKey.Text != "0") { info = new User_Role_Info(new Guid().ToString()); info.UserKey = DDLUsers.SelectedValue; info.Key = DDLRoles.SelectedValue; info.Update(); } else { info = new User_Role_Info(txtKey.Text); info.UserKey = DDLUsers.SelectedValue; info.Key = DDLRoles.SelectedValue; info.Create(); } }