Esempio n. 1
0
        internal short OpenTemplet(string szFileName)
        {
            if (string.IsNullOrEmpty(szFileName))
            {
                return(SystemData.ReturnValue.PARAM_ERROR);
            }
            DesignEditForm designEditForm = new DesignEditForm(this.MainForm);

            designEditForm.FlagCode = Guid.NewGuid().ToString();
            this.MainForm.OpenDesignEditForm(designEditForm);

            return(designEditForm.Open(szFileName) ?
                   SystemData.ReturnValue.OK : SystemData.ReturnValue.FAILED);
        }
Esempio n. 2
0
        internal short OpenTemplet()
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Filter      = "护理病历模板(*.hndt)|*.hndt|所有文件(*.*)|*.*";
            openDialog.FilterIndex = 1;
            if (openDialog.ShowDialog() != DialogResult.OK)
            {
                return(SystemData.ReturnValue.CANCEL);
            }

            DesignEditForm designEditForm = new DesignEditForm(this.MainForm);

            designEditForm.FlagCode = Guid.NewGuid().ToString();
            this.MainForm.OpenDesignEditForm(designEditForm);

            return(designEditForm.Open(openDialog.FileName) ?
                   SystemData.ReturnValue.OK : SystemData.ReturnValue.FAILED);
        }
Esempio n. 3
0
        internal bool OpenDesignEditForm(ScriptEditForm scriptForm)
        {
            if (scriptForm == null || scriptForm.IsDisposed)
            {
                return(false);
            }

            DesignEditForm designEditForm = this.GetDesignForm(scriptForm);

            if (designEditForm != null)
            {
                designEditForm.DockHandler.Activate();
                return(true);
            }
            designEditForm          = new DesignEditForm(this.MainForm);
            designEditForm.FlagCode = scriptForm.FlagCode;
            this.MainForm.OpenDesignEditForm(designEditForm);
            return(designEditForm.Open(scriptForm.DocTypeInfo, scriptForm.HndfFile));
        }
Esempio n. 4
0
 internal DesignEditForm GetDesignForm(string szDocTypeID)
 {
     if (this.MainForm == null || string.IsNullOrEmpty(szDocTypeID))
     {
         return(null);
     }
     foreach (IDockContent content in this.MainForm.Documents)
     {
         DesignEditForm designForm = content as DesignEditForm;
         if (designForm == null || designForm.DocTypeInfo == null)
         {
             continue;
         }
         if (designForm.DocTypeInfo.DocTypeID == szDocTypeID)
         {
             return(designForm);
         }
     }
     return(null);
 }
Esempio n. 5
0
        internal short OpenTemplet(TempletType docTypeInfo)
        {
            if (docTypeInfo == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }

            DesignEditForm designEditForm = this.GetDesignForm(docTypeInfo);

            if (designEditForm != null)
            {
                designEditForm.Activate();
                return(SystemData.ReturnValue.OK);
            }
            designEditForm          = new DesignEditForm(this.MainForm);
            designEditForm.FlagCode = Guid.NewGuid().ToString();
            this.MainForm.OpenDesignEditForm(designEditForm);

            string szDocTypeID = docTypeInfo.DocTypeID;
            string szHndfFile  = string.Format("{0}\\Cache\\{1}.hndt"
                                               , GlobalMethods.Misc.GetWorkingPath(), szDocTypeID);

            byte[] byteTempletData = null;
            if (szDocTypeID != string.Empty)
            {
                short shRet = TempletTypeAccess.Instance.GetTempletData(szDocTypeID, ref byteTempletData);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    return(shRet);
                }
            }

            GlobalMethods.IO.WriteFileBytes(szHndfFile, byteTempletData);
            return(designEditForm.Open(docTypeInfo, szHndfFile) ?
                   SystemData.ReturnValue.OK : SystemData.ReturnValue.FAILED);
        }
Esempio n. 6
0
 internal DesignEditForm GetDesignForm(ScriptEditForm scriptForm)
 {
     if (this.MainForm == null || scriptForm == null)
     {
         return(null);
     }
     foreach (IDockContent content in this.MainForm.Documents)
     {
         DesignEditForm designForm = content as DesignEditForm;
         if (designForm == null)
         {
             continue;
         }
         if (designForm.FlagCode == scriptForm.FlagCode)
         {
             return(designForm);
         }
         if (designForm.HndfFile == scriptForm.HndfFile)
         {
             return(designForm);
         }
     }
     return(null);
 }
