public void FetchMenu(string id) { lang = Session["LanguageSetting"].ToString(); if (id == "#") { var tree = new JsTreeModel[] { new JsTreeModel { text = "Menu", attr = new JsTreeAttribute { id = "0", selected = true } } }; this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree).Replace("null", "true")); } else { DataTable dt = null; var tree1 = new JsTreeModel[] { }; objServiceMenu.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationMenu(); dt = objServiceMenu.FetchMenuHierarchy(int.Parse(id), lang, Session["role_id"].ToInt32()); if (dt != null && dt.Rows.Count > 0) { tree1 = new JsTreeModel[dt.Rows.Count]; int i = 0; foreach (DataRow dr in dt.Rows) { tree1[i] = new JsTreeModel { text = dr["menu_name"].ToString(), attr = new JsTreeAttribute { id = dr["menu_id"].ToString(), selected = true } }; i++; } } this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(new JavaScriptSerializer().Serialize(tree1).Replace("null", "true")); } }
public void ChangePermission(string menu, string role, string mode, string permission) { ComMenuRolePermissionBO objBo = new ComMenuRolePermissionBO(); objBo.AllowAdd = mode == "A" ? int.Parse(permission) : 0; objBo.AllowEdit = mode == "E" ? int.Parse(permission) : 0; objBo.AllowDelete = mode == "D" ? int.Parse(permission) : 0; objBo.AllowView = mode == "V" ? int.Parse(permission) : 0; objBo.AllowVerifyLevel1 = mode == "VR1" ? int.Parse(permission) : 0; objBo.AllowVerifyLevel2 = mode == "VR2" ? int.Parse(permission) : 0; objBo.AllowVerifyLevel3 = mode == "VR3" ? int.Parse(permission) : 0; objBo.AllowVerifyLevel4 = mode == "VR4" ? int.Parse(permission) : 0; objBo.MenuId = int.Parse(menu); objBo.RoleId = int.Parse(role); objBo.PermissionMode = mode; objServiceMenu.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationMenu(); objServiceMenu.ChangePermission(objBo); test(menu); }
public void DeleteMenu(string id) { objServiceMenu.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationMenu(); objServiceMenu.DeleteMenu(id); }
public void test(string menuId) { string str = string.Empty; DataSet ds = null; DataTable dt = null; DataTable dtRole = null; string pathAdd = string.Empty; string pathRemove = string.Empty; pathAdd = "../../images/wrightMark.gif"; pathRemove = "../../images/delete.gif"; string path = string.Empty; string roleId = string.Empty; string permission = string.Empty; //string menuId = string.Empty; //service autentication objServiceMenu.AuthSoapHdValue = ServiceAuth.ServiceAuthenticationMenu(); //service method call ds = objServiceMenu.FetchMenuPermission(int.Parse(menuId), 1); // str = str + "<table class='table'><tr><td>Role</td><td>Add</td><td>edit</td><td>delete</td><td>View</td></tr>"; if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; dtRole = ds.Tables[1]; } if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { permission = "1"; roleId = dr["role_id"].ToString(); str = str + "<tr><td>" + dr["role_eng_name"] + "</td>"; path = pathRemove; if (dr["allow_add"].ToString() == "1") { path = pathAdd; permission = "0"; } str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'A'," + permission + ")><img src='" + path + "' /></a></td>"; //edit path = pathRemove; permission = "1"; if (dr["allow_edit"].ToString() == "1") { path = pathAdd; permission = "0"; } str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'E'," + permission + ")><img src='" + path + "' /></a></td>"; //delete path = pathRemove; permission = "1"; if (dr["allow_delete"].ToString() == "1") { path = pathAdd; permission = "0"; } str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'D'," + permission + ")><img src='" + path + "' /></a></td>"; //view path = pathRemove; permission = "1"; if (dr["allow_view"].ToString() == "1") { path = pathAdd; permission = "0"; } str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'V'," + permission + ")><img src='" + path + "' /></a></td>"; /*//verify_level1 * //view * path = pathRemove; * permission = "1"; * if (dr["allow_verify_level_1"].ToString() == "1") * { * path = pathAdd; * permission = "0"; * } * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'VR1'," + permission + ")><img src='" + path + "' /></a></td>"; * * //verify_level2 * //view * path = pathRemove; * permission = "1"; * if (dr["allow_verify_level_2"].ToString() == "1") * { * path = pathAdd; * permission = "0"; * } * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'VR2'," + permission + ")><img src='" + path + "' /></a></td>"; * //verify_level_3 * //view * path = pathRemove; * permission = "1"; * if (dr["allow_verify_level_3"].ToString() == "1") * { * path = pathAdd; * permission = "0"; * } * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'VR3'," + permission + ")><img src='" + path + "' /></a></td>"; * //verify_level_4 * //view * path = pathRemove; * permission = "1"; * if (dr["allow_verify_level_4"].ToString() == "1") * { * path = pathAdd; * permission = "0"; * } * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'VR4'," + permission + ")><img src='" + path + "' /></a></td>"; */ str = str + "</tr>"; } } if (dtRole != null && dtRole.Rows.Count > 0) { foreach (DataRow dr in dtRole.Rows) { path = pathRemove; roleId = dr["role_id"].ToString(); str = str + "<tr><td>" + dr["role_eng_name"] + "</td>"; str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'A'," + 1 + ")><img src='" + path + "' /></a></td>"; str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'E'," + 1 + ")><img src='" + path + "' /></a></td>"; str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'D'," + 1 + ")><img src='" + path + "' /></a></td>"; str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + ",'V'," + 1 + ")><img src='" + path + "' /></a></td>"; /*str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + * ",'VR1'," + 1 + ")><img src='" + path + "' /></a></td>"; * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + * ",'VR2'," + 1 + ")><img src='" + path + "' /></a></td>"; * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + * ",'VR3'," + 1 + ")><img src='" + path + "' /></a></td>"; * str = str + "<td><a href='javascript:void(0)' onclick=changePermission(" + menuId + "," + roleId + * ",'VR4'," + 1 + ")><img src='" + path + "' /></a></td>";*/ str = str + "</tr>"; } } //dt = objDal.FetchRoles(); str = str + "</table>"; this.Context.Response.Write(str); }