Пример #1
0
 public McfDecodesConverter(PostgreSQL svr, McfDataSet mcf, DecodesDataSet decodes)
 {
     this.svr     = svr;
     this.mcf     = mcf;
     this.decodes = decodes;
     m_converter  = new UnitConversion(mcf, decodes, svr);
 }
Пример #2
0
        public static DecodesDataSet GetDataSet(PostgreSQL svr)
        {
            var ds = new DecodesDataSet();

            for (int i = 0; i < tableNames.Length; i++)
            {
                string sql = "select * from " + tableNames[i];
                var    tbl = ds.Tables[tableNames[i]];

                // check for schema changes

                var tblx = svr.Table(tableNames[i], sql + " where 1=2");
                var cnx  = tblx.Columns.Cast <DataColumn>()
                           .Select(x => x.ColumnName).ToArray();
                var cn = tbl.Columns.Cast <DataColumn>()
                         .Select(x => x.ColumnName).ToArray();

                if (cnx.Length != cn.Length)
                {
                    Logger.WriteLine("database: " + String.Join(",", cnx));
                    Logger.WriteLine("dataset : " + String.Join(",", cn));
                }


                svr.FillTable(tbl, sql);

                if (tbl.Rows.Count > 0)
                {
                    Console.WriteLine("Notice Existing data. " + tableNames[i] + " has " + tbl.Rows.Count + " rows ");
                }
            }
            return(ds);
        }
Пример #3
0
        //public static void TruncateTablesaa(PostgreSQL svr)
        //{
        //    foreach (var tableName in tableNames)
        //    {
        //        string sql = "delete from " + tableName ;
        //        svr.RunSqlCommand(sql);
        //    }
        //}

        //    public static void AddEquipment(DecodesDataSet decodes)  {


        //        var e = decodes.equipmentmodel;
        //        var ep = decodes.equipmentproperty;

        //        e.AddequipmentmodelRow(1, "MCF-S", "Sutron", "", "", "DCP");
        //        e.AddequipmentmodelRow(2, "MCF-A", "FTX", "TX312", "", "DCP");
        //        e.AddequipmentmodelRow(3, "MCF-D", "Design Analysis", "", "", "DCP");
        //        e.AddequipmentmodelRow(4, "MCF-V", "Vitel", "", "", "DCP");
        //        e.AddequipmentmodelRow(5, "CR1000", "CSV", "", "", "TransportMedium");



        //        ep.AddequipmentpropertyRow(1, "DataOrder", "D");
        //        ep.AddequipmentpropertyRow(2, "DataOrder", "A");
        //        ep.AddequipmentpropertyRow(3, "DataOrder", "D");
        //        ep.AddequipmentpropertyRow(4, "DataOrder", "D");
        //        ep.AddequipmentpropertyRow(5, "DataOrder", "A");


        //}

        public static void UpdateServer(PostgreSQL svr, DecodesDataSet decodes)
        {
            foreach (var tableName in tableNames)
            {
                Console.Write("Saving " + tableName);
                var c = svr.SaveTable(decodes.Tables[tableName]);
                Console.WriteLine(" " + c.ToString() + " records");
            }
        }
Пример #4
0
 public McfDecodesConverter(PostgreSQL svr, McfDataSet mcf, DecodesDataSet decodes,
                            string[] siteList)
 {
     m_siteList   = siteList;
     this.svr     = svr;
     this.mcf     = mcf;
     this.decodes = decodes;
     m_converter  = new UnitConversion(mcf, decodes, svr);
 }
Пример #5
0
        public static DecodesDataSet GetDataSet(PostgreSQL svr)
        {
            var ds = new DecodesDataSet();

            for (int i = 0; i < tableNames.Length; i++)
            {
                string sql = "select * from " + tableNames[i];
                var    tbl = ds.Tables[tableNames[i]];
                svr.FillTable(tbl, sql);

                if (tbl.Rows.Count > 0)
                {
                    Console.WriteLine("Notice Existing data. " + tableNames[i] + " has " + tbl.Rows.Count + " rows ");
                }
            }
            return(ds);
        }