public string updateUser(Dictionary <string, object> args) { args.Add("upd_date", System.DateTime.Now.ToString("yyyyMMddHHmmss")); args = FnCommon.TryUpdateValue(args, "user_id", NService.AuthenticateHelper.Instance.UserID); DBHelper.Instance.Execute("Apps.Manage.Base.Users.UserInfo.updateUsers", args); return("ok"); }
public string GetMenuManager_Bootrap() { Dictionary <string, object> args = new Dictionary <string, object>(); string MENU_NM = FnLanguage.GetMenuNmByLang(); FnCommon.TryUpdateValue(args, "user_id", NService.AuthenticateHelper.Instance.UserID); FnCommon.TryUpdateValue(args, "group_type", "M"); DataTable table = new DataTable(); if (NService.DBRightsProvider.Instance.HasSuperManager(NService.AuthenticateHelper.Instance.UserID)) { table = DBHelper.Instance.Query("Apps.Manage.Base.Menu.getMenuManageSuperAdmin", args).Tables[0]; } else { table = DBHelper.Instance.Query("Apps.Manage.Base.Menu.getMenuManage", args).Tables[0]; } if (table.Rows.Count < 1) { return(""); } DataRow[] parentMenus = table.Select("UP_MENU_ID = 0"); var sb = new StringBuilder(); string HTML = ""; foreach (DataRow dr in parentMenus) { if (dr["stop_mk"].ToString() == "Y") { continue; } HTML += "<li>"; HTML += "<a href='#'><span class='menuicon " + dr["ICON"].ToString() + "'></span>" + dr[MENU_NM].ToString() + "</a>"; DataRow[] childMenus = table.Select("UP_MENU_ID = " + dr["MENU_ID"]); string unorderedList = GenerateUL_Bootrap(childMenus, table, sb); HTML += unorderedList; HTML += "</li>"; } return(HTML); }
public string treeJSONMenuRights(Dictionary <string, object> args) { FnCommon.TryUpdateValue(args, "group_type", "M"); FnCommon.TryUpdateValue(args, "user_id", NService.AuthenticateHelper.Instance.UserID); //DataTable dtMenu = DBHelper.Instance.Query("Apps.Manage.Base.Rights.GetListUserRights", args).Tables[0]; DataTable dtMenu = new DataTable(); bool isSupperAdmin = false; if (NService.DBRightsProvider.Instance.HasSuperManager(NService.AuthenticateHelper.Instance.UserID)) { dtMenu = DBHelper.Instance.Query("Apps.Manage.Base.Menu.getMenuManageSuperAdmin", args).Tables[0]; isSupperAdmin = true; } else { dtMenu = DBHelper.Instance.Query("Apps.Manage.Base.Rights.getMenuRights", args).Tables[0]; } if (dtMenu.Rows.Count > 0) { List <objMenu> menus = new List <objMenu>(); string rights_mk = "", menu_nm; DataRow dr; for (int i = 0; i < dtMenu.Rows.Count; i++) { dr = dtMenu.Rows[i]; if (isSupperAdmin) { rights_mk = "Y"; } else { try { rights_mk = dr["rights_mk"].ToString(); } catch { } } menu_nm = dr["MENU_NM"].ToString(); if (rights_mk == "Y") { menu_nm = dr["MENU_NM"].ToString() + " ►"; } else { menu_nm = dr["MENU_NM"].ToString(); } menus.Add(new objMenu { menu_id = int.Parse(dr["MENU_ID"].ToString()), parentId = int.Parse(dr["UP_MENU_ID"].ToString()), label = menu_nm, link = dr["LINK"].ToString(), rights_mk = rights_mk }); } Dictionary <int, objMenu> dict = menus.ToDictionary(loc => loc.menu_id); foreach (objMenu loc in dict.Values) { if (loc.parentId != loc.menu_id && loc.parentId != 0) { objMenu parent = dict[loc.parentId]; parent.children.Add(loc); } } objMenu root = dict.Values.First(loc => loc.parentId == 0); JsonSerializerSettings settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), Formatting = Newtonsoft.Json.Formatting.Indented }; string json = JsonConvert.SerializeObject(root, settings); return(json); } return(""); }