protected void btnCreateSchema_Click(object sender, EventArgs e) { List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets(); foreach (var target in OHTargets) { OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target); dbClient.CreateDBSchema(); break; } }
protected void btnGetVersion_Click(object sender, EventArgs e) { List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets(); foreach (var target in OHTargets) { OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target); gridResult.DataSource = dbClient.GetVersion(typeof(Customer), "2", new DateTime(2010, 5, 22, 3, 0, 0)).AsDataTable(); gridResult.DataBind(); break; } }
protected void btnGetHistory_Click(object sender, EventArgs e) { List <OHTarget> OHTargets = App.Logger.NLogUtilities.GetOHTargets(); foreach (var target in OHTargets) { OHDbBaseClient dbClient = OHDbFactory.GetDbClient(target); gridResult.DataSource = dbClient.GetHistory(typeof(Supplier), "4").AsDataTable(); gridResult.DataBind(); break; } }
public static List <string> GetTablesScripts(OHDbBaseClient dbClient) { return(GetScripts(ScriptTypes.Tables, dbClient)); }
private static List <string> GetScripts(ScriptTypes type, OHDbBaseClient dbClient) { string ObjectsPrefix = dbClient.target.DBTablesPrefix; string _dbScriptsContainerPath = string.IsNullOrEmpty(dbClient.DbScriptsContainerPath) ? string.Empty : dbClient.DbScriptsContainerPath; string filter = string.Empty; switch (type) { case ScriptTypes.Tables: filter = "tables-v"; break; case ScriptTypes.Procedures: filter = "procedures-v"; break; case ScriptTypes.Views: filter = "views-v"; break; case ScriptTypes.Data: filter = "data-v"; break; default: break; } Assembly asm = Assembly.GetExecutingAssembly(); string[] resNames = asm.GetManifestResourceNames(); Stream sqlStream = null; List <string> list = new List <string>(); if (resNames == null || resNames.Length == 0) { return(list); } for (int i = 0; i < resNames.Length; i++) { if (resNames[i].StartsWith(_dbScriptsContainerPath) && resNames[i].ToLower().Contains(filter.ToLower())) { list.Add(resNames[i]); } } list.Sort(new ScriptFileNameComparer()); for (int i = 0; i < list.Count; i++) { sqlStream = asm.GetManifestResourceStream(list[i]); using (StreamReader sr = new StreamReader(sqlStream)) { string script = sr.ReadToEnd(); list[i] = string.Format(script, ObjectsPrefix); } } return(list); }
public static List <string> GetDataScripts(OHDbBaseClient dbClient) { return(GetScripts(ScriptTypes.Data, dbClient)); }
public static List <string> GetProceduresScripts(OHDbBaseClient dbClient) { return(GetScripts(ScriptTypes.Procedures, dbClient)); }