This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public T RandomItem() | |
{ | |
int randomRI = 0; | |
Random random = new Random(); | |
lock (random) | |
{ | |
randomRI = random.Next(0, this.Count - 1); | |
} | |
return this[randomRI]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string[] ids = this.Parameters["OrderByRank"].Split(','); | |
for (int x = 0; x < ids.Length; x++) | |
{ | |
Event foundevent = ec.Find(delegate(Event e) | |
{ | |
return e.ViewID == ids[x]; | |
}); | |
if (foundevent != null) | |
foundevent.Order = -1000 + x; // start at -1000 because the default order is 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate BaseGenericList<T> MethodExecution<T>(); | |
public static BaseGenericList<T> GetCachedList<T>(string key, object[] argsKey, MethodExecution<T> method) | |
{ | |
BaseGenericList<T> list = new BaseGenericList<T>(); | |
T[] listarray = (T[])CacheConfig.DeCache(key, argsKey); | |
if (listarray == null) | |
{ | |
list = method(); | |
CacheConfig.EnCache(key, list.ToArray(), argsKey); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Mofo.Framework.Components | |
{ | |
public class Lookup<T> | |
{ | |
public T ID { get; set; } | |
public string Name { get; set; } | |
} | |
} | |
namespace Mofo.Framework.Components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<T> LoadLookup<T, U>(IDataReader reader) where T : ILookup<U>, new() | |
{ | |
List<T> list = new List<T>(); | |
try | |
{ | |
while (reader.Read()) | |
{ | |
T lookup = new T(); | |
lookup.ID = (U)reader["ID"]; | |
lookup.Name = (string)reader["Name"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
ALTER PROCEDURE [dbo].[Tombstones_SearchTombstones] | |
@industry_id smallint = null, | |
@region_id_list varchar(8000) = null, | |
@inbound_region_id_list varchar(8000) = null, | |
@outbound_region_id_list varchar(8000) = null | |
AS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToIDList<T, U>(List<U> lookuplist) where U : ILookup<T> where T : struct | |
{ | |
List<U> lookupidlist = lookuplist.FindAll(delegate(U lookup) | |
{ | |
return lookup.ID.HasValue; | |
}); | |
string idlist = String.Empty; | |
if (lookupidlist != null) | |
{ | |
string[] ids = new string[lookupidlist.Count]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public delegate T MethodExecution<T>(IDataReader reader); | |
public static List<T> LoadList<T>(IDataReader reader, MethodExecution<T> method) | |
{ | |
return LoadList<T>(reader, true, method); | |
} | |
public static List<T> LoadList<T>(IDataReader reader, bool close_reader, MethodExecution<T> method) | |
{ | |
List<T> list = new List<T>(); | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' VB.Net 2.0 | |
' a class for videos is what I was using my original code for | |
Public Class Video | |
Private _id As Integer | |
Public Property Id() As Integer | |
Get | |
Return _id | |
End Get | |
Set(ByVal value As Integer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bookmarklet to introspect the source of current page | |
javascript:(function(d,h){h=d.documentElement.innerHTML;d.open();d.write('<pre>'+('<!DOCTYPE html><html>'+h+'</html>').replace(/[<>]/g,function(m){return{'<':'<','>':'>'}[m]})+'</pre>')})(document); |
OlderNewer