private void warningForm_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = System.Drawing.Image.FromFile(@str + "/images/check.png"); this.button2.BackgroundImage = System.Drawing.Image.FromFile(@str + "/images/bjcl.png"); //让默认的日期时间减一天 this.dateTimePicker1.Value = this.dateTimePicker2.Value.AddDays(-1); //查询所有测点或主机编号信息 service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dt1 = cgs.checkcedian(null).Tables[0]; this.comboBox1.DataSource = dt1;//绑定数据源 DataRow newRow; newRow = dt1.NewRow(); newRow["measureMeterCode"] = "0"; newRow["terminalname"] = "全部监测点"; dt1.Rows.Add(newRow); newRow.AcceptChanges(); int DeptIndex = this.comboBox1.FindString("全部监测点"); if (DeptIndex != -1) { this.comboBox1.SelectedIndex = DeptIndex; } this.comboBox1.DisplayMember = "terminalname"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "measureMeterCode"; //操作时获取的值 this.comboBox1.Text = "--请选择--"; }
private void updateUser_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/update.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); ///新增测点权限分配 service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dta = cgs.checkcedianAll(null).Tables[0]; int t = dta.Rows.Count; if (t > 0) { for (int i = 0; i < t; i++) { string tag = dta.Rows[i]["terminalname"].ToString(); if (this.textBox1.Text == dta.Rows[i]["imei"].ToString()) { this.checkedListBox1.Items.Add(tag, true); } else { this.checkedListBox1.Items.Add(tag); } } } }
private void changGuiCheck_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/check.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/close.png"); this.checkBox1.Checked = false; this.tabControl1.TabPages[0].Controls.Clear(); this.tabControl1.TabPages[1].Controls.Clear(); //让默认的日期时间减一天 this.dateTimePicker1.Value = this.dateTimePicker2.Value.AddDays(-1); //查询所有测点或主机编号信息 service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dta = cgs.checkcedianAll(null).Tables[0]; int t = dta.Rows.Count; if (t > 0) { CheckBox[] checkBox = new CheckBox[t]; int p = 10; for (int i = 0; i < t; i++) { checkBox[i] = new CheckBox(); checkBox[i].AutoSize = true; checkBox[i].Text = dta.Rows[i]["terminalname"].ToString(); checkBox[i].Tag = dta.Rows[i]["measureCode"] + "_" + dta.Rows[i]["meterNo"] + "-" + dta.Rows[i]["measureNo"]; checkBox[i].Location = new Point(10, p); this.tabControl1.TabPages[0].Controls.Add(checkBox[i]); p += 20; } checkBox[0].Checked = true; } service.manageHostService mhs = new service.manageHostService(); DataTable dt1 = mhs.queryManageHost(); int t1 = dt1.Rows.Count; if (t1 > 0) { CheckBox[] checkBox = new CheckBox[t1]; int p1 = 10; for (int i = 0; i < t1; i++) { checkBox[i] = new CheckBox(); checkBox[i].AutoSize = true; checkBox[i].Text = dt1.Rows[i]["hostName"].ToString(); //checkBox[i].Tag = dt1.Rows[i]["measureCode"].ToString() + "_" + dt1.Rows[i]["storeType"]; checkBox[i].Tag = dt1.Rows[i]["measureCode"].ToString() + "_" + dt1.Rows[i]["measureNo"]; checkBox[i].Location = new Point(10, p1); checkBox[i].Click += new EventHandler(Clickchecked); this.tabControl1.TabPages[1].Controls.Add(checkBox[i]); p1 += 20; } checkBox[0].Checked = true; } getFromXml(); }
private void comboBox3_SelectionChangeCommitted(object sender, EventArgs e) { string code = this.comboBox3.SelectedValue.ToString(); if (code != null && !"".Equals(code)) { service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dt2 = cgs.checkcedianAll(code).Tables[0]; this.comboBox1.DataSource = dt2; //绑定数据源 this.comboBox1.DisplayMember = "terminalname"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "measureMeterCode"; //操作时获取的值 this.comboBox1.Text = "--请选择--"; } }
private void dataSynchronous_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/assign.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/close.png"); //让默认的日期时间减一天 this.dateTimePicker1.Value = this.dateTimePicker2.Value.AddDays(-1); ipport = getFromXml(); service.changGuicheckService cds = new service.changGuicheckService(); DataTable dta = cds.checkCedianCar().Tables[0]; int t = dta.Rows.Count; if (t > 0) { CheckBox ckb = new CheckBox(); ckb.Text = "全选"; ckb.Checked = true; ckb.Location = new Point(330, 10); ckb.Click += new EventHandler(cbk_Click); this.tabControl1.TabPages[0].Controls.Add(ckb); CheckBox[] checkBox = new CheckBox[t]; int p = 10; for (int i = 0; i < t; i++) { checkBox[i] = new CheckBox(); checkBox[i].AutoSize = true; checkBox[i].Text = dta.Rows[i]["terminalname"].ToString(); string storeType = dta.Rows[i]["storeType"].ToString(); checkBox[i].Tag = dta.Rows[i]["measureCode"] + "-" + dta.Rows[i]["meterNo"]; checkBox[i].Location = new Point(10, p); this.tabControl1.TabPages[0].Controls.Add(checkBox[i]); p += 20; checkBox[i].Checked = true; } } int flag = 3; dtcdinfo = dis.checkPointInfo(flag); }
private void measurePointSetPropert_Load(object sender, EventArgs e) { string str = Application.StartupPath;//项目路径 this.button1.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button2.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); service.houseTypeService hts = new service.houseTypeService(); this.comboBox3.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox3.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox3.ValueMember = "id"; //操作时获取的值 string hcode = this.textBox2.Text; this.button3.BackgroundImage = Image.FromFile(@str + "/images/save.png"); this.button4.BackgroundImage = Image.FromFile(@str + "/images/cancel.png"); this.comboBox1.DataSource = hts.queryhouseType(); //绑定数据源 this.comboBox1.DisplayMember = "name"; //显示给用户的数据集表项 this.comboBox1.ValueMember = "id"; //操作时获取的值 ///新增测点权限分配 service.changGuicheckService cgs = new service.changGuicheckService(); DataTable dta = cgs.checkcedianAll(null).Tables[0]; int t = dta.Rows.Count; if (t > 0) { for (int i = 0; i < t; i++) { string tag = dta.Rows[i]["terminalname"].ToString(); this.checkedListBox1.Items.Add(tag); } } if (hcode != null && !"".Equals(hcode)) { //this.comboBox3.SelectedIndex = Int32.Parse(hcode)-1; this.comboBox3.Text = hcode; this.comboBox1.Text = hcode; } }
/// <summary> /// 数据绑定 /// </summary> private void LoadData() { this.dataGridView1.DataSource = null; service.changGuicheckService cgs = new service.changGuicheckService(); if (pageNo == 0) { //dt = wcs.warningcheckfenyeliutengfei(time1, time2, cd, pagerControl1.PageIndex, pagerControl1.PageSize); //dtcount = cgs.changguicheckliutengfei(time1, // time2, cdlist, measureNolist).Tables[0]; } else { //dtcount = cgs.changguicheckliutengfeiGLZJ(time1, //time2, cdlist, measureNolist).Tables[0]; } pagerControl1.DrawControl(dtcount.Rows.Count);//数据总条数 dt = wcs.warningcheckfenyeliutengfei(time1, time2, "", pagerControl1.PageIndex, pagerControl1.PageSize); if (dt != null && dt.Rows.Count > 0) { int num = dt.Rows.Count; double wd; double sd; double wdsx; double wdxx; double sdsx; double sdxx; string warningTime; int powerwarn = 0; DataView dv = dt.DefaultView;//虚拟视图 dv.Sort = "devtime,measureCode,meterNo asc"; DataTable dts = dv.ToTable(true); this.dataGridView1.DataSource = dts.DefaultView; this.dataGridView1.Columns[0].HeaderCell.Value = "数据采集时间"; this.dataGridView1.Columns[1].HeaderCell.Value = "设备标识名称"; this.dataGridView1.Columns[2].HeaderCell.Value = "管理主机编号"; this.dataGridView1.Columns[3].HeaderCell.Value = "仪表编号"; this.dataGridView1.Columns[4].HeaderCell.Value = "温度"; this.dataGridView1.Columns[5].HeaderCell.Value = "湿度"; this.dataGridView1.Columns[6].HeaderCell.Value = "报警事件"; this.dataGridView1.Columns[7].Visible = false; this.dataGridView1.Columns[8].Visible = false; this.dataGridView1.Columns[9].Visible = false; this.dataGridView1.Columns[10].Visible = false; this.dataGridView1.Columns[11].HeaderCell.Value = "报警处理"; this.dataGridView1.Columns[12].HeaderCell.Value = "温度超标差值"; this.dataGridView1.Columns[13].HeaderCell.Value = "湿度超标差值"; this.dataGridView1.Columns[0].Width = 150; this.dataGridView1.Columns[1].Width = 170; this.dataGridView1.Columns[2].Width = 150; this.dataGridView1.Columns[3].Width = 100; this.dataGridView1.Columns[4].Width = 100; this.dataGridView1.Columns[5].Width = 100; this.dataGridView1.Columns[6].Width = 250; this.dataGridView1.Columns[11].Width = 120; this.dataGridView1.Columns[4].DefaultCellStyle.Format = "0.0"; this.dataGridView1.Columns[5].DefaultCellStyle.Format = "0.0"; this.dataGridView1.Columns[12].DefaultCellStyle.Format = "0.0"; this.dataGridView1.Columns[13].DefaultCellStyle.Format = "0.0"; this.dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Black; this.dataGridView1.AllowUserToAddRows = false; int row = this.dataGridView1.Rows.Count;//得到总行数 for (int i = 0; i < row; i++) { string warningEvent = ""; wd = double.Parse(this.dataGridView1.Rows[i].Cells[4].Value.ToString()); sd = double.Parse(this.dataGridView1.Rows[i].Cells[5].Value.ToString()); string pw = this.dataGridView1.Rows[i].Cells[6].Value.ToString(); if (pw != null && !"".Equals(pw)) { powerwarn = Int32.Parse(pw); if (powerwarn == 1) { warningEvent = "断电报警 "; } } wdsx = double.Parse(this.dataGridView1.Rows[i].Cells[7].Value.ToString()); wdxx = double.Parse(this.dataGridView1.Rows[i].Cells[8].Value.ToString()); sdsx = double.Parse(this.dataGridView1.Rows[i].Cells[9].Value.ToString()); sdxx = double.Parse(this.dataGridView1.Rows[i].Cells[10].Value.ToString()); warningTime = dt.Rows[i][11].ToString(); if (wd > wdsx) { this.dataGridView1.Rows[i].Cells[12].Value = Math.Round(wd - wdsx, 1).ToString("0.0"); this.dataGridView1.Rows[i].Cells[4].Style.ForeColor = Color.Red; warningEvent += "温度上限报警 "; } else if (wd < wdxx) { this.dataGridView1.Rows[i].Cells[12].Value = Math.Round(wd - wdxx, 1).ToString("0.0"); this.dataGridView1.Rows[i].Cells[4].Style.ForeColor = Color.Red; warningEvent += "温度下限报警 "; } else { this.dataGridView1.Rows[i].Cells[12].Value = "0.0"; } if (sd > sdsx) { this.dataGridView1.Rows[i].Cells[13].Value = Math.Round(sd - sdsx, 1).ToString("0.0"); this.dataGridView1.Rows[i].Cells[5].Style.ForeColor = Color.Red; warningEvent += "湿度上限报警 "; } else if (sd < sdxx) { this.dataGridView1.Rows[i].Cells[13].Value = Math.Round(sd - sdxx, 1).ToString("0.0"); this.dataGridView1.Rows[i].Cells[5].Style.ForeColor = Color.Red; warningEvent += "湿度下限报警 "; } else { dt.Rows[i][13] = "0.0"; } if (warningEvent == "") { warningEvent = "解除报警 "; this.dataGridView1.Rows[i].Cells[11].Value = ""; } else { this.dataGridView1.Rows[i].Cells[6].Style.ForeColor = Color.Red; } this.dataGridView1.Rows[i].Cells[6].Value = warningEvent; } for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } } else { MessageBox.Show("当前测点无数据,请重新查询!"); }; }