Esempio n. 1
0
        public void InsertData()
        {
            int    count    = 0;
            string parentid = "";

            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (treeList1.FocusedNode != null)
            {
                parentid = treeList1.FocusedNode["ParentID"].ToString();
                count    = int.Parse(treeList1.FocusedNode["SortID"].ToString());
            }

            //object objs = Services.BaseService.GetObject("SelectPowerProjectBySortID", parentid);
            //if (objs != null)
            //    count = (int)objs;

            PowerEachTotal obj = new PowerEachTotal();

            obj.SortID       = count;
            obj.ParentID     = parentid;
            obj.PowerLineUID = lineuid;

            using (FrmPowerEachTotalDialog dlg = new FrmPowerEachTotalDialog())
            {
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;
                dlg.IsInsert = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
            this.treeList1.DataSource = dataTable;
        }
Esempio n. 2
0
        public void InsertData()
        {
            int count = 0;
            string parentid = "";
            if (treeList1.FocusedNode == null)
                return;

            if (treeList1.FocusedNode != null)
            {
                parentid = treeList1.FocusedNode["ParentID"].ToString();
                count = int.Parse(treeList1.FocusedNode["SortID"].ToString());
            }

            //object objs = Services.BaseService.GetObject("SelectPowerProjectBySortID", parentid);
            //if (objs != null)
            //    count = (int)objs;

            PowerEachTotal obj = new PowerEachTotal();
            obj.SortID = count;
            obj.ParentID = parentid;
            obj.PowerLineUID = lineuid;

            using (FrmPowerEachTotalDialog dlg = new FrmPowerEachTotalDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                dlg.IsInsert = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
            this.treeList1.DataSource = dataTable;
        }