Esempio n. 1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            string       uid     = treeList1.FocusedNode["UID"].ToString();
            PowerProject obj     = Services.BaseService.GetOneByKey <PowerProject>(uid);
            PowerProject objCopy = new PowerProject();

            DataConverter.CopyTo <PowerProject>(obj, objCopy);

            FrmPowerProjectDialog dlg = new FrmPowerProjectDialog();

            dlg.Object = objCopy;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataConverter.CopyTo <PowerProject>(objCopy, obj);
            treeList1.FocusedNode.SetValue("StuffName", obj.StuffName);
            treeList1.FocusedNode.SetValue("Lengths", obj.Lengths);
            treeList1.FocusedNode.SetValue("Volume", obj.Volume);
            treeList1.FocusedNode.SetValue("Type", obj.Type);
            treeList1.FocusedNode.SetValue("Total", obj.Total);
            treeList1.FocusedNode.SetValue("PlanStartYear", obj.PlanStartYear);
            treeList1.FocusedNode.SetValue("PlanEndYear", obj.PlanEndYear);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            int    count    = 0;
            string parentid = "";

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

            object objs = Services.BaseService.GetObject("SelectPowerProjectBySortID", parentid);

            if (objs != null)
            {
                count = (int)objs;
            }

            PowerProject obj = new PowerProject();

            obj.SortID       = count + 1;
            obj.ParentID     = parentid;
            obj.PowerLineUID = lineuid;
            using (FrmPowerProjectDialog dlg = new FrmPowerProjectDialog())
            {
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Esempio n. 3
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            int count = 0;
            string parentid = "";
            if (treeList1.FocusedNode != null)
            {
                parentid = treeList1.FocusedNode["ParentID"].ToString();
            }

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

            PowerProject obj = new PowerProject();
            obj.SortID = count + 1;
            obj.ParentID = parentid;
            obj.PowerLineUID = lineuid;
            using (FrmPowerProjectDialog dlg = new FrmPowerProjectDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Esempio n. 4
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            if (treeList1.FocusedNode == null)
                return;

            string uid = treeList1.FocusedNode["UID"].ToString();
            PowerProject obj = Services.BaseService.GetOneByKey<PowerProject>(uid);
            PowerProject objCopy = new PowerProject();
            DataConverter.CopyTo<PowerProject>(obj, objCopy);

            FrmPowerProjectDialog dlg = new FrmPowerProjectDialog();
            dlg.Object = objCopy;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataConverter.CopyTo<PowerProject>(objCopy, obj);
            treeList1.FocusedNode.SetValue("StuffName", obj.StuffName);
            treeList1.FocusedNode.SetValue("Lengths", obj.Lengths);
            treeList1.FocusedNode.SetValue("Volume", obj.Volume);
            treeList1.FocusedNode.SetValue("Type", obj.Type);
            treeList1.FocusedNode.SetValue("Total", obj.Total);
            treeList1.FocusedNode.SetValue("PlanStartYear", obj.PlanStartYear);
            treeList1.FocusedNode.SetValue("PlanEndYear", obj.PlanEndYear);
        }