public static void KeyPressed(FunctionKey key) { if (Hooks.ContainsKey(key)) { Hooks[key](); } }
/// <summary> /// Registers handler to generate T-SQL for custom function. /// </summary> /// <param name="functionKey">The function key.</param> /// <param name="handler">The handler.</param> public static void RegisterFunctionHandler(FunctionKey functionKey, Action <ExpressionGenerator, DbFunctionExpression> handler) { functionKey.VerifyNotNull(nameof(functionKey)); handler.VerifyNotNull(nameof(handler)); s_functionHandlers.Add(functionKey, handler); }
public static void Verify(this DbFunctionExpression expression, FunctionKey functionKey, params Column[] paramList) { Assert.AreEqual(functionKey, expression.FunctionKey); Assert.AreEqual(paramList.Length, expression.ParamList.Count); for (int i = 0; i < paramList.Length; i++) { Assert.AreEqual(paramList[i].DbExpression, expression.ParamList[i]); } }
public override int GetHashCode() { unchecked { int hash = 13; hash = (hash * 397) ^ (FunctionKey != null ? FunctionKey.GetHashCode() : 0); hash = (hash * 397) ^ (String != null ? String.GetHashCode() : 0); return(hash); } }
public static void Register(FunctionKey functionKey, FunctionMethod functionMethod) { if (Hooks.ContainsKey(functionKey)) { Hooks[functionKey] = functionMethod; } else { Hooks.Add(functionKey, functionMethod); } }
public List <FunctionKey> GetFunctionKeys(string connectionString, string CustomerId, string StoreId) { List <FunctionKey> lm = new List <FunctionKey>(); string Sql = ""; #region Sql Sql += "select [Index],[Mod],[Description],[Job],Colour,Html_Colour,Bootstrap_Button,Visible "; Sql += "from " + CustomerId + "_" + StoreId + "_" + "FunctionKeys "; Sql += "order by [Mod],[Index] "; #endregion Sql #region Execute SQL using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(Sql, connection)) { SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { FunctionKey m = new FunctionKey(); #region Fill Model //[Index],[Mod],[Description],[Function],Colour,Html_Colour,Bootstrap_Button,Visible try{ m.Index = reader.GetInt32(0); }catch {} try{ m.Mod = reader.GetString(1); }catch {} try{ m.Description = reader.GetString(2); }catch {} try{ m.Job = reader.GetString(3); }catch {} try{ m.Colour = reader.GetString(4); }catch {} try{ m.HtmlColour = reader.GetString(5); }catch {} try{ m.BootstrapButton = reader.GetString(6); }catch {} try{ m.Visible = reader.GetBoolean(7); }catch {} #endregion Fill Model lm.Add(m); } } } #endregion Execute SQL return(lm); }
protected bool Equals(FunctionKey other) { return(_name == other._name && _type1 == other._type1 && _type2 == other._type2); }
public static void Verify(this DbFunctionExpression expression, FunctionKey functionKey) { Assert.AreEqual(functionKey, expression.FunctionKey); Assert.AreEqual(0, expression.ParamList.Count); }