public ControlData ControlData(Context context, SiteSettings ss, bool withType = true) { var typeName = withType ? DisplayTypeName(context: context) : null; switch (Name) { case "Dept": var dept = SiteInfo.Dept( tenantId: context.TenantId, deptId: Id); return(new ControlData( text: dept?.SelectableText( context: context, format: Parameters.Permissions.DeptFormat) + typeName, title: dept?.Tooltip())); case "Group": var group = SiteInfo.Group( tenantId: context.TenantId, groupId: Id); return(new ControlData( text: group?.SelectableText( context: context, format: Parameters.Permissions.GroupFormat) + typeName, title: group?.Tooltip())); case "User": var user = SiteInfo.User( context: context, userId: Id); return(new ControlData( text: user?.SelectableText( context: context, format: Parameters.Permissions.UserFormat) + typeName, title: user?.Tooltip(context: context))); default: var column = ss?.GetColumn( context: context, columnName: Name); return(new ControlData( id: Id, text: Displays.Column(context: context), name: column?.LabelText, title: column?.LabelTextDefault, typeName: typeName)); } }
public ServerScriptModelGroupModel Get(object id) { var group = SiteInfo.Group( tenantId: Context.TenantId, groupId: id.ToInt()); var groupModel = group.Id > 0 ? new ServerScriptModelGroupModel( context: Context, tenantId: group.TenantId, groupId: group.Id, groupName: group.Name) : null; return(groupModel); }
public static string ToNotice( this string self, Context context, string saved, Column column, NotificationColumnFormat notificationColumnFormat, bool updated, bool update) { if (column.HasChoices()) { switch (column.Type) { case Column.Types.Dept: return(notificationColumnFormat.DisplayText( self: SiteInfo.Dept( tenantId: context.TenantId, deptId: self.ToInt()).Name, saved: SiteInfo.Dept( tenantId: context.TenantId, deptId: saved.ToInt()).Name, column: column, updated: updated, update: update)); case Column.Types.Group: return(notificationColumnFormat.DisplayText( self: SiteInfo.Group( tenantId: context.TenantId, groupId: self.ToInt()).Name, saved: SiteInfo.Group( tenantId: context.TenantId, groupId: saved.ToInt()).Name, column: column, updated: updated, update: update)); case Column.Types.User: return(notificationColumnFormat.DisplayText( self: SiteInfo.UserName( context: context, userId: self.ToInt()), saved: SiteInfo.UserName( context: context, userId: saved.ToInt()), column: column, updated: updated, update: update)); default: return(notificationColumnFormat.DisplayText( self: column.Choice(self).Text, saved: column.Choice(saved).Text, column: column, updated: updated, update: update)); } } else { return(notificationColumnFormat.DisplayText( self: self, saved: saved, column: column, updated: updated, update: update)); } }