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
var Person = (name, nickname) => { | |
return { | |
getFullName: () => name + ' (' + nickname + ')', | |
getName: () => 'Your name is: ' + name, | |
getNickname: () => 'People call you: ' + nickname, | |
}; | |
}; | |
var me = Person("Jose", "El Jefe"); |
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 DataTable GetData(DateTime valueDate, | |
string branch, | |
string levelName, | |
string subLevelName, | |
string finalLevelName) | |
{ | |
if (valueDate.equals(DateTime.Min) || | |
string.IsNullOrEmpty(branch) || | |
string.IsNullOrEmpty(levelName) || | |
string.IsNullOrEmpty(subLevelName) || |
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
private static bool AreParamsValid(object[] parameters) | |
{ | |
if (parameters == null || parameters.Length == 0) | |
return false; | |
var result = true; | |
parameters.ForEach(p => | |
{ | |
if (p is string) |
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 DataTable GetData(DateTime valueDate, | |
string branch, | |
string levelName, | |
string subLevelName, | |
string finalLevelName) | |
{ | |
var parameters = new object[] { valueDate, branch, levelName, subLevelName, finalLevelName}; | |
var paramsValid = AreParamsValid(parameters); | |
if (!paramsValid) |
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 DataTable GetTopLevel(DateTime valueDate, string branch) | |
{ | |
const string storedProc = "GetTopLevel"; | |
var parameters = new Dictionary<string, object> | |
{ | |
{ParamConstant.ValueDate, valueDate}, | |
{ParamConstant.Branch, branch} | |
}; | |
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 DataTable GetFirstLevel(DateTime valueDate, string branch, string levelName) | |
{ | |
const string storedProc = "GetLevelOne"; | |
var parameters = new Dictionary<string, object> | |
{ | |
{ParamConstant.ValueDate, valueDate}, | |
{ParamConstant.Branch, branch}, | |
{ParamConstant.LevelName, levelName}, | |
}; |
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 DataTable GetSecondLevel(DateTime valueDate, | |
string branch, | |
string levelName, | |
string subLevelName) | |
{ | |
const string storedProc = "GetLevelTwo"; | |
var parameters = new Dictionary<string, object> | |
{ | |
{ParamConstant.ValueDate, valueDate}, |
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 Enum Level | |
{ | |
Top, | |
One, | |
Two | |
} | |
public class StoredProcParam | |
{ | |
public const string ValueDate = "ValueDate"; |
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
private static Dictionary<string, object> SetupStoredProcParameters(Level level, | |
DateTime valueDate, | |
string branch, | |
string levelName, | |
string subLevelName) | |
{ | |
var parameters = new Dictionary<string, object>(); | |
switch(level) | |
{ | |
case Level.Top: |
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 DataTable GetTopLevel(DateTime valueDate, string branch) | |
{ | |
var parameters = SetupStoredProcParameters(Level.Top, valueDate, branch); | |
const string storedProc = "GetTopLevel"; | |
var result = storedProc.ToDataTable(dbConnection, parameters); | |
return result; | |
} |
OlderNewer