private void QueryPlc() { if (ah == null) { ah = new ActiveHomeClass(); } for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { string sCode = GetAddress(row, col); object oCode = ah.SendAction("queryplc", sCode + " on", null, null); if (oCode.ToString() == "1") { if (sCode.ToUpper() == TessAddr) { btnL1.Checked = true; } if (sCode.ToUpper() == KirstyAddr) { btnL2.Checked = true; } if (sCode.ToUpper() == LRAddr) { btnL3.Checked = true; } SetColor(sCode, GridView1, "green"); SetTitle(sCode, "Queryplc " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(), GridView1); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.User.Identity.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); } Label1.Text = "Welcome " + Convert.ToString(Session["LoginUserName"]); if (!IsPostBack) { _sampleData = null; GridView1.DataSource = _sampleData; GridView1.DataBind(); InitMessages(); try { ah = new ActiveHomeClass(); //ah.RecvAction += Ah_RecvAction; // get logs from the database instead of polling activehome //QueryPlc(); GetLogs(); QueryDBPlc(); } catch (Exception ex) { AddMessage(ex.Message); } } }
private void SendPlc(string sAddr, string onoff) { if (ah == null) { ah = new ActiveHomeClass(); } ah.SendAction("SENDPLC", sAddr + " " + onoff, null, null); }