private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } Ps_YearRange range = yAnge; TreeListNode focusedNode = treeList1.FocusedNode; //if (focusedNode == null) //{ // return; //} FrmAddBuild frm = new FrmAddBuild(); frm.Conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "' and FromID="; if (frm.ShowDialog() == DialogResult.OK) { Ps_Table_TZGS table_yd = new Ps_Table_TZGS(); table_yd.ID += "|" + GetProjectID; table_yd.Title = frm.ParentName; table_yd.ParentID = "0"; table_yd.Sort = OperTable.GetTZGSMaxSort() + 1; table_yd.ProjectID = GetProjectID; table_yd.Col2 = frm.ParentName; table_yd.Col4 = g_col4; table_yd.FromID = frm.GetV; try { Common.Services.BaseService.Create("InsertPs_Table_TZGS", table_yd); } catch (Exception ex) { MsgBox.Show("增加分类出错:" + ex.Message); } this.Cursor = Cursors.WaitCursor; treeList1.BeginUpdate(); //treeList1.ExpandAll(); LoadData1(); FoucsLocation(table_yd.ID, treeList1.Nodes); treeList1.EndUpdate(); this.Cursor = Cursors.Default; } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } //FindNodes(treeList1.FocusedNode); string parentid = treeList1.FocusedNode["ParentID"].ToString(); if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (parentid == "0") { FrmAddBuild frm = new FrmAddBuild(); //frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; frm.SetLabelName = "分类名称"; frm.GetV = treeList1.FocusedNode.GetValue("FromID").ToString(); frm.Conn = tong + "ParentID='0' and ProjectID='" + GetProjectID + "' and FromID="; frm.BEdit = true; if (frm.ShowDialog() == DialogResult.OK) { Ps_Table_TZGS table1 = new Ps_Table_TZGS(); table1 = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID")); table1.Title = frm.ParentName; table1.FromID = frm.GetV; table1.Col2 = "no"; try { Common.Services.BaseService.Update<Ps_Table_TZGS>(table1); treeList1.FocusedNode.SetValue("Title", frm.ParentName); } catch { } //catch(Exception ex) //{ // MsgBox.Show("修改出错:" + ex.Message); //} } } else { FrmAddTzgsBBPW frm = new FrmAddTzgsBBPW(); Ps_Table_TZGS table = new Ps_Table_TZGS(); table = Common.Services.BaseService.GetOneByKey<Ps_Table_TZGS>(treeList1.FocusedNode.GetValue("ID")); // frm.ParentName = treeList1.FocusedNode.GetValue("Title").ToString(); try { frm.V = int.Parse(treeList1.FocusedNode.GetValue("FromID").ToString()); } catch { } frm.AreaName = treeList1.FocusedNode.GetValue("AreaName").ToString(); frm.ProjectID = ProjectUID; if (treeList1.FocusedNode.GetValue("Col4") != null) { if (treeList1.FocusedNode.GetValue("Col4").ToString() == "line") frm.Line = true; } frm.Text = "修改工程"; frm.StrType = table.Col4; frm.ParentName = table.Title; if (treeList1.FocusedNode.ParentNode!=null) { frm.Stat = treeList1.FocusedNode.ParentNode.GetValue("Col2").ToString(); } frm.BianInfo = table.BianInfo; frm.LineInfo = table.LineInfo; frm.StartYear = table.BuildYear; frm.FinishYear = table.BuildEd; frm.LineLen = table.Length; frm.BieZhu = table.Col1; frm.Col3 = table.Col3; frm.Vol = table.Volumn; frm.TzgsXs = double.Parse(yAngeXs.Col1); frm.DQ = table.DQ; frm.Num1 = table.Num1; frm.Num2 = table.Num2; frm.uid = table.ID; frm.operatorflag = false; if (frm.ShowDialog() == DialogResult.OK) { AddChildVol(table, false); table.Title = frm.ParentName; table.BuildYear = frm.StartYear; table.BuildEd = frm.FinishYear; table.Length = frm.LineLen; table.Volumn = frm.Vol; double temp = frm.AllVol - table.AllVolumn; table.AllVolumn = frm.AllVol; table.AftVolumn += temp; for (int i = yAnge.BeginYear; i <= yAnge.EndYear; i++) { table.GetType().GetProperty("y" + i).SetValue(table, 0, null); } table.GetType().GetProperty("y" + Convert.ToString(frm.FinishYear)).SetValue(table, table.AftVolumn, null); table.Col1 = frm.BieZhu; table.Col3 = frm.Col3; //table.Col4 = frm.StrType; table.BianInfo = frm.BianInfo; table.LineInfo = frm.LineInfo; table.DQ = frm.DQ; table.Num1 = frm.Num1; table.Num2 = frm.Num2; try { Common.Services.BaseService.Update<Ps_Table_TZGS>(table); AddChildVol(table, true); LoadData1(); FoucsLocation(table.ID, treeList1.Nodes); } catch { } } } }