Esempio n. 7
0
        //internal short OpenTemplet(DocTypeInfo docTypeInfo)
        //{
        //    if (docTypeInfo == null)
        //        return SystemData.ReturnValue.FAILED;

        //    DesignEditForm designEditForm = this.GetDesignForm(docTypeInfo);
        //    if (designEditForm != null)
        //    {
        //        designEditForm.Activate();
        //        return SystemData.ReturnValue.OK;
        //    }
        //    designEditForm = new DesignEditForm(this.MainForm);
        //    designEditForm.FlagCode = Guid.NewGuid().ToString();
        //    this.MainForm.OpenDesignEditForm(designEditForm);

        //    string szDocTypeID = docTypeInfo.DocTypeID;
        //    string szHndfFile = string.Format("{0}\\Cache\\{1}.hndt"
        //        , GlobalMethods.Misc.GetWorkingPath(), szDocTypeID);

        //    byte[] byteTempletData = null;
        //    //short shRet = TempletService.Instance.GetFormTemplet(szDocTypeID, ref byteTempletData);
        //    //if (shRet != SystemData.ReturnValue.OK)
        //    //    return shRet;

        //    GlobalMethods.IO.WriteFileBytes(szHndfFile, byteTempletData);
        //    return designEditForm.Open(docTypeInfo, szHndfFile) ?
        //        SystemData.ReturnValue.OK : SystemData.ReturnValue.FAILED;
        //}

        /// <summary>
        /// 保存当前正在编辑的模板文件
        /// </summary>
        /// <returns>bool</returns>
        internal bool SaveTemplet()
        {
            DesignEditForm designForm = this.ActiveTemplet;
            ScriptEditForm scriptForm = this.ActiveScript;

            if (scriptForm == null && designForm == null)
            {
                return(false);
            }

            if (designForm != null)
            {
                scriptForm = this.GetScriptForm(designForm);
            }
            else if (scriptForm != null)
            {
                designForm = this.GetDesignForm(scriptForm);
            }

            FormFileParser parser       = new FormFileParser();
            string         szScriptData = null;

            if (scriptForm != null)
            {
                szScriptData = scriptForm.Save();
            }
            else
            {
                szScriptData = parser.GetScriptData(designForm.HndfFile);
            }

            string szDesignData = null;

            if (designForm != null)
            {
                designForm.Save(ref szDesignData);
            }
            else
            {
                szDesignData = parser.GetDesignData(scriptForm.HndfFile);
            }

            byte[] byteTempletData = null;
            parser.MakeFormData(szDesignData, szScriptData, out byteTempletData);

            DialogResult result = MessageBoxEx.ShowQuestion("是否提交到服务器?"
                                                            + "\r\n提交到服务器,请点击“是”按钮!\r\n仅保存到本地,请点击“否”按钮!");

            if (result == DialogResult.Cancel)
            {
                return(false);
            }
            bool success = true;

            if (result == DialogResult.No)
            {
                success = this.SaveTempletToLocal(byteTempletData);
            }
            else
            {
                success = this.SaveTempletToServer(byteTempletData);
            }
            if (success)
            {
                if (designForm != null)
                {
                    designForm.IsModified = false;
                }
                if (scriptForm != null)
                {
                    scriptForm.IsModified = false;
                }
            }
            return(success);
        }
Esempio n. 8
0
        internal void ShowScriptTestForm()
        {
            DesignEditForm designForm = this.ActiveTemplet;
            ScriptEditForm scriptForm = this.ActiveScript;

            if (scriptForm == null && designForm == null)
            {
                return;
            }

            if (designForm != null)
            {
                scriptForm = this.GetScriptForm(designForm);
            }
            else if (scriptForm != null)
            {
                designForm = this.GetDesignForm(scriptForm);
            }

            FormFileParser parser       = new FormFileParser();
            string         szScriptData = null;

            if (scriptForm != null)
            {
                szScriptData = scriptForm.Save();
            }
            else
            {
                szScriptData = parser.GetScriptData(designForm.HndfFile);
            }

            string szDesignData = null;

            if (designForm != null)
            {
                designForm.Save(ref szDesignData);
            }
            else
            {
                szDesignData = parser.GetDesignData(scriptForm.HndfFile);
            }

            //编译脚本
            ScriptProperty scriptProperty = new ScriptProperty();

            scriptProperty.ScriptText = szScriptData;
            CompileResults results = null;

            results = ScriptCompiler.Instance.CompileScript(scriptProperty);
            if (!results.HasErrors)
            {
                this.MainForm.ShowCompileErrorForm(null);
            }
            else
            {
                if (scriptForm == null)
                {
                    this.OpenScriptEditForm(designForm);
                }
                this.MainForm.ShowCompileErrorForm(this.GetCompileErrors(results));
                MessageBoxEx.Show("编译失败,无法启动测试程序!");
                return;
            }

            ScriptTestForm scriptTestForm = new ScriptTestForm();

            scriptTestForm.ScriptData = szScriptData;
            scriptTestForm.DesignData = szDesignData;
            scriptTestForm.ShowDialog();
        }