コード例 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                string queryString  = string.Empty;
                string updatestring = string.Empty;
                queryString = "select SysId from SysArm where IsUse = '1' order by cast(SysId as int) asc";
                DataTable dt = CommonlyFunctions.getSchedue(queryString);

                if (dt.Rows.Count > 0)
                {
                    updatestring = "update SysOneLoad set LightingMin = (LightingMin + 1)  where IsUse ='1' and LoadStatus='1' and (";
                    if (dt.Rows.Count == 1)
                    {
                        updatestring += " ArmId =  '" + dt.Rows[0][0].ToString() + "')";
                    }
                    else
                    {
                        for (int i = 0; i < dt.Rows.Count - 1; i++)
                        {
                            updatestring += " ArmId =  '" + dt.Rows[i][0].ToString() + "' or ";
                        }
                        updatestring += " ArmId =  '" + dt.Rows[dt.Rows.Count - 1][0].ToString() + "')";
                    }
                    CommonlyFunctions.UpdateLightTime(updatestring);
                }
            }
            catch (Exception ex)
            {
                CommonlyFunctions.insertlog(Guid.NewGuid().ToString(), "-", "0", "更新OPIU点灯时间异常", DateTime.Now, "-", "-", ex.Message.ToString());
            }
        }
コード例 #2
0
        private void ini()
        {
            string queryString = "select SysId,IpAddr,ArmName from SysArm where IsUse = '1' order by cast(SysId as int) asc";

            dt = CommonlyFunctions.getSchedue(queryString);

            Ping ping = new Ping();

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string    ip        = dt.Rows[i][1].ToString();
                    PingReply pingReply = ping.Send(ip);
                    if (pingReply.Status == IPStatus.Success)
                    {
                        Thread matchthread = new Thread(new ParameterizedThreadStart(match));
                        matchthread.IsBackground = true;
                        matchthread.Start(i);
                    }
                }
            }

            Thread t = new Thread(PingOpiu);

            t.IsBackground = true;
            t.Start();
        }