Exemple #1
0
        public void SendMeterEventResponse(DataTable dtmain)
        {
            MeterEventResponseAmiV1 msg = new MeterEventResponseAmiV1();

            if (dtmain != null)
            {
                msg.MeterResponses = new List <MeterResponseAmiV1>();
                //callIndex = 0;
                if (callIndex >= dtmain.Rows.Count)
                {
                    callIndex = 0;
                    // sts = false;
                    // return;
                }
                for (int i = 0; i < dtmain.Rows.Count; i++)
                {
                    MeterResponseAmiV1 call = new MeterResponseAmiV1()
                    {
                        MeterId        = dtmain.Rows[i]["MeterId"].ToString(),
                        IsIn           = Convert.ToBoolean(dtmain.Rows[i]["PowerIn"]),
                        IsOut          = Convert.ToBoolean(dtmain.Rows[i]["PowerOut"]),
                        QueryTimeStamp = Convert.ToDateTime(dtmain.Rows[i]["PowerTime"].ToString()),
                        TimeReported   = DateTime.Now
                    };
                    //update Update_Notify
                    Hashtable hTable = new Hashtable();
                    hTable.Add("@ID", dtmain.Rows[i]["TId"].ToString());
                    int res = clsdb.ExecuteNonQuery("Update_Notify", hTable);
                    if (res > 0)
                    {
                    }

                    msg.UpToTimeStamp = DateTime.Now;
                    msg.MeterResponses.Add(call);
                    msg.Sequence = _sequence++;
                    // Call the CallConnector to send the message to server
                    //sts = false;
                    callIndex++;  // mark the next call Index
                }
            }
            callConnector.SendMessageToIdms(msg);
            createTestLogFile("MeterEventQueryAmiV1 -  meter event response to call server sent completed");
            //}
            //else
            //{
            //    if (!sts)
            //    {
            //        // MeterResponseAmiV1 call = new MeterResponseAmiV1();
            //        // msg.MeterResponses.Add(call);
            //        msg.Sequence = _sequence++;
            //        callConnector.SendMessageToIdms(msg);
            //    }
            //}
            //callIndex++;  // mark the next call Index

            // Create a Meter Status out message
            // This will be shows in NetClient as red round marker around the Customer to indicate the Meter is out.
            // To verify, copy and paste the following url in the NetClient viewer
            // NETVIEW://RT/VIEW/DETAIL/RAVEN?ZOOM=15.4730346034505&X=940905.512911328&Y=813055.594137977&FORCENONMAINON&AUTOLABELS&ADJACENT=1&SHOWPOTENTIALFAULTHALOS&CUSTOMERLAYERS=(ALL)&CREWLAYERS=(ALL)&FLTINDHALOS=(BOTH)
            //MeterStatusAmiV1 meterStatusAmi = new MeterStatusAmiV1()
            //{

            //    MeterId = ConfigurationManager.AppSettings["MeterId"].ToString(),
            //    Status = (int)eAmiQueryResult.Out,
            //    LastCommunicationTime = DateTime.Now
            //};

            // msg.MeterStatuses.Add(meterStatusAmi);
            //msg.Sequence = _sequence++;
            //callConnector.SendMessageToIdms(msg);   // Call the CallConnector to send the message to server
        }