/// <summary> /// 修改 /// </summary> private void btnUpdate_Click(object sender, EventArgs e) { string itemcode = ""; DataTable dt_itemcode = new DataTable(); string sql_itemcode = string.Format(@"select D_CODE from JC_HOITEMDICTION where order_id='{0}'", treeView1.SelectedNode.Tag.ToString()); dt_itemcode = InstanceForm._database.GetDataTable(sql_itemcode); if (dt_itemcode != null && dt_itemcode.Rows.Count > 0) { itemcode = dt_itemcode.Rows[0]["D_CODE"].ToString(); } if (this.lvDepartmentInfo.SelectedItems.Count == 0) { MessageBox.Show("您没有选择任何行,请选择某行修改", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } FrmSetJCBW frmsetjcbw = new FrmSetJCBW(this.lvDepartmentInfo.SelectedItems[0].SubItems[0].Text.ToString(), this.lvDepartmentInfo.SelectedItems[0].SubItems[4].Text.ToString(), "Update", this.lvDepartmentInfo.SelectedItems[0].SubItems[1].Text.ToString(), this.lvDepartmentInfo.SelectedItems[0].SubItems[2].Text.ToString(), this.lvDepartmentInfo.SelectedItems[0].SubItems[3].Text.ToString()); frmsetjcbw.ShowDialog(); if (frmsetjcbw.DialogResult == DialogResult.OK) { CheckSiteInfo info = frmsetjcbw.GetCheckSite(); if (info.Checksitename != null) { string sql = string.Format(@"update JC_HOITEMDICTIONCHILD set ORDER_POSITION='{0}',REMAKER='{1}',ORDER_POSITION_CODE='{3}',BW_class='{4}',BW_XS='{5}' where ORDER_POSITION_CODE='{2}' and order_id='{6}' ", info.Checksitename.ToString(), info.Checksiteremarker.ToString(), this.lvDepartmentInfo.SelectedItems[0].SubItems[1].Text.ToString(), info.Checksitecode.ToString(), info.Checksiteclass.ToString(), info.Checksitexs.ToString(), itemcode); int a = Convert.ToInt32(FrmMdiMain.Database.GetDataResult(sql)); if (a == -1) { MessageBox.Show("检查部位修改失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BinderListView(treeView1.SelectedNode.Tag.ToString()); treeView1.SelectedNode.Checked = true; } } } }
/// <summary> ///新增 /// </summary> private void btn_增加_Click(object sender, EventArgs e) { string itemcode = ""; DataTable dt_itemcode = new DataTable(); string sql_itemcode = string.Format(@"select D_CODE from JC_HOITEMDICTION where order_id='{0}'", treeView1.SelectedNode.Tag.ToString()); dt_itemcode = InstanceForm._database.GetDataTable(sql_itemcode); if (dt_itemcode != null && dt_itemcode.Rows.Count > 0) { itemcode = dt_itemcode.Rows[0]["D_CODE"].ToString(); } if (treeView1.SelectedNode.Tag != null) { FrmSetJCBW frmsetjcbw = new FrmSetJCBW("Add"); frmsetjcbw.ShowDialog(); if (frmsetjcbw.DialogResult == DialogResult.OK) { CheckSiteInfo info = frmsetjcbw.GetCheckSite(); if (info.Checksitename != null) { //int a=myQuery.InsertCheckSite(treeView1.SelectedNode.Tag.ToString(),info); string sql = "insert into JC_HOITEMDICTIONCHILD (ORDER_ID,ORDER_POSITION,REMAKER,ORDER_POSITION_CODE,BW_class,BW_XS) VALUES (" + itemcode + ",'" + info.Checksitename + "','" + info.Checksiteremarker + "','" + info.Checksitecode + "','" + info.Checksiteclass + "','" + info.Checksitexs + "')"; int a = Convert.ToInt32(FrmMdiMain.Database.GetDataResult(sql)); if (a == -1) { MessageBox.Show("检查部位增加失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { BinderListView(treeView1.SelectedNode.Tag.ToString()); treeView1.SelectedNode.Checked = true; } } } } }