Ejemplo n.º 1
0
Archivo: Class1.cs Proyecto: wpmyj/c3
        public override void OnProcess(ITask task, IParseResult pr)
        {
            if (pr.IsSuccess)
            {
                if (StringHelper.Equal(task.Opera.Name, "ReadReal"))
                {
                    Xd202Data data = new Xd202Data();

                    data.BeforeWL       = Convert.ToDouble(task.LastParseResult.Results["BeforeWL"]);
                    data.BehindWL       = Convert.ToDouble(task.LastParseResult.Results["BehindWL"]);
                    data.Height         = Convert.ToDouble(task.LastParseResult.Results["Height"]);
                    data.InstantFlux    = Convert.ToDouble(task.LastParseResult.Results["IF"]);
                    data.RemainedAmount = Convert.ToDouble(task.LastParseResult.Results["RemainedAmount"]);
                    data.UsedAmount     = 0 - data.RemainedAmount;

                    data.BeforeWL = CM2M(data.BeforeWL);
                    data.BehindWL = CM2M(data.BehindWL);
                    data.Height   = CM2M(data.Height);

                    task.Device.DeviceDataManager.Last = data;

                    int id = GuidHelper.ConvertToInt32(task.Device.Guid);
                    DBI.Instance.InsertXd202Data(id, data);
                }
            }
        }
Ejemplo n.º 2
0
Archivo: Class1.cs Proyecto: hkiaipc/C3
        /// <summary>
        /// 
        /// </summary>
        /// <param name="deviceID"></param>
        /// <param name="data"></param>
        public void InsertXd202Data(int deviceID, Xd202Data data)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = @"INSERT INTO tblMeasureSluiceData(
            [DeviceID], [DT], [BeforeWL], [BehindWL], [InstantFlux], [Height], [RemainedAmount], [UsedAmount])
            VALUES(
            @DeviceID, @DT, @BeforeWL, @BehindWL, @InstantFlux, @Height, @RemainedAmount, @UsedAmount)";

            DBIBase.AddSqlParameter(cmd, "deviceID", deviceID);
            DBIBase.AddSqlParameter(cmd, "dt", data.DT);
            DBIBase.AddSqlParameter(cmd, "BeforeWL", data.BeforeWL);
            DBIBase.AddSqlParameter(cmd, "BehindWL", data.BehindWL);
            DBIBase.AddSqlParameter(cmd, "InstantFlux", data.InstantFlux);
            DBIBase.AddSqlParameter(cmd, "Height", data.Height);
            DBIBase.AddSqlParameter(cmd, "RemainedAmount", data.RemainedAmount);
            DBIBase.AddSqlParameter(cmd, "UsedAmount", data.UsedAmount);
            ExecuteScalar(cmd);
        }
Ejemplo n.º 3
0
Archivo: Class1.cs Proyecto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="deviceID"></param>
        /// <param name="data"></param>
        public void InsertXd202Data(int deviceID, Xd202Data data)
        {
            string sql = @"INSERT INTO tblMeasureSluiceData(
[DeviceID], [DT], [BeforeWL], [BehindWL], [InstantFlux], [Height], [RemainedAmount], [UsedAmount])
VALUES(
@DeviceID, @DT, @BeforeWL, @BehindWL, @InstantFlux, @Height, @RemainedAmount, @UsedAmount)";

            ListDictionary listDict = new ListDictionary();

            //listDict.Add ( 1,2);
            listDict.Add("deviceID", deviceID);
            listDict.Add("dt", data.DT);
            listDict.Add("BeforeWL", data.BeforeWL);
            listDict.Add("BehindWL", data.BehindWL);
            listDict.Add("InstantFlux", data.InstantFlux);
            listDict.Add("Height", data.Height);
            listDict.Add("RemainedAmount", data.RemainedAmount);
            listDict.Add("UsedAmount", data.UsedAmount);
            //ExecuteScalar(cmd);
            ExecuteScalar(sql, listDict);
        }
Ejemplo n.º 4
0
Archivo: Class1.cs Proyecto: hkiaipc/C3
        public override void OnProcess(ITask task, IParseResult pr)
        {
            if (pr.IsSuccess)
            {
                if (StringHelper.Equal(task.Opera.Name, "ReadReal"))
                {
                    Xd202Data data = new Xd202Data();

                    data.BeforeWL = Convert.ToDouble(task.LastParseResult.Results["BeforeWL"]);
                    data.BehindWL = Convert.ToDouble(task.LastParseResult.Results["BehindWL"]);
                    data.Height = Convert.ToDouble(task.LastParseResult.Results["Height"]);
                    data.InstantFlux = Convert.ToDouble(task.LastParseResult.Results["IF"]);
                    data.RemainedAmount = Convert.ToDouble(task.LastParseResult.Results["RemainedAmount"]);
                    data.UsedAmount = 0 - data.RemainedAmount;

                    data.BeforeWL = CM2M(data.BeforeWL);
                    data.BehindWL = CM2M(data.BehindWL);
                    data.Height = CM2M(data.Height);

                    task.Device.DeviceDataManager.Last = data;

                    int id = GuidHelper.ConvertToInt32(task.Device.Guid);
                    DBI.Instance.InsertXd202Data(id, data);
                }
            }
        }