private LocomotiveDetails BuildDB(HtmlTableExtractLoco table, string uri)
        {
            var db = new LocomotiveDetails(table, uri);

            db.Save();
            return(db);
        }
        public LocomotiveDetails CreateDB(string url)
        {
            HtmlTableExtract     table     = GetTable(url, string.Empty);
            HtmlTableExtractLoco tableLoco = new HtmlTableExtractLoco(table);
            var loco = BuildDB(tableLoco, url);

            var ldb = LocomotiveDBServices.GetDBServices();

            ldb.Add(loco);

            return(loco);
        }
Esempio n. 3
0
 private void PopulateFromWeb(HtmlTableExtractLoco htmlTableExtractLoco, string url)
 {
     Name           = htmlTableExtractLoco.TableName;
     Operators      = htmlTableExtractLoco.Operators;
     Class          = htmlTableExtractLoco.Class;
     Designer       = htmlTableExtractLoco.Designer;
     Axleload       = htmlTableExtractLoco.Axleload;
     BuildDate      = htmlTableExtractLoco.BuildDate;
     BuildDateTime  = htmlTableExtractLoco.BuildDateTime;
     Whyte          = htmlTableExtractLoco.Whyte;
     TotalProduced  = htmlTableExtractLoco.TotalProduced;
     Length         = htmlTableExtractLoco.Length;
     PowerClass     = htmlTableExtractLoco.PowerClass;
     TractiveEffort = htmlTableExtractLoco.TractiveEffort;
     WebSite        = url;
 }
Esempio n. 4
0
        public void UpdateFromSite()
        {
            LocomotivesServices  ls            = ServiceLocator.Instance.GetService <LocomotivesServices>();
            HtmlTableExtract     table         = ls.GetTable(WebSite, string.Empty);
            HtmlTableExtractLoco latestVersion = new HtmlTableExtractLoco(table);

            if (Operators == MISSING)
            {
                Operators = latestVersion.Operators;
                SetDirty();
            }

            if (Class == MISSING)
            {
                Class = latestVersion.Class;
                SetDirty();
            }
        }
Esempio n. 5
0
 public LocomotiveDetails(HtmlTableExtractLoco htmlTableExtractLoco, string html)
 {
     PopulateFromWeb(htmlTableExtractLoco, html);
 }