public void updateItem(object textBox1, object textBox2, object textBox3, object textBox4, object itemId, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.updateItem(textBox1, textBox2, textBox3, textBox4, itemId, connection); }
private void checkItemIfExists(object itemName, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.checkItemIfExists(itemName, connection); }
public void incQuantityOfItem(object itemId, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.incQuantityOfItem(itemId, connection); }
public void removeItem(object itemId, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.deleteItem(itemId, connection); }
public void addsale(object itemid, object itemname, object itemdesc, object itemprice, object itemquant, object totalprice,object employee, object date, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.addsale(itemid, itemname, itemdesc, itemprice, itemquant, totalprice, employee, date, connection); }
public void decQuantityOfItem(object itemId, object quantity, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.decQuantityOfItem(itemId, quantity, connection); }
public void addItemDate(object selectedIndex, object supplier, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.insertItemDate(selectedIndex, supplier, connection); }
public void addItem() { Database db = new Database(); db.insertItem(this.itemName, this.itemDesc, this.itemPrice, this.itemQty, this.connection); }
private void shujuchuanshu() { Database db = new Database(); //string s = "CC 40 24 40 00 40 23 50 20 BB BB BB BB FF FF FF FF FF FF 60 70 BB BB BB BB FF FF FF FF FF FF 50 21 BB BB BB BB FF FF FF FF FF FF 70 00 70 05 BB BB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 60 32 BB BB BB BB F6 0E"; //s = s.Replace("\r", ""); //s = s.Replace("\n", ""); //s = s.Replace(" ", ""); String s = jieshou; DataTable dt = new DataTable("Table_AX"); dt.Columns.Add("dtype", System.Type.GetType("System.Int32")); dt.Columns.Add("data1", System.Type.GetType("System.Double")); dt.Columns.Add("data2", System.Type.GetType("System.Double")); dt.Columns.Add("data3", System.Type.GetType("System.Double")); dt.Columns.Add("传感器编号", System.Type.GetType("System.String")); //System.String dt.Columns.Add("观测时间", System.Type.GetType("System.DateTime")); for (int i = 2; i < s.Length - 5; i += 12) { // int flag = 1; DataRow dr = dt.NewRow(); if (s[i].Equals('F')) { dr["dtype"] = 0; dr["传感器编号"] = 0; dr["data1"] = -1; dr["data2"] = -1; dr["data3"] = -1; } else { dr["dtype"] = int.Parse(s[i].ToString()); string s1 = s.Substring(i + 1, 2) + "." + s.Substring(i + 3, 1); dr["data1"] = double.Parse(s1); // dr["传感器编号"] = Convert.ToString(flag) + "-" + s[i].ToString() + "-" + Convert.ToString(flagshunxu); ; dr["传感器编号"] = Convert.ToString(flag) + "-" + Convert.ToString(flagshunxu); if (s[i + 4].Equals('B')) dr["data2"] = -1; else { string s2 = s.Substring(i + 5, 2) + "." + s.Substring(i + 7, 1); dr["data2"] = double.Parse(s2); } if (s[i + 8].Equals('B')) dr["data3"] = -1; else { string s3 = s.Substring(i + 9, 2) + "." + s.Substring(i + 11, 1); dr["data3"] = double.Parse(s3); } } if (flagshunxu < 20) { flagshunxu++; } else { flagshunxu = 1; } // dr["传感器编号"] = "1号"; dr["观测时间"] = DateTime.Now; dt.Rows.Add(dr); } // DataSet ds = new DataSet(); // DataTable newdt = ds.Tables.Add(); DataTable newdt = new DataTable(); newdt = dt.Clone(); // dataGridView1.DataSource = dt; DataRow[] rows = dt.Select("dtype=4 or dtype=5 or dtype=6 or dtype=7 "); // 从dt 中查询符合条件的记录; DateTime dtime = DateTime.Now; string sql = ""; foreach (DataRow row in rows) // 将查询的结果添加到dt中; { newdt.Rows.Add(row.ItemArray); } // dataGridView2.DataSource = newdt; //-------------------实时显示部分代码--------------- //DataTable dt2 = new DataTable();//传感器数据表 //dt2.Columns.Add("传感器编号", typeof(string)); //dt2.Columns.Add("类型Num", typeof(int)); //dt2.Columns.Add("时间", typeof(DateTime)); //dt2.Columns.Add("data1", typeof(Double)); //dt2.Columns.Add("data2", typeof(Double)); //dt2.Columns.Add("data3", typeof(Double)); //DataRow dr4dt2 = dt2.NewRow(); //-------------------实时显示部分代码--------------- foreach (DataRow row in newdt.Rows) { // SQL写入状态.Text = ""; int i = (int)row["dtype"]; switch (i) { case 4: sql = "insert into 支柱压力传感器信息表(支柱压力观测时间,支柱压力传感器编号,顶板通道data1,顶板通道data2,顶板通道data3) values ('" + dtime + "','" + row["传感器编号"] + "','" + row["data1"] + "','" + row["data2"] + "','" + row["data3"] + "')"; //-------------实时显示部分------------------ //dr4dt2["传感器编号"] = ""; //dr4dt2["类型Num"] = 4; //dr4dt2["时间"] = dtime; //dr4dt2["data1"] = row["顶板通道data1"]; //dr4dt2["data2"] = row["顶板通道data2"]; //dr4dt2["data3"] = row["顶板通道data3"]; //dt2.Rows.Add(dr4dt2); // fp.realtimedis(dt2); //-------------实时显示部分------------------ break; case 5: sql = "insert into 钻孔应力传感器信息表(钻孔应力传感器编号,钻孔应力观测时间,钻孔应力data) values ('" + row["传感器编号"] + "','" + dtime + "','" + row["data1"] + "')"; break; case 6: sql = "insert into 锚杆锚索传感器信息表(锚杆锚索传感器编号,锚杆锚索观测时间,锚杆锚索data) values ('" + row["传感器编号"] + "','" + dtime + "','" + row["data1"] + "')"; break; case 7: sql = "insert into 顶板离层传感器信息表(顶板离层观测时间,顶板离层传感器编号,离层data1,离层data2) values ('" + dtime + "','" + row["传感器编号"] + "','" + row["data1"] + "','" + row["data2"] + "')"; break; default: sql = ""; break; } if (sql.Equals("")) return; try { int res = db.zsg_date(sql); sql = ""; if (res >= 0) SQL写入状态.Text = "Data写入数据库" + "-分站:" + flag + "-传感器类型:" + i; } catch(Exception ex) { 数据异常处理.Text = "有相应测点数据没读入,请查看:" + "\n" + "-分站:" + flag + "-传感器类型:" + i; SQL写入状态.Text = ""; // MessageBox.Show(ex.Message.ToString() + "分站:" + i); } finally { } // MessageBox.Show("传输成功!"); // fp.realtimedis(dt2); } Tools.Alarming(newdt); if (RPIMS数据采集及管理系统.isChecked == true) { fp.realtimedis(newdt); } if (RPIMS数据采集及管理系统.vd != null) RPIMS数据采集及管理系统.vd.showdata_live(newdt); if (RPIMS数据采集及管理系统.df != null) RPIMS数据采集及管理系统.df.Dynamicdata_show(newdt); // dataGridView1.DataSource = newdt; }
public void removeSupplier(object id, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.deleteSupplier(id, connection); }
public void addSupplier(object textBox1, object textBox2, object textBox3, object textBox4, System.Data.SqlClient.SqlConnection connection) { Database db = new Database(); db.insertSupplier(textBox1, textBox2, textBox3, textBox4, connection); }