private string GetLeftMenuItemIconImage(SysNavigation nav) { if (string.IsNullOrEmpty(nav.NavIcon)) return string.Empty; else return string.Format(SEC_IMAGE, nav.NavIcon); }
public virtual SysNavigation RenderNav(SysNavigation item, MenuRegion region) { if (region == MenuRegion.Main) { if (string.IsNullOrEmpty(item.OthName)) item.NavName = item.SecName; else item.NavName = item.OthName; if (Utilities.Compare(item.NavUrl, "/Company/CompanyItemEdit.aspx") && AppContext.CurrentSysId == (int)SubSystem.Company) { var t = CompanyBLL.GetCompanyTypeById(AppContext.Context.User.CompanyId.Value); if (t == CompanyType.AdCompany) { item.NavUrl = "/Company/CompanyAdsClicked.aspx"; } else if (t == CompanyType.SpecialCompany) { item.NavUrl = "/Company/CompanyItemUsed.aspx"; } } } return item; }
public void Insert(string NavName,string SecName,string OthName,string NavUrl,string NavIcon,int? SubSysId,int? PId,bool IsMainNav,bool IsHeader,bool IsFooter,bool PermissionRequired,int Sort,bool Visible,string Depth,int? CreatedBy,DateTime? CreatedOn,int? ModifiedBy,DateTime? ModifiedOn) { SysNavigation item = new SysNavigation(); item.NavName = NavName; item.SecName = SecName; item.OthName = OthName; item.NavUrl = NavUrl; item.NavIcon = NavIcon; item.SubSysId = SubSysId; item.PId = PId; item.IsMainNav = IsMainNav; item.IsHeader = IsHeader; item.IsFooter = IsFooter; item.PermissionRequired = PermissionRequired; item.Sort = Sort; item.Visible = Visible; item.Depth = Depth; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.Save(UserName); }
private static void RefreshNavCore(ref List<NavigationDefineAttribute> navDefines, ref SysNavigationCollection navs, NavigationDefineAttribute navDefine, SysNavigation nav) { string navUrl = navDefine == null ? string.Empty : navDefine.NavUrl; List<NavigationDefineAttribute> partNavDefines = FindNavDefinesByUrl(ref navDefines, navUrl); if (partNavDefines.Count == 0 && navDefine == null && nav == null) { partNavDefines = navDefines; } foreach (NavigationDefineAttribute partNav in partNavDefines) { //not exist item and new item to navs SysNavigation cNav = FindNavByUrl(navs, partNav.NavUrl); if (cNav == null) { SysNavigation pNav = FindNavByUrl(navs, partNav.P_NavUrl); cNav = AddNewNavigation(partNav, pNav == null ? nav : pNav); AutoRoleAssignement(cNav); //? navs.Add(cNav); } RefreshNavCore(ref navDefines, ref navs, partNav, cNav); } }
private static void AutoRoleAssignement(SysNavigation nav) { int roleDefine = UserBLL.GetDefaultUseRole(nav.SubSysId.Value); SysRoleAssignment ass = DB.Select( ).From<SysRoleAssignment>( ) .Where(SysRoleAssignment.NavIDColumn).IsEqualTo(nav.Id) .And(SysRoleAssignment.RoleIDColumn).IsEqualTo(roleDefine) .ExecuteSingle<SysRoleAssignment>( ); if (ass == null) { new SysRoleAssignment { NavID = nav.Id, RoleID = roleDefine, Allow = true }.Save( ); } }
private static SysNavigation AddNewNavigation(NavigationDefineAttribute navDefine, SysNavigation pNav) { int nPID = 0; string sDepth = "/"; if (pNav != null) { nPID = Utilities.ToInt(pNav.Id); sDepth = pNav.Depth; } SysNavigation cNav = new SysNavigation( ) { IsFooter = navDefine.IsFooter, IsHeader = navDefine.IsHeader, IsMainNav = navDefine.IsMainNav, NavName = navDefine.NavName, NavUrl = navDefine.NavUrl, PId = nPID, PermissionRequired = navDefine.PermissionRequired, SecName = navDefine.SecName, OthName = navDefine.OthName, SubSysId = Convert.ToInt32(navDefine.SubSys), Visible = true, Sort = 0, Depth = "/", NavIcon = navDefine.NavIcon }; cNav.Save(AppContextBase.CurrentUserID); cNav.Sort = cNav.Id; cNav.Depth = string.Concat(sDepth, cNav.Id, "/"); cNav.Save( ); return cNav; }