Exemplo n.º 1
0
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FormTypeTitleAH frm = new FormTypeTitleAH();

            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);
                }
            }
        }
Exemplo n.º 2
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            if (!base.AddRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            if (focusedNode.GetValue("Title").ToString() == "线损")
            {
                MsgBox.Show("此行不允许添加子分类!");
                return;
            }
            FormTypeTitleAH frm = new FormTypeTitleAH();

            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");
                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);
                }
            }
        }
Exemplo n.º 3
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (treeList1.FocusedNode.ParentNode == null)
            {
                MsgBox.Show("一级分类名称不能修改!");
                return;
            }

            if (!base.EditRight)
            {
                MsgBox.Show("您没有权限进行此项操作!");
                return;
            }

            FormTypeTitleAH frm = new FormTypeTitleAH();

            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);
                }
            }
        }