public ActionResult GetMenus() { var icons = new[] { "fa-th", "fa-desktop", "fa-table", "fa-bar-chart-o", "fa-pencil-square-o", "fa-picture-o", "fa-calendar", "fa-credit-card","fa-laptop", "fa-hdd-o", "fa-tasks"," fa-list-alt" }; //var userRoleIds = IdentityContract.UserRoleMaps // .Where(p => p.User.UserName == User.Identity.Name).Select(p => p.Role.Id).Distinct().ToList(); //var functions = SecurityContract.FunctionRoleMaps // .Where(p => userRoleIds.Contains(p.Role.Id)) // .Where(p => !p.Function.IsLocked && !p.Function.IsCustom && !p.Function.IsAjax && p.Function.PlatformToken == PlatformToken.Mvc && p.Function.Controller != "Home") // .Select(p => p.Function).Distinct().OrderBy(p => p.OrderNo).ToList(); var functions = SecurityContract.Functions.Where(p => !p.IsLocked && !p.IsCustom && !p.IsAjax && p.PlatformToken == PlatformToken.Mvc && p.Controller != "Home") .OrderBy(p => p.OrderNo) .ToList(); int i = 0; var menus = functions.Where(p => p.IsController).Select(p => { return new TreeNode() { Id = p.Id, Text = p.Name, IconCls = icons[i++ % icons.Count()], Url = Url.Action(p.Action, p.Controller, new { area = p.Area }), Children = functions.Where( m => m.Controller == p.Controller && m.Area == p.Area && !m.IsController && m.IsMenu) .Select(m => { string url = Url.Action(m.Action, m.Controller, new { area = m.Area }); if (url == "/") url = ""; return new TreeNode() { Id = m.Id, Text = m.Name, IconCls = "", Url = url, }; }).ToList() }; }).ToList(); return Json(menus); }
protected override void OnValidating(C.CancelEventArgs e) { if (this.record) events.Enqueue(String.Format("{0}:{1}:OnValidating", this, this.Name)); base.OnValidating (e); }
protected virtual void OnPropertyChanged(SCM.PropertyChangedEventArgs e) { if (this.PropertyChanged == null) { return; } this.PropertyChanged((object)this, e); }
private static string ParseBoolean(string value) { const string code0 = "code 0"; // except value that we consider as true (1) var valueInLower = value.ToLower(); var falseKeywords = new[] { "0", "-1", "desactivated", "deactivated", "disabled", "error", "failed", "false", "fail", "none", "not", "no", "time out", "timeout", "out", "unsuccess", "unexpected", "unable", "warning" }; return falseKeywords.Where(valueInLower.Contains).Any(keyword => !valueInLower.Contains(code0)) ? "0" : "1"; }
protected virtual void OnCurrentChanging(SCM.CurrentChangingEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } if (this.CurrentChangedMonitor.Busy) { if (!args.IsCancelable) { return; } args.Cancel = true; } else { if (this.CurrentChanging == null) { return; } this.CurrentChanging((object)this, args); } }
/// <summary> /// Gets the throw clause. /// </summary> /// <returns>return catch...throw statement</returns> internal static CodeCatchClause[] GetThrowClause() { var catchStatmanents = new CodeStatementCollection(); catchStatmanents.Add(new CodeThrowExceptionStatement(new CodeVariableReferenceExpression("ex"))); var catchClause = new CodeCatchClause( "ex", new CodeTypeReference(typeof(Exception)), catchStatmanents.ToArray()); var catchClauses = new[] { catchClause }; return catchClauses; }
/// <summary> /// Return catch statements /// </summary> /// <returns>CodeCatchClause statements</returns> internal static CodeCatchClause[] GetCatchClause() { var catchStatmanents = new CodeStatement[2]; catchStatmanents[0] = new CodeAssignStatement( new CodeVariableReferenceExpression("exception"), new CodeVariableReferenceExpression("ex")); catchStatmanents[1] = GetReturnFalse(); var catchClause = new CodeCatchClause( "ex", new CodeTypeReference(typeof(Exception)), catchStatmanents); var catchClauses = new[] { catchClause }; return catchClauses; }
private void OnPropertyChanged(object sender, SCM.PropertyChangedEventArgs args) { SCM.PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; if (propertyChangedEventHandler != null) { propertyChangedEventHandler(this, args); } }
private void OnCurrentChanging(object sender, SCM.CurrentChangingEventArgs args) { SCM.CurrentChangingEventHandler currentChangingEventHandler = this.CurrentChanging; if (currentChangingEventHandler != null) { currentChangingEventHandler(this, args); } }