Example #1
0
        private void barEdititem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
                return;
            string uid = treeList1.FocusedNode["UID"].ToString();
            RtfCategory obj = Services.BaseService.GetOneByKey<RtfCategory>(uid);
            RtfCategory objCopy = new RtfCategory();
            DataConverter.CopyTo<RtfCategory>(obj, objCopy);

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

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

            DataConverter.CopyTo<RtfCategory>(objCopy, obj);
            treeList1.FocusedNode.SetValue("Title", obj.Title);
            treeList1.FocusedNode.SetValue("SortNo", obj.SortNo);
        }
Example #2
0
        //���ͬ��
        private void barAdditem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            decimal count = 0;
            string parentid = "";
            if (treeList1.FocusedNode != null)
            {
                parentid = treeList1.FocusedNode["ParentID"].ToString();
            }

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

            RtfCategory obj = new RtfCategory();
            obj.UID = obj.UID + "|" + ProjectUID + "|" + type;
            obj.SortNo = count + 1;
            obj.ParentID = parentid;

            FrmRtfCategoryDialog dlg = new FrmRtfCategoryDialog();
            dlg.Object = obj;
            dlg.IsCreate = true;

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

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }