Example #1
0
        /// <summary>
        /// 单独打开一个文件
        /// </summary>
        private void OpenOneFile(string p_fileName)
        {
            //此处进行预打开对象操作
            _Files files = new _Files();

            //创建文件对象
            files.Init(p_fileName);
            if (files.Exists)
            {
                this.buttonEdit1.Text = files.FullName;
                //CResult result = APP.WorkFlows.Operaty.LoadOnlyObject(files);
                CResult result = CActionData.Load(files);
                if (result.Success)
                {
                    _COBJECTS obj = result.Value as _COBJECTS;
                    obj.Files = files;
                    m_ObjectList.Add(obj);
                    //初始化打开的文件对象
                    this.Init();
                }
                else
                {
                    //MessageBox.Show(result.ErrorInformation);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 打开已经有的项目对象(此处修改为线程操作)
        /// </summary>
        private void OpenObjects()
        {
            FileInfo info = new FileInfo(this.openFileDialog1.FileName);

            if (info != null)
            {
                if (info.Exists)
                {
                    //打开指定单位工程逻辑
                    CActionData.Load(info, this.m_Master as ApplicationForm);
                    this.DialogResult = DialogResult.Cancel;
                }
            }
        }
Example #3
0
        /// <summary>
        /// 打开已经有的项目对象(此处修改为线程操作)
        /// </summary>
        private void OpenSelect2()
        {
            _HeaderInfo info = this.bindingSource2.Current as _HeaderInfo;

            if (info.HFileInfo != null)
            {
                if (info.HFileInfo.Exists)
                {
                    APP.FileType = "项目工程";
                    //打开指定单位工程逻辑
                    //CResult r = APP.WorkFlows.Operaty.Load(info);
                    this.DialogResult = DialogResult.Cancel;
                    CActionData.Load(info.HFileInfo, this.m_Master as ApplicationForm);
                }
            }
        }
Example #4
0
        /// <summary>
        /// 电子标书
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Open_dzbs_Click(object sender, EventArgs e)
        {
            DialogResult r = this.openFileDialog1.ShowDialog();

            if (r == DialogResult.OK)
            {
                FileInfo info = new FileInfo(this.openFileDialog1.FileName);
                if (info != null)
                {
                    if (info.Exists)
                    {
                        //打开指定单位工程逻辑
                        this.DialogResult = DialogResult.Cancel;
                        CActionData.Load(info, this.m_Master as ApplicationForm);
                    }
                }
            }
        }
Example #5
0
        /// <summary>
        /// 打开文件(通用处理函数)
        /// </summary>
        public void ShowOpenAction()
        {
            NewProjeByXml form = new NewProjeByXml();

            form.Master = this.MdiParent;
            DialogResult result = form.ShowDialog();

            //处理XML业务
            if (result == DialogResult.OK)
            {
                FileInfo info = new FileInfo(form.buttonEdit1.Text);
                CActionData.Load(info, this.MdiParent as ApplicationForm);
            }
            //处理普通Objects业务
            if (result == DialogResult.Yes)
            {   //
                this.OpenNewBussinessForm(form.CurrentBusiness);
            }
        }
Example #6
0
        /// <summary>
        /// 为打开项目文件提供的静态方法
        /// </summary>
        /// <param name="p_Info"></param>
        public static CResult Load(FileInfo p_Info, ApplicationForm from)
        {
            CResult result = new CResult(false);

            //文件不存在直接返回
            if (!p_Info.Exists)
            {
                result.Success          = false;
                result.ErrorInformation = "您要打开的文件对象不存在!";
                MsgBox.Alert(result.ErrorInformation);
                return(result);
            }
            //存在相同路径的的业务则不打开
            string name = IsExitFileObject(p_Info, from);

            if (name != string.Empty)
            {
                result.Success          = false;
                result.ErrorInformation = string.Format("项目-{0} 已经打开!", name);
                MsgBox.Alert(result.ErrorInformation);
                return(result);
            }

            _Files files = new _Files();

            files.Init(p_Info.FullName);
            //如果当前业务流是锁定状态不允许创建任何新业务

            //创建新业务(要创建的类型根据文件判断)
            switch (files.FileType)
            {
            case GOLDSOFT.QDJJ.COMMONS._Files.CFileType.单位工程:
                //此处实现单位工程的打开逻辑
                CActionData.openUnitProject(files, from);
                break;

            case GOLDSOFT.QDJJ.COMMONS._Files.CFileType.单项工程:
                //此处实现单项工程打开逻辑
                APP.Application.Global.WorkFolder = p_Info.Directory.Parent;
                CActionData.openEngineering(files);
                break;

            case GOLDSOFT.QDJJ.COMMONS._Files.CFileType.项目文件:
            case GOLDSOFT.QDJJ.COMMONS._Files.CFileType.电子标书:
                //此处实现单项工程打开逻辑
                APP.Application.Global.WorkFolder = p_Info.Directory.Parent;
                CActionData.openProject(files, from);
                break;

            case GOLDSOFT.QDJJ.COMMONS._Files.CFileType.XML文件:
                //此处实现xml打开逻辑
                // APP.Application.Global.WorkFolder = new FileInfo(p_FileName).Directory.Parent;
                CActionData.openProjectByxml(files, from);
                break;
            }

            /* result.Data = EBObjectType.Auto;
             * result.Success = false;
             * return result;*/
            result.Success = true;

            return(result);
        }
Example #7
0
        public static CResult Load(_Files p_Files)
        {
            FileInfo info = new FileInfo(p_Files.FullName);

            return(CActionData.Load(info));
        }