private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } int cou = treeList1.Nodes.Count; FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加分类"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Title = frm.TypeTitle; psp_Type.Flag = cou + 1; psp_Type.Flag2 = typeFlag2; psp_Type.ParentID = 0; try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); } catch (Exception ex) { MsgBox.Show("增加分类出错:" + ex.Message); } } }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加分类"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Title = frm.TypeTitle; psp_Type.Flag2 = typeFlag2; psp_Type.ProjectID = ProjectUID; try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); } catch (Exception ex) { MsgBox.Show("增加分类出错:" + ex.Message); } } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } //if (treeList1.FocusedNode.ParentNode == null) //{ // MsgBox.Show("一级分类名称不能修改!"); // return; //} string parentid = treeList1.FocusedNode["ParentID"].ToString(); string flag = treeList1.FocusedNode["flag"].ToString(); //if (parentid == "0" && (flag == "2" || flag == "3" || flag == "5" || flag == "7")) //{ // MsgBox.Show("固定分类,不能修改!"); // return; //} //if (treeList1.FocusedNode["Title"].ToString().IndexOf("居民") > -1 && parentid == "233") //{ // MsgBox.Show("固定分类,不能修改!"); // return; //} if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); Class1.TreeNodeToDataObject <PSP_Types>(psp_Type, treeList1.FocusedNode); psp_Type.Title = frm.TypeTitle; try { Common.Services.BaseService.Update <PSP_Types>(psp_Type); treeList1.FocusedNode.SetValue("Title", frm.TypeTitle); } catch (Exception ex) { MsgBox.Show("修改出错:" + ex.Message); } } }
private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加分类"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Title = frm.TypeTitle; int flag = psp_Type.ID + 1; if (focusedNode != null) { flag = (int)focusedNode.GetValue("Flag"); } psp_Type.Flag = flag; psp_Type.Flag2 = typeFlag2; psp_Type.ParentID = 0; try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); this.Cursor = Cursors.WaitCursor; treeList1.BeginUpdate(); LoadData(); treeList1.EndUpdate(); this.Cursor = Cursors.Default; } catch (Exception ex) { MsgBox.Show("增加分类出错:" + ex.Message); } } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加" + focusedNode.GetValue("Title") + "的下级地区"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Title = frm.TypeTitle; psp_Type.Flag = (int)focusedNode["Flag"]; psp_Type.Flag2 = typeFlag2; psp_Type.ParentID = (int)focusedNode.GetValue("TypeID"); try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type); treeList1.BeginUpdate(); int year = (int)focusedNode.GetValue("Year"); foreach (TreeListNode nd in treeList1.Nodes) { AddChildRegion(nd, psp_Type.Title, psp_Type.ParentID, psp_Type.ID, psp_Type.Flag); } treeList1.EndUpdate(); DataRow newRegionRow = dtRegion.NewRow(); Itop.Common.DataConverter.ObjectToRow(psp_Type, newRegionRow); dtRegion.Rows.Add(newRegionRow); } catch (Exception ex) { MsgBox.Show("增加下级地区出错:" + ex.Message); } } }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加" + focusedNode.GetValue("Title") + "的子分类"; if (frm.ShowDialog() == DialogResult.OK) { PSP_P_Types psp_Type = new PSP_P_Types(); object obj = Services.BaseService.GetObject("SelectPSP_P_TypesMaxID", null); if (obj != null) { psp_Type.ID = ((int)obj) + 1; } else { psp_Type.ID = 1; } psp_Type.Title = frm.TypeTitle; psp_Type.Flag = (int)focusedNode.GetValue("Flag"); psp_Type.Flag2 = (int)focusedNode.GetValue("Flag2"); psp_Type.ParentID = (int)focusedNode.GetValue("ID"); try { Services.BaseService.Create("InsertPSP_P_Types", psp_Type); //psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_P_Types", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); } catch (Exception ex) { MsgBox.Show("增加子分类出错:" + ex.Message); } } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (treeList1.FocusedNode.ParentNode == null) { MsgBox.Show("一级分类名称不能修改!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); Class1.TreeNodeToDataObject <PSP_Types>(psp_Type, treeList1.FocusedNode); psp_Type.Title = frm.TypeTitle; try { Common.Services.BaseService.Update <PSP_Types>(psp_Type); treeList1.FocusedNode.SetValue("Title", frm.TypeTitle); } catch (Exception ex) { MsgBox.Show("修改出错:" + ex.Message); } } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (treeList1.FocusedNode.ParentNode == null) { MsgBox.Show("一级分类名称不能修改!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode); psp_Type.Title = frm.TypeTitle; try { Common.Services.BaseService.Update<PSP_Types>(psp_Type); treeList1.FocusedNode.SetValue("Title", frm.TypeTitle); } catch(Exception ex) { MsgBox.Show("修改出错:" + ex.Message); } } }
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } if (!base.AddRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.Text = "增加" + focusedNode.GetValue("Title") + "的子分类"; if(frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Title = frm.TypeTitle; psp_Type.Flag = (int)focusedNode.GetValue("Flag"); psp_Type.Flag2 = (int)focusedNode.GetValue("Flag2"); psp_Type.ParentID = (int)focusedNode.GetValue("ID"); try { psp_Type.ID = (int)Common.Services.BaseService.Create("InsertPSP_Types", psp_Type); dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow())); } catch(Exception ex) { MsgBox.Show("增加子分类出错:" + ex.Message); } } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode focusedNode = treeList1.FocusedNode; if (focusedNode == null) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (focusedNode.ParentNode == null) { MsgBox.Show("全地区名称不能修改!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.TypeTitle = focusedNode.GetValue("Title").ToString(); frm.Text = "修改地区名称"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); psp_Type.Flag = (int)focusedNode["Flag"]; psp_Type.Flag2 = typeFlag2; psp_Type.ParentID = Convert.ToInt32(focusedNode.GetValue("ParentID").ToString().Remove(0, focusedNode.GetValue("Year").ToString().Length)); psp_Type.Title = frm.TypeTitle; psp_Type.ID = (int)focusedNode.GetValue("TypeID"); try { Common.Services.BaseService.Update <PSP_Types>(psp_Type); treeList1.BeginUpdate(); foreach (TreeListNode nd in treeList1.Nodes) { UpdateNodeText(nd, psp_Type.Title, psp_Type.ID); } treeList1.EndUpdate(); foreach (DataRow dr in dtRegion.Rows) { if ((int)dr["ID"] == psp_Type.ID) { dr["Title"] = psp_Type.Title; break; } } } catch (Exception ex) { MsgBox.Show("修改出错:" + ex.Message); } } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (treeList1.FocusedNode == null) { return; } //if (treeList1.FocusedNode.ParentNode == null) //{ // MsgBox.Show("一级分类名称不能修改!"); // return; //} string parentid = treeList1.FocusedNode["ParentID"].ToString(); string flag = treeList1.FocusedNode["flag"].ToString(); //if (parentid == "0" && (flag == "2" || flag == "3" || flag == "5" || flag == "7")) //{ // MsgBox.Show("固定分类,不能修改!"); // return; //} //if (treeList1.FocusedNode["Title"].ToString().IndexOf("居民") > -1 && parentid == "233") //{ // MsgBox.Show("固定分类,不能修改!"); // return; //} if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } FormTypeTitle frm = new FormTypeTitle(); frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString(); frm.Text = "修改分类名"; if (frm.ShowDialog() == DialogResult.OK) { PSP_Types psp_Type = new PSP_Types(); Class1.TreeNodeToDataObject<PSP_Types>(psp_Type, treeList1.FocusedNode); psp_Type.Title = frm.TypeTitle; try { Common.Services.BaseService.Update<PSP_Types>(psp_Type); treeList1.FocusedNode.SetValue("Title", frm.TypeTitle); } catch(Exception ex) { MsgBox.Show("修改出错:" + ex.Message); } } }