Esempio n. 1
0
        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FormTitleEdit frm = new FormTitleEdit();

            frm.Text = "增加项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerProTypes psp_Type = new PowerProTypes();
                psp_Type.Title    = frm.TypeTitle;
                psp_Type.Flag     = frm.PowerType;
                psp_Type.Flag2    = typeFlag2;
                psp_Type.ParentID = "0";

                try
                {
                    psp_Type.ID = Common.Services.BaseService.Create("InsertPowerProTypes", psp_Type).ToString();
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
        }
Esempio n. 2
0
        private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }


            FormTitleEdit frm = new FormTitleEdit();

            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerProTypes psp_Type = new PowerProTypes();
                psp_Type.Title    = frm.TypeTitle;
                psp_Type.Flag     = frm.PowerType;
                psp_Type.Flag2    = (string)focusedNode.GetValue("Flag2");
                psp_Type.ParentID = focusedNode.GetValue("ID").ToString();

                try
                {
                    Common.Services.BaseService.Create("InsertPowerProTypes", psp_Type);
                    LoadData();

                    FoucsLocation(psp_Type.ID, treeList1.Nodes);
                    //treeList1.RefreshDataSource();
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加子项目出错:" + ex.Message);
                }
            }
        }
Esempio n. 3
0
        private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

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

            FormTitleEdit frm = new FormTitleEdit();

            frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            try
            {
                if (treeList1.FocusedNode["Flag"].ToString() == "2")
                {
                    frm.PowerType = 2;
                }
                else
                {
                    frm.PowerType = 1;
                }
            }
            catch { }
            frm.Text     = "修改项目";
            frm.Isupdate = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string id     = treeList1.FocusedNode["ID"].ToString();
                    string flag22 = typeFlag2;

                    PowerProTypes pptss = new PowerProTypes();
                    pptss.ID    = id;
                    pptss.Flag2 = flag22;


                    PowerProTypes psp_Type = Services.BaseService.GetOneByKey <PowerProTypes>(pptss);
                    psp_Type.Title = frm.TypeTitle;
                    psp_Type.Flag  = frm.PowerType;


                    if (psp_Type.Code != "")
                    {
                        LineInfo li3 = Services.BaseService.GetOneByKey <LineInfo>(psp_Type.Code);
                        if (li3 != null)
                        {
                            li3.LineName = psp_Type.Title;
                            Common.Services.BaseService.Update <LineInfo>(li3);
                        }

                        substation sb3 = Services.BaseService.GetOneByKey <substation>(psp_Type.Code);
                        if (sb3 != null)
                        {
                            sb3.EleName = psp_Type.Title;
                            Common.Services.BaseService.Update <substation>(sb3);
                        }
                    }

                    Common.Services.BaseService.Update <PowerProTypes>(psp_Type);
                    treeList1.FocusedNode.SetValue("Title", frm.TypeTitle);

                    //FoucsLocation(id, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("修改出错:" + ex.Message);
                }
            }
        }
Esempio n. 4
0
        private void barButtonItem13_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

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

            FormTitleEdit frm = new FormTitleEdit();
            frm.TypeTitle = treeList1.FocusedNode.GetValue("Title").ToString();
            try
            {
                if (treeList1.FocusedNode["Flag"].ToString() == "2")
                {
                    frm.PowerType = 2;
                }
                else
                {
                    frm.PowerType = 1;
                }
            }
            catch { }
            frm.Text = "修改项目";
            frm.Isupdate = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string id = treeList1.FocusedNode["ID"].ToString();
                    string flag22 = typeFlag2;

                    PowerProTypes pptss = new PowerProTypes();
                    pptss.ID = id;
                    pptss.Flag2 = flag22;

                    PowerProTypes psp_Type = Services.BaseService.GetOneByKey<PowerProTypes>(pptss);
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = frm.PowerType;

                if (psp_Type.Code != "")
                {
                    LineInfo li3 = Services.BaseService.GetOneByKey<LineInfo>(psp_Type.Code);
                    if (li3 != null)
                    {
                        li3.LineName = psp_Type.Title;
                        Common.Services.BaseService.Update<LineInfo>(li3);
                    }

                    substation sb3 = Services.BaseService.GetOneByKey<substation>(psp_Type.Code);
                    if (sb3 != null)
                    {
                        sb3.EleName = psp_Type.Title;
                        Common.Services.BaseService.Update<substation>(sb3);
                    }
                }

                    Common.Services.BaseService.Update<PowerProTypes>(psp_Type);
                    treeList1.FocusedNode.SetValue("Title", frm.TypeTitle);

                    //FoucsLocation(id, treeList1.Nodes);
                }
                catch (Exception ex)
                {
                    MsgBox.Show("修改出错:" + ex.Message);
                }
            }
        }
Esempio n. 5
0
        private void barButtonItem12_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode focusedNode = treeList1.FocusedNode;

            if (focusedNode == null)
            {
                return;
            }

            FormTitleEdit frm = new FormTitleEdit();
            frm.Text = "增加" + focusedNode.GetValue("Title") + "的子项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerProTypes psp_Type = new PowerProTypes();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = frm.PowerType;
                psp_Type.Flag2 = (string)focusedNode.GetValue("Flag2");
                psp_Type.ParentID = focusedNode.GetValue("ID").ToString();

                try
                {
                    Common.Services.BaseService.Create("InsertPowerProTypes", psp_Type);
                    LoadData();

                    FoucsLocation(psp_Type.ID, treeList1.Nodes);
                    //treeList1.RefreshDataSource();
                    //dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加子项目出错:" + ex.Message);
                }
            }
        }
Esempio n. 6
0
        private void barButtonItem11_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            FormTitleEdit frm = new FormTitleEdit();
            frm.Text = "增加项目";

            if (frm.ShowDialog() == DialogResult.OK)
            {
                PowerProTypes psp_Type = new PowerProTypes();
                psp_Type.Title = frm.TypeTitle;
                psp_Type.Flag = frm.PowerType;
                psp_Type.Flag2 = typeFlag2;
                psp_Type.ParentID = "0";

                try
                {
                    psp_Type.ID = Common.Services.BaseService.Create("InsertPowerProTypes", psp_Type).ToString();
                    dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(psp_Type, dataTable.NewRow()));
                }
                catch (Exception ex)
                {
                    MsgBox.Show("增加项目出错:" + ex.Message);
                }
            }
        }