private void button1_Click(object sender, EventArgs e) { con_ndt myObj = new con_ndt(); _UserID = loginfrm.UserID; myObj.UserID = UserID; myObj.ndt_no = ndtno.Text; if (whichBtn == true) { myObj.Addndtno(); MessageBox.Show("添加成功!"); } else { _ndt_id = mainfrm.ndt_id; myObj.ndt_id = ndt_id; myObj.Updatendtno(); MessageBox.Show("更改成功!"); } }
private void 修改工程编号ToolStripMenuItem1_Click(object sender, EventArgs e) { System.Windows.Forms.DialogResult dr; dr = MessageBox.Show(this, "删除工程编号会将工程所有内容删除!确定要删除吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); switch (dr) { case System.Windows.Forms.DialogResult.Yes: con_ndt myObj = new con_ndt(); _ndt_no = this.tvndtlist.SelectedNode.Text; _UserID = loginfrm.UserID; myObj.UserID = UserID; myObj.ndt_no = ndt_no; myObj.Deletendt(); MessageBox.Show("删除成功"); this.tvndtlist.SelectedNode.Remove(); break; } }
//鼠标单击树节点发生 private void tvndtlist_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { con_ndt myObj = (con_ndt)e.Node.Tag; lvndtdes.Items.Clear(); con_ndt myPerson = new con_ndt(); OleDbDataReader myReader = myPerson.GetAllCONNDTDR(myObj.ndt_id); //得到ndt_id _ndt_id = (int)myObj.ndt_id; while (myReader.Read()) { ListViewItem myItem = new ListViewItem(); myItem.Text = myReader["ndt_name"].ToString(); myItem.ImageIndex = 0; myItem.SubItems.Add(myReader["ndt_sjdw"].ToString()); myItem.SubItems.Add(myReader["ndt_jsr"].ToString()); lvndtdes.Items.Add(myItem); } myReader.Close(); }
//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 timer1_Tick(object sender, EventArgs e) { con_ndt myObj = new con_ndt(); tvndtlist.Nodes.Clear(); _UserID = loginfrm.UserID; myObj.UserID = UserID; OleDbDataReader myReader = myObj.GetAllCONNDTDR(); while (myReader.Read()) { //先清除原先加载的,防止重复加载 TreeNode myNode = new TreeNode(myReader["ndt_no"].ToString(), 1, 2); con_ndt myCat = new con_ndt(); myCat.ndt_id = (int)myReader["ndt_id"]; myCat.ndt_no = myReader["ndt_no"].ToString(); myNode.Tag = myCat; tvndtlist.Nodes.Add(myNode); } myReader.Close(); //注意修改状态!! this.timer1.Enabled = false; }
//listview右击事件判断 private void lvndtdes_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { con_ndt myObj = new con_ndt(); myObj.UserID = loginfrm.UserID; if (lvndtdes.SelectedIndices != null && lvndtdes.SelectedIndices.Count > 0) { //listview添加右键菜单 lvndtdes.ContextMenuStrip = contextMenuStrip2; ListView.SelectedIndexCollection c = lvndtdes.SelectedIndices; myObj.ndt_name = lvndtdes.Items[c[0]].Text; //myObj.Name = lvPerson.Items[(int)lvPerson.SelectedIndices[1]].Text; //myObj.Tel = lvPerson.Items[(int)lvPerson.SelectedIndices[0]].SubItems[1].Text; //myObj.QQ = lvPerson.Items[(int)lvPerson.SelectedIndices[0]].SubItems[2].Text; myObj.ndt_id = ndt_id; } } }
private void con_no_Load(object sender, EventArgs e) { if (whichBtn == true) { button1.Text = "添加工程编号"; this.Text = "添加工程编号"; } else { con_ndt myobj=new con_ndt(); myobj.ndt_id=mainfrm.ndt_id; _ndt_no = myobj.Getndtno(); ndtno.Text = ndt_no; this.Text = "修改工程编号"; button1.Text = "修改工程编号"; } }
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("修改成功!"); } }
private void addconndt_Load(object sender, EventArgs e) { //加载分类 con_ndt myCats = new con_ndt(); _UserID = loginfrm.UserID; myCats.UserID = UserID; if (whichBtn == true) { button1.Text = "添加委托"; this.Text = "添加委托"; } else { ndtno.ReadOnly = true; this.Text = "修改委托"; button1.Text = "修改委托"; //在文本框中赋值 con_ndt myPerson = new con_ndt(); _ndt_id= mainfrm.ndt_id; myPerson.ndt_id = ndt_id; OleDbDataReader myReader = myPerson.GetAllconndt(); while (myReader.Read()) { _ndt_no = myReader["ndt_no"].ToString(); _ndt_wtrq = myReader["ndt_wtrq"].ToString(); _ndt_sjdw = myReader["ndt_sjdw"].ToString(); _ndt_wtr = myReader["ndt_wtr"].ToString(); _ndt_sjdwdz = myReader["ndt_sjdwdz"].ToString(); _ndt_tel = myReader["ndt_tel"].ToString(); _ndt_name = myReader["ndt_name"].ToString(); _ndt_jsdw = myReader["ndt_jsdw"].ToString(); _ndt_gcbh = myReader["ndt_gcbh"].ToString(); _ndt_fgcmc = myReader["ndt_fgcmc"].ToString(); _ndt_fgcbh = myReader["ndt_fgcbh"].ToString(); _ndt_gclb = myReader["ndt_gclb"].ToString(); _ndt_jjlx = myReader["ndt_jjlx"].ToString(); _ndt_jjgg = myReader["ndt_jjgg"].ToString(); _ndt_jjjb = myReader["ndt_jjjb"].ToString(); _ndt_cz = myReader["ndt_cz"].ToString(); _ndt_jcsj = myReader["ndt_jcsj"].ToString(); _ndt_hflx = myReader["ndt_hflx"].ToString(); _ndt_hjfs = myReader["ndt_hjfs"].ToString(); _ndt_pkxs = myReader["ndt_pkxs"].ToString(); _ndt_bmzl = myReader["ndt_bmzl"].ToString(); _ndt_jjcs = myReader["ndt_jjcs"].ToString(); _ndt_zjy = myReader["ndt_zjy"].ToString(); _ndt_jcxm = myReader["ndt_jcxm"].ToString(); _ndt_jcbz = myReader["ndt_jcbz"].ToString(); _ndt_hejb = myReader["ndt_hejb"].ToString(); _ndt_jcbi = myReader["ndt_jcbi"].ToString(); _ndt_jcsl = myReader["ndt_jcsl"].ToString(); _ndt_wcrq = myReader["ndt_wcrq"].ToString(); _ndt_sm = myReader["ndt_sm"].ToString(); _ndt_jsr = myReader["ndt_jsr"].ToString(); _ndt_jsrq = myReader["ndt_jsrq"].ToString(); ndtno.Text=ndt_no; ndtwtrq.Text=ndt_wtrq; ndtsjdw.Text = ndt_sjdw; ndtwtr.Text = ndt_wtr; ndttel.Text = ndt_tel; ndtname.Text = ndt_name; ndtjsdw.Text = ndt_jsdw; ndtgcbh.Text = ndt_gcbh; ndtfgcmc.Text = ndt_fgcmc; ndtfgcbh.Text = ndt_fgcbh; ndtgclb.Text = ndt_gclb; ndtjjlx.Text = ndt_jjlx; ndtjjgg.Text = ndt_jjgg; ndtjjjb.Text = ndt_jjjb; ndtcz.Text = ndt_cz; ndtjcsj.Text = ndt_jcsj; ndthflx.Text = ndt_hflx; ndthjfs.Text = ndt_hjfs; ndtpkxs.Text = ndt_pkxs; ndtbmzl.Text = ndt_bmzl; ndtjjcs.Text = ndt_jjcs; ndtzjy.Text = ndt_zjy; ndtjcxm.Text = ndt_jcxm; ndtjcbz.Text = ndt_jcbz; ndthejb.Text = ndt_hejb; ndtjcbi.Text = ndt_jcbi; ndtjcsl.Text = ndt_jcsl; ndtwcrq.Text = ndt_wcrq; ndtsm.Text = ndt_sm; ndtjsr.Text = ndt_jsr; ndtjsrq.Text = ndt_jsrq; } } }