Ejemplo n.º 1
0
        static private VPump100Data[] ConvertToVPump100Datas(DataTable datatable, out int createCount)
        {
            NullOrDBNullConverter nc = new NullOrDBNullConverter(0f);

            createCount = 0;
            List <VPump100Data> list = new List <VPump100Data>();

            foreach (DataRow row in datatable.Rows)
            {
                DateTime dt          = Convert.ToDateTime(row[ColumnNamesForPump.StrTime]);
                float    instantFlux = Convert.ToSingle(nc.Convert(row[ColumnNamesForPump.Flux]));
                float    efficienty  = Convert.ToSingle(nc.Convert(row[ColumnNamesForPump.Efficiency]));
                float    sum         = Convert.ToSingle(nc.Convert(row[ColumnNames.TuWater]));
                float    remain      = Convert.ToSingle(nc.Convert(row[ColumnNames.ReWater]));

                PumpStatus       pumpStatus    = VPumpStatusParser.ParsePumpStatus(row[ColumnNamesForPump.PumpStatus].ToString());
                ForceStartStatus forceStatus   = VPumpStatusParser.ParseForceStartStatus(row[ColumnNamesForPump.ForceRun].ToString());
                VibrateStatus    vibrateStatus = VPumpStatusParser.ParseVibrateStatus(row[ColumnNamesForPump.Vibrate].ToString());
                PumpPowerStatus  powerStatus   = VPumpStatusParser.ParsePowerStatus(row[ColumnNamesForPump.Power].ToString());


                VPump100Data data = new VPump100Data();
                data.DT               = dt;
                data.InstantFlux      = instantFlux;
                data.Efficiency       = efficienty;
                data.TotalAmount      = sum;
                data.RemainAmount     = remain;
                data.PumpStatus       = pumpStatus;
                data.ForceStartStatus = forceStatus;
                data.VibrateStatus    = vibrateStatus;
                data.PowerStatus      = powerStatus;

                list.Add(data);
                if (list.Count >= 5)
                {
                    break;
                }
            }
            createCount = list.Count;
            while (list.Count < 5)
            {
                list.Add(new VPump100Data());
            }
            return(list.ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dataTable"></param>
        /// <param name="createdCount"></param>
        /// <returns></returns>
        static private VGate100Data[] ConvertToVGate100Datas(DataTable dataTable, out int createdCount)
        {
            NullOrDBNullConverter nc = new NullOrDBNullConverter(0f);

            createdCount = 0;

            List <VGate100Data> list = new List <VGate100Data>();

            foreach (DataRow row in dataTable.Rows)
            {
                DateTime dt       = Convert.ToDateTime(row[ColumnNames.StrTime]);
                float    lwBefore = Convert.ToSingle(nc.Convert(row[ColumnNames.BeforeLevel]));
                float    lwBehind = Convert.ToSingle(nc.Convert(row[ColumnNames.BehindLevel]));
                float    height   = Convert.ToSingle(nc.Convert(row[ColumnNames.Height]));
                float    flux     = Convert.ToSingle(nc.Convert(row[ColumnNames.Flux]));
                float    sum      = Convert.ToSingle(nc.Convert(row[ColumnNames.TuWater]));
                float    remain   = Convert.ToSingle(nc.Convert(row[ColumnNames.ReWater]));

                VGate100Data data = new VGate100Data();
                data.DT           = dt;
                data.BeforeWL     = lwBefore;
                data.BehindWL     = lwBehind;
                data.Height       = height;
                data.InstantFlux  = flux;
                data.TotalAmount  = sum;
                data.RemainAmount = remain;

                list.Add(data);
                if (list.Count >= 5)
                {
                    break;
                }
            }
            createdCount = list.Count;

            while (list.Count < 5)
            {
                list.Add(new VGate100Data());
            }
            return(list.ToArray());
        }