/// <summary> /// 获取菜单列表 /// </summary> /// <returns></returns> //[DisableAbpAntiForgeryTokenValidation] public async Task <JsonResult> MenuList() { UserMenu mainMenu = await _userNavigationManager.GetMenuAsync("MainMenu", new UserIdentifier(null, AbpSession.UserId.Value)); //获取授权模块的另一种实现(备用方案获取授权模块) //mainMenu.Items = await this.BuildPermissionMenu(_navigationManager.MainMenu.Items); return(Json(mainMenu)); }
static void Main(string[] args) { Login login = new Login(); string username = login.runLoginForm(); UserMenu menu = new UserMenu(); menu.runMainMenu(username); }
private IMenu getMenu(User user, string name, string url) { IMenu menu = new UserMenu(); menu.Name = name; menu.RawUrl = UrlConverter.clearUrl(url, ctx, typeof(User).FullName, user.Url).TrimStart('/'); return(menu); }
private static IMenu getMenu(User user, string name, string url, MvcContext ctx) { IMenu menu = new UserMenu(); menu.Name = name; menu.RawUrl = UrlConverter.clearUrl(url, ctx, typeof(User).FullName, user.Url); return(menu); }
public ReturnUserMenu GetbyID(int ID) { List <UserMenu> lstUserMenu = null; UserMenu userMenu = null; ReturnUserMenu returnUserMenu = new ReturnUserMenu(); try { using (SqlConnection sqlConnection = ConnectSQLCommon.CreateAndOpenSqlConnection()) { using (SqlCommand cmd = new SqlCommand("", sqlConnection)) { //cmd.Connection = _sqlConnection; cmd.CommandText = "sp_tUser_SelectByID"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int)).Value = ID; using (SqlDataReader sqlDr = ConnectSQLCommon.ExecuteDataReader(cmd, sqlConnection)) { if (sqlDr.HasRows) { lstUserMenu = new List <UserMenu>(); while (sqlDr.Read()) { userMenu = new UserMenu(); userMenu.ID = int.Parse(sqlDr["ID"].ToString()); userMenu.Pemission = sqlDr["Pemission"].ToString(); userMenu.UserID = int.Parse(sqlDr["UserID"].ToString()); userMenu.MenuID = int.Parse(sqlDr["MenuID"].ToString()); lstUserMenu.Add(userMenu); } returnUserMenu.Code = "00"; returnUserMenu.Message = "Lấy dữ liệu thành công."; returnUserMenu.lstUserMenu = lstUserMenu; } else { returnUserMenu.Code = "01"; returnUserMenu.Message = "Không tồn tại bản ghi nào."; returnUserMenu.Total = 0; returnUserMenu.lstUserMenu = null; } } } } } catch (Exception ex) { returnUserMenu.Code = "99"; returnUserMenu.Message = "Lỗi xử lý dữ liệu: " + ex.ToString(); returnUserMenu.Total = 0; returnUserMenu.lstUserMenu = null; mylog4net.Error("", ex); } return(returnUserMenu); }
public UserMenu CreateObject(string Name, string GroupName) { UserMenu userMenu = new UserMenu() { Name = Name, GroupName = GroupName }; return(CreateObject(userMenu)); }
public UserAccess VIsValidUserMenu(UserAccess userAccess, IUserMenuService _userMenuService) { UserMenu userMenu = _userMenuService.GetObjectById(userAccess.UserMenuId); if (userMenu == null) { userAccess.Errors.Add("Generic", "UserMenu Tidak valid"); } return(userAccess); }
private void UpdateMinusSumOfNutriens(int exerciseId) { var id = User.Identity.GetUserId(); var foodItem = _context.CaloriesTrainings.FirstOrDefault(f => f.CaloriesTrainingId == exerciseId); UserMenu sumOfNutriens = _context.UserMenus.FirstOrDefault(s => s.Date == DateTime.Today && s.CaloriesCounter.UserId == id); sumOfNutriens.CaloricDemandChangable += (short)foodItem.ExerciseCalories; _context.SaveChanges(); }
public UserMenu VHasUniqueNameAndGroupName(UserMenu userMenu, IUserMenuService _userMenuService) { UserMenu userMenu2 = _userMenuService.GetObjectByNameAndGroupName(userMenu.Name.Trim(), userMenu.GroupName.Trim()); if (userMenu2 != null && userMenu.Id != userMenu2.Id) { userMenu.Errors.Add("Generic", "Kombinasi Name dan GroupName sudah ada"); } return(userMenu); }
public Task <bool> DeleteUserMenu(UserMenuVM entity) { return(Task.Run(() => { bool used = CheckDeleteUserMenu(entity.ID, entity.AddedBy); if (!used) { DeleteSubMenuOfMenu(entity.ID, entity.AddedBy); UserMenu userMenu = new UserMenu(); { userMenu.ID = entity.ID; userMenu.Code = entity.Code; userMenu.ARName = entity.ARName; userMenu.LatName = entity.LatName; userMenu.MenuLink = entity.MenuLink; userMenu.MenuClass = entity.MenuClass; userMenu.IconClass = entity.IconClass; userMenu.IconImageURL = entity.IconImageURL; userMenu.MenuID = entity.MenuID; userMenu.DisplayOrNot = entity.DisplayOrNot; userMenu.UserShortcut = entity.UserShortcut; userMenu.UserRoleID = entity.UserRoleID; userMenu.MenuType = entity.MenuType; userMenu.LanguageID = entity.LanguageID; userMenu.ResourceURL = entity.ResourceURL; userMenu.ResourceContent = entity.ResourceContent; userMenu.Notes = entity.Notes; userMenu.AddedBy = entity.AddedBy; userMenu.AddedOn = entity.AddedOn; userMenu.UpdatedBy = entity.UpdatedBy; userMenu.UpdatedOn = entity.UpdatedOn; userMenu.Active = entity.Active; userMenu.Position = entity.Position; userMenu.CountryID = entity.CountryID; userMenu.FRName = entity.FRName; userMenu.URName = entity.URName; userMenu.TRName = entity.TRName; userMenu.BillSetiingID = entity.BillSetiingID; userMenu.EntrySettingID = entity.EntrySettingID; }; _UserMenuRepo.Delete(userMenu, userMenu.ID); return true; } else { return false; } // return true; })); }
}//end function IsAuthenticated public static bool IsAllowed(string Role, string MenuName, string MenuGroupName) { IUserAccountService _userAccountService = new UserAccountService(new UserAccountRepository(), new UserAccountValidator()); IUserAccessService _userAccessService = new UserAccessService(new UserAccessRepository(), new UserAccessValidator()); IUserMenuService _userMenuService = new UserMenuService(new UserMenuRepository(), new UserMenuValidator()); UserAccount userAccount = _userAccountService.GetObjectById(GetUserId()); if (userAccount == null) { return(false); } if (userAccount.IsAdmin) { return(true); } UserMenu userMenu = _userMenuService.GetObjectByNameAndGroupName(MenuName, MenuGroupName); if (userMenu != null) { UserAccess userAccess = _userAccessService.GetObjectByUserAccountIdAndUserMenuId(userAccount.Id, userMenu.Id); if (userAccess != null) { switch (Role.ToLower()) { case "manualpricing": return(userAccess.AllowSpecialPricing); case "view": return(userAccess.AllowView); case "create": return(userAccess.AllowCreate); case "edit": return(userAccess.AllowEdit); case "delete": return(userAccess.AllowDelete); case "undelete": return(userAccess.AllowUndelete); case "confirm": return(userAccess.AllowConfirm); case "unconfirm": return(userAccess.AllowUnconfirm); case "paid": return(userAccess.AllowPaid); case "unpaid": return(userAccess.AllowUnpaid); case "reconcile": return(userAccess.AllowReconcile); case "unreconcile": return(userAccess.AllowUnreconcile); case "print": return(userAccess.AllowPrint); } } } return(false); }//end function IsAllowed
public UserMenu getUserMenu(string Action, string controller, int userId) { UserMenu umenu = null; Menu_List menu = _db.Menu_List.Where(x => x.ActionName.ToLower() == Action.ToLower() && x.ControllerName.ToLower() == controller.ToLower()).FirstOrDefault(); if (menu != null) { umenu = _db.UserMenus.Where(x => x.MenuID == menu.ID && x.UserID == userId).FirstOrDefault(); } return(umenu); }
void addMenuPath(string ParentID, List <UserMenu> menulist) { var items = db.UserMenus.Where(p => p.ID == ParentID); if (items.Count() != 0) { UserMenu item = (UserMenu)items.ToList()[0]; menulist.Add(item); addMenuPath(item.ParentID, menulist); } }
private void OnRefreshUserMenu(object data) { UserMenu userMenu = Game.Instance.userMenu; GameObject gameObject = base.gameObject; string iconName = "action_control"; string text = UI.USERMENUACTIONS.MOVETOLOCATION.NAME; System.Action on_click = OnClickMoveToLocation; string tooltipText = UI.USERMENUACTIONS.MOVETOLOCATION.TOOLTIP; userMenu.AddButton(gameObject, new KIconButtonMenu.ButtonInfo(iconName, text, on_click, global::Action.NumActions, null, null, null, tooltipText, true), 0.2f); }
public void UpdateUserMenu(UserMenu model) { Db(db => db.Update <UserMenu>(model.UserMenuId, m => { m.UserMenuParentId = model.UserMenuParentId; m.UserMenuText = model.UserMenuText; m.UserMenuName = model.UserMenuName; m.UserMenuHref = model.UserMenuHref; m.UserMenuRemark = model.UserMenuRemark; m.UserMenuSort = model.UserMenuSort; })); }
/// <summary> /// 得到所有菜单权限 /// </summary> /// <returns></returns> public static UserMenu GetAllMenu() { MenuDataList mDL = new MenuDataList(); Dictionary <int, MenuList> AllMenu = mDL.GetAllList(); Dictionary <string, UserMenuItem> LeftMenu = new Dictionary <string, UserMenuItem>(); Dictionary <string, UserMenuItem> FunctionMap = new Dictionary <string, UserMenuItem>(); foreach (KeyValuePair <int, MenuList> itemKey in AllMenu) { MenuList item = itemKey.Value; UserMenuItem umI = new UserMenuItem(); umI.MenuId = item.menuId; umI.MenuTitle = item.menuName; umI.MenuUrl = "javascript:void(0)"; if (item.menuType == 1) { if (!LeftMenu.ContainsKey(item.superiorMenu)) { UserMenuItem superiorMenu = new UserMenuItem(); superiorMenu.ItemList = new List <UserMenuItem>(); superiorMenu.MenuTitle = item.superiorMenu; superiorMenu.MenuUrl = "javascript:void(0)"; superiorMenu.MenuIcon = mDL.GetIco(item.superiorMenu); LeftMenu[item.superiorMenu] = superiorMenu; } LeftMenu[item.superiorMenu].ItemList.Add(umI); } else { if (!FunctionMap.ContainsKey(item.superiorMenu)) { UserMenuItem superiorMenu = new UserMenuItem(); superiorMenu.ItemList = new List <UserMenuItem>(); superiorMenu.MenuTitle = item.superiorMenu; superiorMenu.MenuUrl = "javascript:void(0)"; superiorMenu.MenuIcon = mDL.GetIco(item.superiorMenu); FunctionMap[item.superiorMenu] = superiorMenu; } FunctionMap[item.superiorMenu].ItemList.Add(umI); } } UserMenu um = new UserMenu(); um.LeftMenu = LeftMenu.Values.ToList(); um.FunctionMap = FunctionMap.Values.ToList(); return(um); }
private void CreateUserMenu(ref UserMenu macros, ref CaloriesCounter counter) { macros = new UserMenu { Date = DateTime.Today, CaloriesCounterId = counter.CaloriesCounterId, CaloricDemandChangable = counter.CaloricDemand, FatChangable = counter.Fat, CarbohydratesChangable = counter.Carbohydrates, ProteinsChangable = counter.Proteins }; }
private void OnRefreshUserMenu(object data) { UserMenu userMenu = Game.Instance.userMenu; GameObject gameObject = base.gameObject; string iconName = "icon_cancel"; string text = UI.USERMENUACTIONS.CANCELMOP.NAME; System.Action on_click = OnCancel; string tooltipText = UI.USERMENUACTIONS.CANCELMOP.TOOLTIP; userMenu.AddButton(gameObject, new KIconButtonMenu.ButtonInfo(iconName, text, on_click, Action.NumActions, null, null, null, tooltipText, true), 1f); }
/// <summary> /// 获取指定菜单下的FuncKeys /// </summary> /// <returns></returns> public string GetFuncKeys(string menuid) { if (!string.IsNullOrEmpty(menuid) && menuid.IndexOfAny(new char[] { ' ', '%', ',' }) == -1) { MDataRow row = UserMenu.FindRow("MenuID='" + menuid + "'"); if (row != null) { return(row.Get <string>("ActionRefNames", "").ToLower()); } } return(string.Empty); }
/// <summary> /// method for checking username and password and opening the windows /// </summary> private void SaveExecute() { if (password.Length >= 6) { UserMenu user = new UserMenu(); user.ShowDialog(); } else { MessageBox.Show("Wrong username or password, please try again (Password minimum 6 characters)"); } }
public bool Add([FromBody] UserMenu user) { try { return(_userMenuDao.Add(user)); } catch (Exception ex) { nlog.Error(ex, "添加用户权限失败!", user.ToJSON()); return(false); } }
public ActionResult SetPermission(int id) { ManageUserModel muM = (ManageUserModel)Session["logUser"]; UserMenu um = new UserMenu(); if (muM.PowerSession == 0 && muM.MenuPermission.IndexOf("501") > -1) { um = Controls.SysAccount.Account.GetAllMenu(); } ViewBag.AccId = id; return(View(um)); }
/// <summary> /// 装载dbo.UserMenu实体 /// </summary> /// <param name="dr">记录集</param> /// <returns>返回对象</returns> private UserMenu LoadModel(IDataReader dr) { UserMenu model = new UserMenu(); model.MenuId = Convert.ToInt32(dr["MenuId"]); model.MenuName = dr["MenuName"].ToString(); model.MenuAddress = dr["MenuAddress"].ToString(); model.ParentId = Convert.ToInt32(dr["ParentId"]); model.MenuOrder = Convert.ToInt32(dr["MenuOrder"]); model.IsNavigation = Convert.ToInt32(dr["IsNavigation"]); return(model); }
public bool Update(UserMenu model) { try { return(_userMenuDao.Update(model)); } catch (Exception ex) { nlog.Error(ex, "更新用户权限失败!", model.ToJSON()); return(false); } }
private void RefreshUserMenu(object data = null) { UserMenu userMenu = Game.Instance.userMenu; GameObject gameObject = base.gameObject; string iconName = "action_follow_cam"; string text = UI.USERMENUACTIONS.READLORE.NAME; System.Action on_click = OnClickRead; string tooltipText = UI.USERMENUACTIONS.READLORE.TOOLTIP; userMenu.AddButton(gameObject, new KIconButtonMenu.ButtonInfo(iconName, text, on_click, Action.NumActions, null, null, null, tooltipText, true), 1f); }
/// <summary> /// 获取指定菜单下的FuncKeys /// </summary> /// <returns></returns> public string GetFuncKeys(string menuID) { if (!string.IsNullOrEmpty(menuID)) { MDataRow row = UserMenu.FindRow("MenuID='" + menuID + "'"); if (row != null) { return(row.Get <string>("ActionRefNames", "").ToLower()); } } return(string.Empty); }
//Updating UserMenu private void UpdatePlusSumOfNutriens(FoodSaves food) { var id = User.Identity.GetUserId(); UserMenu sumOfNutriens = _context.UserMenus.FirstOrDefault(s => s.Date == DateTime.Today && s.CaloriesCounter.UserId == id); sumOfNutriens.CaloricDemandChangable -= (short)food.Kcal; sumOfNutriens.FatChangable -= (short)food.Fat; sumOfNutriens.CarbohydratesChangable -= (short)food.Carbs; sumOfNutriens.ProteinsChangable -= (short)food.Proteins; _context.SaveChanges(); }
public async void Run() { int choice = 0; do { IMenu userMenu = new UserMenu(); choice = userMenu.PrintMenu(); switch (choice) { case (int)UserMenuOptions.Insert: //await AddUserAsync(); AddUserAsync().Wait(); break; case (int)UserMenuOptions.Delete: //await DeleteUserAsync(); DeleteUserAsync().Wait(); break; case (int)UserMenuOptions.Print: //await PrintAllAsync(); PrintAllAsync().Wait(); break; case (int)UserMenuOptions.Update: //await UpdateUserAsync(); UpdateUserAsync().Wait(); break; case (int)UserMenuOptions.GetUserWithMovie: //await GetUserByIdWithMovieAsync(); GetUserByIdWithMovieAsync().Wait(); break; case (int)UserMenuOptions.Exit: Console.WriteLine("Thanks for your visit. Please visit the User System again !!!!"); break; default: Console.WriteLine("Invalid Option"); break; } if (choice != (int)UserMenuOptions.Exit) { Console.WriteLine("Press Enter to continue......."); Console.ReadLine(); Console.Clear(); } } while (choice != (int)UserMenuOptions.Exit); }
/// <summary> /// 递归从集合中载入指定菜单的下级菜单,直到没有下级菜单 /// </summary> /// <param name="t"></param> /// <param name="m"></param> private void LoadLevelUserMenu(IList <UserMenu> t, UserMenu m) { Parallel.For(0, t.Count, index => { var temp = t[index]; if (m.ID == temp.sPID) { m.ChildMenu.Add(temp); LoadLevelUserMenu(t, temp); } }); m.ChildMenu = m.ChildMenu != null?m.ChildMenu.OrderBy(x => x.iOrder).ToList() : new List <UserMenu>(); }
private void UpdateMinusSumOfNutriens(int foodItemId) { var id = User.Identity.GetUserId(); var foodItem = _context.FoodSaveses.FirstOrDefault(f => f.FoodSavesId == foodItemId); UserMenu sumOfNutriens = _context.UserMenus.FirstOrDefault(s => s.Date == DateTime.Today && s.CaloriesCounter.UserId == id); sumOfNutriens.CaloricDemandChangable += (short)foodItem.Kcal; sumOfNutriens.FatChangable += (short)foodItem.Fat; sumOfNutriens.CarbohydratesChangable += (short)foodItem.Carbs; sumOfNutriens.ProteinsChangable += (short)foodItem.Proteins; _context.SaveChanges(); }
public static void addMenu( User user, String name, String path, Boolean isDefault ) { UserMenu m = new UserMenu(); m.Name = name; m.RawUrl = path; m.Creator = user; m.OwnerId = user.Id; m.OwnerUrl = user.Url; if (isDefault) { m.Url = "default"; } m.insert(); }
private IMenu getMainMenu(User user, string name, string url) { IMenu menu = new UserMenu(); menu.Name = name; menu.RawUrl = url; return menu; }
private static IMenu getMenu( User user, string name, string url, MvcContext ctx ) { IMenu menu = new UserMenu(); menu.Name = name; menu.RawUrl = UrlConverter.clearUrl( url, ctx, typeof( User ).FullName, user.Url ); return menu; }
public void SelectSkill(UserMenu.AbilityType _button) { currentState = InputState.SkillMode; switch (_button) { case UserMenu.AbilityType.Lure: if (FungusResources.Instance.attract.isUnlocked) { selectedSkill = FungusResources.Instance.attract; } break; case UserMenu.AbilityType.Eat: if (FungusResources.Instance.beatneat.isUnlocked) { selectedSkill = FungusResources.Instance.beatneat; } break; case UserMenu.AbilityType.Spawn: if (FungusResources.Instance.growth.isUnlocked) { selectedSkill = FungusResources.Instance.growth; } break; case UserMenu.AbilityType.Slow: if (FungusResources.Instance.slowdown.isUnlocked) { selectedSkill = FungusResources.Instance.slowdown; } break; case UserMenu.AbilityType.Speedup: if (FungusResources.Instance.speedup.isUnlocked) { selectedSkill = FungusResources.Instance.speedup; } break; case UserMenu.AbilityType.Enslave: if (FungusResources.Instance.zombies.isUnlocked) { selectedSkill = FungusResources.Instance.zombies; } break; default: Debug.Log("Something went wrong"); selectedSkill = null; break; } }
public void ActivateMode(UserMenu.UserMenuButtonType type) { leftSkillMode = false; switch (type) { case UserMenu.UserMenuButtonType.Brain: currentState = InputState.MoveBrainMode; break; case UserMenu.UserMenuButtonType.Build: currentState = InputState.BuildMode; break; case UserMenu.UserMenuButtonType.Skill: currentState = InputState.SkillMode; break; case UserMenu.UserMenuButtonType.Wind: currentState = InputState.ChangeWind; break; case UserMenu.UserMenuButtonType.None: currentState = InputState.NoMode; skillTimer = 0.0f; leftSkillMode = true; break; } }
private IMenu getMenu( User user, string name, string url ) { IMenu menu = new UserMenu(); menu.Name = name; menu.RawUrl = UrlConverter.clearUrl( url, ctx, typeof( User ).FullName, user.Url ).TrimStart( '/' ); return menu; }