private void Tree_AddItem_Click(object sender, EventArgs e) { csTreeNodeTag csTNT = m_selTreeNode.Tag as csTreeNodeTag; if (csTNT != null) { frmSettingInfo frm = new frmSettingInfo(); frm.SetStatsInfo(csTNT, 3); frm.SetNewBM(GetNewBM()); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { csTreeNodeTag newTNT = frm.GetStatsInfo(); //添加记录到数据库中 string strSQL = string.Format("insert into {0} values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", m_strTableName, newTNT.strID, newTNT.strBM, newTNT.strName, newTNT.strPID, newTNT.strZBLX, newTNT.strSTATSTable, newTNT.strShowUnit); if (DbHelperOra.ExecuteSql(DbHelperOra.connectionString_172, strSQL) > 0) { TreeNode tNode = m_selTreeNode.Nodes.Add(newTNT.strName); tNode.Tag = newTNT; } } } }
private void Tree_ModifyItem_Click(object sender, EventArgs e) { csTreeNodeTag csTNT = m_selTreeNode.Tag as csTreeNodeTag; if (csTNT != null) { frmSettingInfo frm = new frmSettingInfo(); frm.SetStatsInfo(csTNT, 2); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { csTreeNodeTag newTNT = frm.GetStatsInfo(); //更新记录 string strSQL = string.Format("update {0} set (ID,ZBBM,ZBMC,PID,ZBLX,STATS_TABLE,STATS_UNIT) = ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}'))", m_strTableName, newTNT.strID, newTNT.strBM, newTNT.strName, newTNT.strPID, newTNT.strZBLX, newTNT.strSTATSTable, newTNT.strShowUnit); if (DbHelperOra.ExecuteSql(DbHelperOra.connectionString_172, strSQL) > 0) { //TreeNode tNode = m_selTreeNode.Nodes.Add(newTNT.strName); m_selTreeNode.Tag = newTNT; } } } }
private void Tree_ViewItem_Click(object sender, EventArgs e) { if (m_selTreeNode != null) { csTreeNodeTag csTNT = m_selTreeNode.Tag as csTreeNodeTag; if (csTNT != null) { frmSettingInfo frm = new frmSettingInfo(); frm.SetStatsInfo(csTNT, 1); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { } } } }