//treeview判断右键 打开窗口修改分组名 private void tvndtlist_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (tvndtlist.SelectedNode == null) { tvndtlist.ContextMenuStrip = null; //return; } else { //treeview添加右键菜单 tvndtlist.ContextMenuStrip = contextMenuStrip1; _ndt_no = this.tvndtlist.SelectedNode.Text; _UserID = loginfrm.UserID; con_ndt myObj = new con_ndt(); myObj.UserID = UserID; myObj.ndt_no = ndt_no; _ndt_id = myObj.ndtid(); } } }
private void button1_Click(object sender, EventArgs e) { if (whichBtn == true) { con_ndt myObj = new con_ndt(); _ndt_no = ndtno.Text; _ndt_wtrq = ndtwtrq.Text; _ndt_sjdw = ndtsjdw.Text; _ndt_wtr = ndtwtr.Text; _ndt_tel = ndttel.Text; _ndt_name = ndtname.Text; _ndt_jsdw = ndtjsdw.Text; _ndt_gcbh = ndtgcbh.Text; _ndt_fgcmc = ndtfgcmc.Text; _ndt_fgcbh = ndtfgcbh.Text; _ndt_gclb = ndtgclb.Text; _ndt_jjlx = ndtjjlx.Text; _ndt_jjgg = ndtjjgg.Text; _ndt_jjjb = ndtjjjb.Text; _ndt_cz = ndtcz.Text; _ndt_jcsj = ndtjcsj.Text; _ndt_hflx = ndthflx.Text; _ndt_hjfs = ndthjfs.Text; _ndt_pkxs = ndtpkxs.Text; _ndt_bmzl = ndtbmzl.Text; _ndt_jjcs = ndtjjcs.Text; _ndt_zjy = ndtzjy.Text; _ndt_jcxm = ndtjcxm.Text; _ndt_jcbz = ndtjcbz.Text; _ndt_hejb = ndthejb.Text; _ndt_jcbi = ndtjcbi.Text; _ndt_jcsl = ndtjcsl.Text; _ndt_wcrq = ndtwcrq.Text; _ndt_sm = ndtsm.Text; _ndt_jsr = ndtjsr.Text; _ndt_jsrq = ndtjsrq.Text; myObj.UserID = UserID; myObj.ndt_no = ndt_no; myObj.ndt_wtrq = ndt_wtrq; myObj.ndt_sjdw = ndt_sjdw; myObj.ndt_wtr = ndt_wtr; myObj.ndt_sjdwdz = ndt_sjdwdz; myObj.ndt_tel = ndt_tel; myObj.ndt_name = ndt_name; myObj.ndt_jsdw = ndt_jsdw; myObj.ndt_gcbh = ndt_gcbh; myObj.ndt_fgcmc = ndt_fgcmc; myObj.ndt_fgcbh = ndt_fgcbh; myObj.ndt_gclb = ndt_gclb; myObj.ndt_jjlx = ndt_jjlx; myObj.ndt_jjgg = ndt_jjgg; myObj.ndt_jjjb = ndt_jjjb; myObj.ndt_cz = ndt_cz; myObj.ndt_jcsj = ndt_jcsj; myObj.ndt_hflx = ndt_hflx; myObj.ndt_hjfs = ndt_hjfs; myObj.ndt_pkxs = ndt_pkxs; myObj.ndt_bmzl = ndt_bmzl; myObj.ndt_jjcs = ndt_jjcs; myObj.ndt_zjy = ndt_zjy; myObj.ndt_jcxm = ndt_jcxm; myObj.ndt_jcbz = ndt_jcbz; myObj.ndt_hejb = ndt_hejb; myObj.ndt_jcbi = ndt_jcbi; myObj.ndt_jcsl = ndt_jcsl; myObj.ndt_wcrq = ndt_wcrq; myObj.ndt_sm = ndt_sm; myObj.ndt_jsr = ndt_jsr; myObj.ndt_jsrq = ndt_jsrq; myObj.Addcon_ndt(); MessageBox.Show("添加成功"); } else { con_ndt myCats = new con_ndt(); _ndt_no = ndtno.Text; _UserID = loginfrm.UserID; myCats.ndt_no = ndt_no; myCats.UserID = UserID; _ndt_id = myCats.ndtid(); con_ndt myPerson = new con_ndt(); _ndt_no = ndtno.Text; _ndt_wtrq = ndtwtrq.Text; _ndt_sjdw = ndtsjdw.Text; _ndt_wtr = ndtwtr.Text; _ndt_tel = ndttel.Text; _ndt_name = ndtname.Text; _ndt_jsdw = ndtjsdw.Text; _ndt_gcbh = ndtgcbh.Text; _ndt_fgcmc = ndtfgcmc.Text; _ndt_fgcbh = ndtfgcbh.Text; _ndt_gclb = ndtgclb.Text; _ndt_jjlx = ndtjjlx.Text; _ndt_jjgg = ndtjjgg.Text; _ndt_jjjb = ndtjjjb.Text; _ndt_cz = ndtcz.Text; _ndt_jcsj = ndtjcsj.Text; _ndt_hflx = ndthflx.Text; _ndt_hjfs = ndthjfs.Text; _ndt_pkxs = ndtpkxs.Text; _ndt_bmzl = ndtbmzl.Text; _ndt_jjcs = ndtjjcs.Text; _ndt_zjy = ndtzjy.Text; _ndt_jcxm = ndtjcxm.Text; _ndt_jcbz = ndtjcbz.Text; _ndt_hejb = ndthejb.Text; _ndt_jcbi = ndtjcbi.Text; _ndt_jcsl = ndtjcsl.Text; _ndt_wcrq = ndtwcrq.Text; _ndt_sm = ndtsm.Text; _ndt_jsr = ndtjsr.Text; _ndt_jsrq = ndtjsrq.Text; myPerson.ndt_id = ndt_id; myPerson.ndt_no = ndt_no; myPerson.ndt_wtrq = ndt_wtrq; myPerson.ndt_sjdw = ndt_sjdw; myPerson.ndt_wtr = ndt_wtr; myPerson.ndt_sjdwdz = ndt_sjdwdz; myPerson.ndt_tel = ndt_tel; myPerson.ndt_name = ndt_name; myPerson.ndt_jsdw = ndt_jsdw; myPerson.ndt_gcbh = ndt_gcbh; myPerson.ndt_fgcmc = ndt_fgcmc; myPerson.ndt_fgcbh = ndt_fgcbh; myPerson.ndt_gclb = ndt_gclb; myPerson.ndt_jjlx = ndt_jjlx; myPerson.ndt_jjgg = ndt_jjgg; myPerson.ndt_jjjb = ndt_jjjb; myPerson.ndt_cz = ndt_cz; myPerson.ndt_jcsj = ndt_jcsj; myPerson.ndt_hflx = ndt_hflx; myPerson.ndt_hjfs = ndt_hjfs; myPerson.ndt_pkxs = ndt_pkxs; myPerson.ndt_bmzl = ndt_bmzl; myPerson.ndt_jjcs = ndt_jjcs; myPerson.ndt_zjy = ndt_zjy; myPerson.ndt_jcxm = ndt_jcxm; myPerson.ndt_jcbz = ndt_jcbz; myPerson.ndt_hejb = ndt_hejb; myPerson.ndt_jcbi = ndt_jcbi; myPerson.ndt_jcsl = ndt_jcsl; myPerson.ndt_wcrq = ndt_wcrq; myPerson.ndt_sm = ndt_sm; myPerson.ndt_jsr = ndt_jsr; myPerson.ndt_jsrq = ndt_jsrq; myPerson.Changndt(); MessageBox.Show("修改成功!"); } }