Пример #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);
        }
Пример #2
0
        //添加下级
        private void barAdd1item_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            decimal count    = 0;
            string  parentid = "";

            if (treeList1.FocusedNode == null)
            {
                return;
            }
            parentid = treeList1.FocusedNode["UID"].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.ParentID = parentid;
            obj.SortNo   = count + 1;
            FrmRtfCategoryDialog dlg = new FrmRtfCategoryDialog();

            dlg.Object   = obj;
            dlg.IsCreate = true;

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

            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
Пример #3
0
        void dsoFramerWordControl2_OnFileSaved(object sender, EventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            string      uid = treeList1.FocusedNode["UID"].ToString();
            RtfCategory obj = Services.BaseService.GetOneByKey <RtfCategory>(uid);

            obj.RtfContents = dsoFramerWordControl2.FileDataGzip;
            //obj.RtfContents = txEdit1.m_SaveStream();
            WaitDialogForm wait = null;

            try
            {
                wait = new WaitDialogForm("", "正在保存数据, 请稍候...");
                Services.BaseService.Update("UpdateRtfCategoryByte", obj);
                wait.Close();
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                wait.Close();
                return;
            }
        }
Пример #4
0
        private void barSelect_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);

            txtByte = obj.RtfContents;
            DeleteFile();
            this.DialogResult = DialogResult.OK;
        }
Пример #5
0
        private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }

            if (!isstate)
            {
                return;
            }

            string         uid  = treeList1.FocusedNode["UID"].ToString();
            RtfCategory    obj  = Services.BaseService.GetOneByKey <RtfCategory>(uid);
            WaitDialogForm wait = null;

            this.ctrlRtfAttachFiles1.Category = uid;
            this.ctrlRtfAttachFiles1.RefreshData();


            WordBuilder wb = new WordBuilder();

            if (fb != null)
            {
                wb.InsertFromStreamGzip(fb);
            }


            try
            {
                wait = new WaitDialogForm("", "正在下载数据, 请稍候...");
                //txEdit1.ResetContents();
                //txEdit1.m_LoadStream(obj.RtfContents);
                if (obj.RtfContents != null && obj.RtfContents.Length > 0)
                {
                    if (fb != null)
                    {
                        wb.InsertFromStreamGzip(obj.RtfContents);
                        dsoFramerWordControl2.FileData = wb.FileData;
                    }
                    else
                    {
                        dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                    }

                    //////dsoFramerWordControl2.FileDataGzip = obj.RtfContents;
                }
                else
                {
                    ////////LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>("LayoutModule");
                    ////////dsoFramerWordControl2.FileDataGzip = lt1.ExcelData;
                    dsoFramerWordControl2.FileNew();
                }

                //if (!(AddRight || EditRight))
                //    dsoFramerWordControl2.IsReadOnly = true;
                dsoFramerWordControl2.AxFramerControl.Menubar = true;
                wait.Close();
            }
            catch (Exception ex)
            {
                //dsoFramerWordControl2.FileDataGzip = wb.FileDataGzip;
                wait.Close();
                MessageBox.Show(ex.Message);
            }                                 //MsgBox.Show("程序发生异常,请检查Office是否安装正确!"); }
        }