private void treeList1_DoubleClick(object sender, EventArgs e)
        {
            if (FocusedObject == null)
            {
                return;
            }
            if (FocusedObject.ParentID == "0")
            {
                return;
            }

            string path = Application.StartupPath + "\\BlogData";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            RtfAttachFiles raf      = Services.BaseService.GetOneByKey <RtfAttachFiles>(FocusedObject.UID);
            string         filepath = path + "\\" + raf.FileName;

            FrmCommon.getDoc(raf.FileByte, filepath);


            WaitDialogForm wait = new WaitDialogForm("", "正在下载数据, 请稍候...");

            try
            {
                System.Diagnostics.Process.Start(filepath);
            }
            catch { System.Diagnostics.Process.Start(path); }
            wait.Close();
        }
Exemple #2
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            RtfAttachFiles obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            RtfAttachFiles objCopy = new RtfAttachFiles();

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

            //执行修改操作
            using (FrmRtfAttachFilesDialog dlg = new FrmRtfAttachFilesDialog())
            {
                dlg.Object = objCopy;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象
            DataConverter.CopyTo <RtfAttachFiles>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
Exemple #3
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            RtfAttachFiles obj = new RtfAttachFiles();

            obj.C_UID      = catygory;
            obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null);

            //执行添加操作
            using (FrmRtfAttachFilesDialog dlg = new FrmRtfAttachFilesDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            //if (ObjectList == null)
            //{
            //	return;
            //}
            //新建对象
            if (catygory == "")
            {
                return;
            }
            RtfAttachFiles obj = new RtfAttachFiles();

            obj.C_UID      = catygory;
            obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null);

            //执行添加操作
            using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR())
            {
                string parentid = "0";
                if (treeList1.FocusedNode != null && treeList1.FocusedNode.GetValue("ParentID").ToString() != "0")
                {
                    MessageBox.Show("只能在一级目录下添加附件");
                    return;
                }
                else
                {
                    parentid = FocusedObject.UID;
                }

                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                dlg.ParentID = parentid;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            //Common.Services.BaseService.Create<RtfAttachFiles>(obj);
            RefreshData();
            ////将新对象加入到链表中
            //ObjectList.Add(obj);

            ////刷新表格,并将焦点行定位到新对象上。
            //treeList1.RefreshDataSource();
            //Set_Focus(obj.UID);
        }
        /// <summary>
        /// 删除焦点对象
        /// </summary>
        public void DeleteObject()
        {
            if (catygory == "")
            {
                return;
            }
            //获取焦点对象
            RtfAttachFiles obj = FocusedObject;

            if (obj == null)
            {
                return;
            }
            if (obj.ParentID == "0")
            {
                return;
            }

            //请求确认
            if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes)
            {
                return;
            }

            //执行删除操作
            try
            {
                Services.BaseService.Delete <RtfAttachFiles>(obj);
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return;
            }
            RefreshData();
            //this.treeList1.BeginUpdate();
            ////记住当前焦点行索引
            //int iOldHandle = this.treeList1.FocusedNode.Id;
            ////从链表中删除
            //ObjectList.Remove(obj);
            ////刷新表格
            //treeList1.RefreshDataSource();
            ////设置新的焦点行索引

            //this.treeList1.EndUpdate();
        }
Exemple #6
0
        private void gridView_DoubleClick(object sender, EventArgs e)
        {
            if (FocusedObject == null)
            {
                return;
            }


            string path = Application.StartupPath + "\\BlogData";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            RtfAttachFiles raf      = Services.BaseService.GetOneByKey <RtfAttachFiles>(FocusedObject.UID);
            string         filepath = path + "\\" + raf.FileName;

            FrmCommon.getDoc(raf.FileByte, filepath);


            WaitDialogForm wait = new WaitDialogForm("", "正在下载数据, 请稍候...");

            try
            {
                System.Diagnostics.Process.Start(filepath);
            }
            catch { System.Diagnostics.Process.Start(path); }
            wait.Close();

            // 判断"双击允许修改"标志
            //////if (!AllowUpdate)
            //////{
            //////    return;
            //////}

            ////////如果鼠标点击在单元格中,则编辑焦点对象。
            //////Point point = this.gridControl.PointToClient(Control.MousePosition);
            //////if (GridHelper.HitCell(this.gridView, point))
            //////{
            //////    UpdateObject();
            //////}
        }
Exemple #7
0
        /// <summary>
        /// 删除焦点对象
        /// </summary>
        public void DeleteObject()
        {
            //获取焦点对象
            RtfAttachFiles obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //请求确认
            if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes)
            {
                return;
            }

            //执行删除操作
            try
            {
                Services.BaseService.Delete <RtfAttachFiles>(obj);
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return;
            }

            this.gridView.BeginUpdate();
            //记住当前焦点行索引
            int iOldHandle = this.gridView.FocusedRowHandle;

            //从链表中删除
            ObjectList.Remove(obj);
            //刷新表格
            gridControl.RefreshDataSource();
            //设置新的焦点行索引
            GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle);
            this.gridView.EndUpdate();
        }
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            if (catygory == "")
            {
                return;
            }
            //获取焦点对象
            RtfAttachFiles obj = FocusedObject;

            if (obj == null)
            {
                return;
            }
            if (obj.ParentID == "0")
            {
                return;
            }
            //创建对象的一个副本
            RtfAttachFiles objCopy = new RtfAttachFiles();

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

            //执行修改操作
            using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR())
            {
                dlg.Object = objCopy;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            //Common.Services.BaseService.Update<RtfAttachFiles>(objCopy);
            RefreshData();

            ////用副本更新焦点对象
            DataConverter.CopyTo <RtfAttachFiles>(objCopy, obj);
            ////刷新表格
            //treeList1.RefreshDataSource();
        }