Skip to content

Instantly share code, notes, and snippets.

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
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"];
namespace Mofo.Framework.Components
{
public class Lookup<T>
{
public T ID { get; set; }
public string Name { get; set; }
}
}
namespace Mofo.Framework.Components
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);
}
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
}
public T RandomItem()
{
int randomRI = 0;
Random random = new Random();
lock (random)
{
randomRI = random.Next(0, this.Count - 1);
}
return this[randomRI];
}