public Task <int> InsertUserForm(UserMenuVM entity, int id) { return(Task.Run(() => { UserForm userForm = new UserForm() { UserMenuID = id, ARName = entity.ARName, LatName = entity.LatName }; //var q=UserMenuRepo.GetAll().Where(a => a.ID == entity.MenuID).SingleOrDefault(); //if (q != null) //{ if (entity.BillSetiingID != null && entity.BillSetiingID != 0) { userForm.Code = "BillMaster" + "/" + entity.BillSetiingID; } if (entity.EntrySettingID != null && entity.EntrySettingID != 0) { userForm.Code = "EntryMaster" + "/" + entity.EntrySettingID; } //} UserFormRepo.Add(userForm); var obj = UserMenuRepo.GetAll().Where(a => a.ID == id).SingleOrDefault(); if (obj != null) { obj.Code = userForm.Code; UserMenuRepo.Update(obj, obj.ID); } return entity.ID; })); }
public UserInfo(string name, string image, String email) { this.correo = email; InitializeComponent(); vM = new UserMenuVM(); userName.Text = name; userImage.Source = image; MyMenuList.ItemsSource = vM.getUserMenuIL(email); }
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; })); }
public async Task <IHttpActionResult> UpdateUserMenu(UserMenuVM userMenu) { var result = await _statusService.UpdateUserMenu(userMenu); if (userMenu.MenuID != null && userMenu.MenuID != 0) { // await _userFormService.InsertUserForm(userMenu, result); await LogData(null, userMenu.ID.ToString()); } return(Ok(result)); }
private List <UserMenuVM> ReturnUserMenus(int country, int usershortcut, int lang, List <UserMenuVM> UserMenuList, int MenuID) { UserMenu obj = _UserMenuRepo.GetByID(MenuID); UserMenuVM entityObj = new UserMenuVM(); if (obj.Active == true && obj.CountryID == country && obj.UserShortcut == usershortcut) { if (lang == 1) { entityObj.NAME = obj.ARName; } else { entityObj.NAME = obj.LatName; } entityObj.Active = obj.Active; entityObj.AddedBy = obj.AddedBy; entityObj.AddedOn = obj.AddedOn; entityObj.ARName = obj.ARName; entityObj.Code = obj.Code; entityObj.CountryID = obj.CountryID; entityObj.IconClass = obj.IconClass; entityObj.IconImageURL = obj.IconImageURL; entityObj.ID = obj.ID; entityObj.LatName = obj.LatName; entityObj.MenuClass = obj.MenuClass; entityObj.MenuID = obj.MenuID; entityObj.MenuLink = obj.MenuLink; entityObj.Notes = obj.Notes; entityObj.Position = obj.Position; entityObj.UpdatedBy = obj.UpdatedBy; entityObj.UpdatedOn = obj.UpdatedOn; entityObj.UserRoleID = obj.UserRoleID; entityObj.UserShortcut = obj.UserShortcut; if (UserMenuList.Find(x => x.ID == entityObj.ID) == null) { UserMenuList.Add(entityObj); } if (obj.MenuID != null) { UserMenuList = ReturnUserMenus(country, usershortcut, lang, UserMenuList, Convert.ToInt32(obj.MenuID)); } } return(UserMenuList); }
public async Task <IHttpActionResult> InsertUserMenu(UserMenuVM userMenu) { var result = await _statusService.InsertUserMenu(userMenu); if (userMenu.MenuID != null && userMenu.MenuID != 0) { // await _userFormService.InsertUserForm(userMenu, result); await LogData(null, result.ToString()); } if (result != 0) { return(Ok(true)); } ; return(Ok(false)); }
/// <summary> /// return menu as list with childs for each item and sub item and so on /// </summary> /// <param name="userMenuList"> menu list without levels </param> /// <param name="Lang"> user language </param> /// <returns></returns> private List <UserMenuVM> GetAllMenuItemsWithLevels(List <UserMenu> userMenuList, int Lang) { List <UserMenuVM> MenuList = new List <UserMenuVM>(); if (userMenuList.Count() > 0) { foreach (var Item in userMenuList.Where(p => p.MenuID == null).ToList()) { var MenuItem = new UserMenuVM(); if (Lang == 1) { MenuItem.NAME = Item.ARName; } else { MenuItem.NAME = Item.LatName; } MenuItem.Active = Item.Active; MenuItem.AddedBy = Item.AddedBy; MenuItem.AddedOn = Item.AddedOn; MenuItem.ARName = Item.ARName; MenuItem.Code = Item.Code; MenuItem.CountryID = Item.CountryID; MenuItem.IconClass = Item.IconClass; MenuItem.IconImageURL = Item.IconImageURL; MenuItem.ID = Item.ID; MenuItem.LatName = Item.LatName; MenuItem.MenuClass = Item.MenuClass; MenuItem.MenuID = Item.MenuID; MenuItem.MenuLink = Item.MenuLink; MenuItem.Notes = Item.Notes; MenuItem.Position = Item.Position; MenuItem.UpdatedBy = Item.UpdatedBy; MenuItem.UpdatedOn = Item.UpdatedOn; MenuItem.UserRoleID = Item.UserRoleID; MenuItem.UserShortcut = Item.UserShortcut; MenuItem.ChildMenus = GetMenuItemChilds(Item.ID, userMenuList, Lang); MenuList.Add(MenuItem); } } return(MenuList); }
public Task <int> InsertUserMenu(UserMenuVM entity) { return(Task.Run(() => { 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.Add(userMenu); return userMenu.ID; })); }
public List <UserMenuVM> ReturnCorrectUserMenus(List <UserMenuVM> UserMenus) { List <UserMenuVM> CorrectMenus = new List <UserMenuVM>(); foreach (var UserMenuVMitem in UserMenus) { UserMenuVM obj = new UserMenuVM(); obj.ARName = UserMenuVMitem.ARName; obj.LatName = UserMenuVMitem.LatName; obj.MenuClass = UserMenuVMitem.MenuClass; obj.NAME = UserMenuVMitem.NAME; obj.UserShortcut = UserMenuVMitem.UserShortcut; obj.UserRoleID = UserMenuVMitem.UserRoleID; obj.MenuLink = UserMenuVMitem.MenuLink; obj.IconClass = UserMenuVMitem.IconClass; obj.IconImageURL = UserMenuVMitem.IconImageURL; obj.Position = UserMenuVMitem.Position; obj.ChildMenus = new List <UserMenuVM>(); foreach (var item in UserMenus) { if (UserMenuVMitem.ID == item.MenuID) { UserMenuVM child = new UserMenuVM(); child.ARName = item.ARName; child.LatName = item.LatName; child.NAME = item.NAME; child.UserShortcut = item.UserShortcut; child.UserRoleID = item.UserRoleID; child.MenuLink = item.MenuLink; child.IconClass = item.IconClass; child.IconImageURL = item.IconImageURL; child.Position = item.Position; obj.ChildMenus.Add(child); } } if (obj.ChildMenus != null && obj.ChildMenus.Count > 0) { CorrectMenus.Add(obj); } } return(CorrectMenus); }