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

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

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

            FrmPowerStuffDialog dlg = new FrmPowerStuffDialog();

            dlg.Object = objCopy;

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

            DataConverter.CopyTo <PowerStuff>(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("Remark", obj.Remark);
        }
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("SelectPowerStuffBySortID", parentid);

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

            PowerStuff obj = new PowerStuff();

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

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Esempio n. 3
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;

            PowerStuff obj = new PowerStuff();

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

            using (FrmPowerStuffDialog dlg = new FrmPowerStuffDialog())
            {
                dlg.IsCreate = true;    //设置新建标志
                dlg.Object   = obj;
                dlg.IsInsert = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));

            treeList1.DataSource = dataTable;
        }
Esempio n. 4
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("SelectPowerStuffBySortID", parentid);
            if (objs != null)
                count = (int)objs;

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

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Esempio n. 5
0
        private void ����ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            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;

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

            using (FrmPowerStuffDialog dlg = new FrmPowerStuffDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                dlg.IsInsert = true;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Esempio n. 6
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            if (treeList1.FocusedNode == null)
                return;

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

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

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

            DataConverter.CopyTo<PowerStuff>(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("Remark", obj.Remark);
        }