Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
 public static List <string> GetTablesScripts(OHDbBaseClient dbClient)
 {
     return(GetScripts(ScriptTypes.Tables, dbClient));
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public static List <string> GetDataScripts(OHDbBaseClient dbClient)
 {
     return(GetScripts(ScriptTypes.Data, dbClient));
 }
Esempio n. 7
0
 public static List <string> GetProceduresScripts(OHDbBaseClient dbClient)
 {
     return(GetScripts(ScriptTypes.Procedures, dbClient));
 }