Esempio n. 1
0
        /// <summary>
        /// Design
        /// </summary>
        internal void Design()
        {
            EntityEmrBasicInfo caseVo = GetCaseVo();

            if (caseVo == null)
            {
                DialogBox.Msg("请选择表单。");
            }
            else
            {
                if (string.IsNullOrEmpty(caseVo.caseCode))
                {
                    DialogBox.Msg("请先保存病历基本信息。");
                    return;
                }
                using (frmFormDesign frm = new frmFormDesign())
                {
                    //frm.FormType = 11;  // 0412.临时
                    frm.FormType = 1;
                    frm.FormId   = Function.Int((Viewer.txtCaseCode.Tag as EntityEmrBasicInfo).formId);
                    frm.ShowDialog();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// SaveForm
        /// </summary>
        /// <returns></returns>
        public bool SaveForm()
        {
            try
            {
                this.Cursor  = Cursors.WaitCursor;
                formCtrlData = this.loader.Save();

                if (formCtrlData != null && formCtrlData.Count > 0)
                {
                    string strFormCode = string.Empty;
                    string strFormName = string.Empty;

                    strFormCode = this.txtEfCode.Text.Trim();
                    if (string.IsNullOrEmpty(strFormCode))
                    {
                        DialogBox.Msg("请输申请单编码。", MessageBoxIcon.Exclamation);
                        this.txtEfCode.Focus();
                        return(false);
                    }

                    strFormName = this.txtEfName.Text.Trim();
                    if (string.IsNullOrEmpty(strFormName))
                    {
                        DialogBox.Msg("请输入申请单名称。", MessageBoxIcon.Exclamation);
                        this.txtEfName.Focus();
                        return(false);
                    }
                    int intVersion = Function.Int(this.cboVersion.Text);
                    if (intVersion == 0)
                    {
                        DialogBox.Msg("请输入版本号。", MessageBoxIcon.Exclamation);
                        this.cboVersion.Focus();
                        return(false);
                    }
                    int intStatus = this.cboEfStatus.SelectedIndex;

                    List <string> lstCtrl = new List <string>();
                    foreach (EntityFormCtrl ctrl in formCtrlData)
                    {
                        if (!string.IsNullOrEmpty(ctrl.ItemName))
                        {
                            if (lstCtrl.IndexOf(ctrl.ItemName) < 0)
                            {
                                lstCtrl.Add(ctrl.ItemName);
                            }
                            else
                            {
                                DialogBox.Msg("存在同名的控件名称:" + ctrl.ItemCaption + "(" + ctrl.ItemName + "),请修正。", MessageBoxIcon.Exclamation);
                                return(false);
                            }
                        }
                        else
                        {
                            if (Function.Int(ctrl.ItemType) > 0)
                            {
                                DialogBox.Msg("请录入项目代码:" + ctrl.ItemCaption, MessageBoxIcon.Exclamation);
                                return(false);
                            }
                        }
                    }

                    try
                    {
                        // 1.
                        EntityFormDesign formVo = new EntityFormDesign();
                        formVo.Formid          = FormId;
                        formVo.Formcode        = strFormCode;
                        formVo.Formname        = strFormName;
                        formVo.Formtype        = this.FormType;
                        formVo.Version         = intVersion;
                        formVo.Pycode          = SpellCodeHelper.GetPyCode(strFormName);
                        formVo.Wbcode          = SpellCodeHelper.GetWbCode(strFormName);
                        formVo.Recorderid      = GlobalLogin.objLogin.EmpNo;
                        formVo.RecorderName    = GlobalLogin.objLogin.EmpName;
                        formVo.Status          = intStatus;
                        formVo.Printtemplateid = this.PrintTemplateId;

                        int heightCtrl = 0;
                        foreach (EntityFormCtrl item in formCtrlData)
                        {
                            heightCtrl = Math.Max(item.Top, heightCtrl);
                        }
                        formVo.Panelsize = Convert.ToString(heightCtrl + 50) + "|" + pnlDesignPanel.Width.ToString();
                        // 2.
                        formVo.Layout = FormTool.LayoutXml(formCtrlData);

                        int             intAppFid = 0;
                        ProxyFormDesign proxy     = new ProxyFormDesign();
                        formVo.Recorddate = Common.Utils.Utils.ServerTime();

                        #region 一般表单处理

                        if (proxy.Service.SaveForm(formVo, out intAppFid) > 0)
                        {
                            if (this.FormId <= 0)
                            {
                                NewFlag = true;
                            }
                            else
                            {
                                if (!NewFlag)
                                {
                                    UpdateFlag = true;
                                }
                            }
                            this.ValueChanged = false;
                            this.FormId       = intAppFid;

                            if (wrapper != null)
                            {
                                wrapper.FormId = this.FormId;
                            }

                            bool isExsit = false;
                            int  count   = this.cboVersion.Properties.Items.Count;
                            for (int i = 0; i < count; i++)
                            {
                                if (this.cboVersion.Properties.Items[i].ToString() == formVo.Version.ToString())
                                {
                                    IsExists = true;
                                    break;
                                }
                            }
                            if (!isExsit)
                            {
                                this.cboVersion.Properties.Items.Add(formVo.Version.ToString());
                            }

                            this.IsSave = true;
                            DialogBox.Msg("保存表单成功!", MessageBoxIcon.Exclamation);
                            this.ValueChanged = false;
                            return(true);
                        }
                        else
                        {
                            DialogBox.Msg("保存表单失败。", MessageBoxIcon.Exclamation);
                        }
                        #endregion
                    }
                    catch (Exception e)
                    {
                        DialogBox.Msg(e.Message);
                        return(false);
                    }
                }
                else
                {
                    DialogBox.Msg("请制作表单。", MessageBoxIcon.Information);
                }
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// 设置行自动高
        /// </summary>
        private void SetRowAutoHeight()
        {
            if (Properties.gvData.OptionsView.RowAutoHeight && !isAutoRowHeight)
            {
                try
                {
                    this.SuspendLayout();
                    if (Properties == null || Properties.gvData.DataSource == null || Properties.gvData.Columns.Count == 0)
                    {
                        return;
                    }
                    isAutoRowHeight = true;

                    uiHelper.SetViewAppearance(Properties.gvData);
                    SetColumnGroup();
                    SetColumnVisible();
                    SetColumnWidth();

                    for (int i = 0; i < FieldName.Count; i++)
                    {
                        DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit memo = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
                        Properties.gvData.Columns[i].ColumnEdit          = memo;
                        Properties.gvData.Columns[i].AppearanceCell.Font = new System.Drawing.Font("宋体", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        Properties.gvData.Columns[i].AppearanceCell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;

                        if (Properties.ColumnCenterText.IndexOf(Properties.gvData.Columns[i].FieldName) >= 0)
                        {
                            Properties.gvData.Columns[i].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                            if (this.IsExistsGroup)
                            {
                                Properties.gvData.Columns[i].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
                            }
                        }
                    }

                    if (Properties.gvDataBindingSource.DataSource != null)
                    {
                        Properties.gvData.OptionsView.ShowColumnHeaders = Properties.IsShowColumnHeaders;
                        if (Properties.IsShowColumnHeaders && Properties.ColumnHeaders.Keys.Count > 0)
                        {
                            for (int i = 0; i < FieldName.Count; i++)
                            {
                                if (Properties.ColumnHeaders.ContainsKey(Properties.gvData.Columns[i].FieldName))
                                {
                                    Properties.gvData.Columns[i].AppearanceHeader.Font = new System.Drawing.Font("宋体", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                                    Properties.gvData.Columns[i].Caption = Properties.ColumnHeaders[Properties.gvData.Columns[i].FieldName];
                                    Properties.gvData.Columns[i].OptionsFilter.AllowAutoFilter = false;
                                    Properties.gvData.Columns[i].OptionsFilter.AllowFilter     = false;
                                    Properties.gvData.Columns[i].OptionsColumn.AllowSort       = DevExpress.Utils.DefaultBoolean.False;
                                }
                            }
                        }
                    }

                    Properties.gvData.ClearSelection();
                }
                catch (Exception e)
                {
                    DialogBox.Msg(e.Message);
                }
                finally
                {
                    this.IsInit            = false;
                    Properties.gcData.Dock = DockStyle.Fill;
                    this.ResumeLayout();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Save
        /// </summary>
        /// <param name="isExsit"></param>
        /// <returns></returns>
        internal bool Save(bool isExsit)
        {
            EntityFormDesign formVoOri = null;
            EntityFormDesign formVo    = new EntityFormDesign();
            bool             isNew     = false;

            if (Viewer.txtFormCode.Tag != null)
            {
                formVoOri        = Viewer.txtFormCode.Tag as EntityFormDesign;
                formVo.Formid    = formVoOri.Formid;
                formVo.Version   = formVoOri.Version;
                formVo.Panelsize = formVoOri.Panelsize;
                if (string.IsNullOrEmpty(formVoOri.Layout))
                {
                    using (ProxyFormDesign proxy = new ProxyFormDesign())
                    {
                        EntityFormDesign vo1 = proxy.Service.GetForm(formVoOri.Formid, true)[0];
                        formVoOri.Layout = vo1.Layout;
                    }
                }
                formVo.Layout     = formVoOri.Layout;
                formVo.Recorderid = formVoOri.Recorderid;
                formVo.Recorddate = formVoOri.Recorddate;
            }
            else
            {
                formVo.Version    = 1;
                formVo.Panelsize  = "100|100";
                formVo.Layout     = "<XmlData></XmlData>";
                formVo.Recorderid = GlobalLogin.objLogin.EmpNo;
                formVo.Recorddate = Common.Utils.Utils.ServerTime();
                isNew             = true;
            }
            formVo.Formtype = Function.Int(Viewer.FormType);
            formVo.Formcode = Viewer.txtFormCode.Text.Trim();
            if (string.IsNullOrEmpty(formVo.Formcode))
            {
                DialogBox.Msg("请输入表单编码。");
                Viewer.txtFormCode.Focus();
                return(false);
            }
            formVo.Formname = Viewer.txtFormName.Text.Trim();
            if (string.IsNullOrEmpty(formVo.Formname))
            {
                DialogBox.Msg("请输入表单名称。");
                Viewer.txtFormName.Focus();
                return(false);
            }
            formVo.Status = Viewer.rdoStatus.SelectedIndex;
            if (!string.IsNullOrEmpty(Viewer.luePrint.Properties.DBValue) && Viewer.luePrint.Properties.DBRow != null)
            {
                formVo.Printtemplateid = Function.Int(Viewer.luePrint.Properties.DBValue);
            }
            formVo.Pycode = SpellCodeHelper.GetPyCode(formVo.Formname);
            formVo.Wbcode = SpellCodeHelper.GetWbCode(formVo.Formname);

            try
            {
                uiHelper.BeginLoading(Viewer);
                using (ProxyFormDesign proxy = new ProxyFormDesign())
                {
                    int formId2 = 0;
                    if (proxy.Service.SaveForm(formVo, out formId2) > 0)
                    {
                        formVo.Formid          = formId2;
                        formVo.imageIndex      = 2;
                        formVo.isLeaf          = true;
                        Viewer.txtFormCode.Tag = formVo;
                        try
                        {
                            this.IsSaving = true;
                            if (isNew)
                            {
                                LoadDataSource();
                                FindForm(formId2.ToString(), true);
                            }
                        }
                        finally
                        {
                            this.IsSaving = false;
                        }
                        for (int i = 0; i < DataSourceForm.Count; i++)
                        {
                            if (DataSourceForm[i].Formid == formId2)
                            {
                                DataSourceForm[i] = formVo;
                                break;
                            }
                        }
                        Viewer.ValueChanged = false;
                        DialogBox.Msg("保存成功!!");
                    }
                    else
                    {
                        DialogBox.Msg("保存失败。");
                        return(false);
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// Save
        /// </summary>
        /// <param name="isExits"></param>
        /// <returns></returns>
        internal bool Save(bool isExits)
        {
            if (IsSaving)
            {
                return(false);
            }
            IsSaving = true;
            try
            {
                bool isNew = false;
                EntityEmrPrintTemplate templateVo = null;
                if (Viewer.txtTemplateCode.Tag == null)
                {
                    templateVo = new EntityEmrPrintTemplate();
                    templateVo.templatCreator = GlobalLogin.objLogin.EmpNo;
                    templateVo.templateDate   = Common.Utils.Utils.ServerTime();
                    isNew = true;
                }
                else
                {
                    templateVo = Viewer.txtTemplateCode.Tag as EntityEmrPrintTemplate;
                }
                templateVo.templateCode = Viewer.txtTemplateCode.Text.Trim();
                if (templateVo.templateCode == string.Empty)
                {
                    DialogBox.Msg("请输入模板编码。");
                    Viewer.txtTemplateCode.Focus();
                    return(false);
                }
                templateVo.templateName = Viewer.txtTemplateName.Text.Trim();
                if (templateVo.templateName == string.Empty)
                {
                    DialogBox.Msg("请输入模板名称。");
                    Viewer.txtTemplateName.Focus();
                    return(false);
                }
                templateVo.templateRemark  = Viewer.txtTemplateDesc.Text.Trim();
                templateVo.useEndDate      = Function.Datetimenull(Viewer.dteUseEndDate.EditValue);
                templateVo.acrossCols      = Function.Decnull(Viewer.txtTableCols.Text);
                templateVo.vrows           = Function.Decnull(Viewer.txtTableRows.Text);
                templateVo.templateVersion = Function.Int(Viewer.txtVersion.Text);
                if (Viewer.chkTemplateStyle1.Checked)
                {
                    templateVo.tableType = 0;
                }
                else if (Viewer.chkTemplateStyle2.Checked)
                {
                    templateVo.tableType = 1;
                }
                else if (Viewer.chkTemplateStyle3.Checked)
                {
                    templateVo.tableType = 2;
                }
                templateVo.pyCode = SpellCodeHelper.GetPyCode(templateVo.templateName);
                templateVo.wbCode = SpellCodeHelper.GetWbCode(templateVo.templateName);
                templateVo.status = 1;

                templateVo.templateColumns = System.Text.Encoding.Default.GetBytes(Viewer.lstDataCols.Text);
                using (ProxyFormDesign proxy = new ProxyFormDesign())
                {
                    int templateId = 0;
                    if (proxy.Service.SaveFormPrintTemplate(templateVo, out templateId) > 0)
                    {
                        Viewer.txtTemplateCode.Tag = templateVo;
                        if (isNew)
                        {
                            templateVo.imageIndex = 1;
                            templateVo.isLeaf     = true;
                            (Viewer.tvTemplate.DataSource as List <EntityEmrPrintTemplate>).Add(templateVo);
                            Viewer.tvTemplate.RefreshDataSource();
                            //Viewer.tvTemplate.FocusedNode = Viewer.tvTemplate.FindNodeByKeyID(templateId);
                            FindTemplate(templateId.ToString(), true);
                        }
                        else
                        {
                            int index = (Viewer.tvTemplate.DataSource as List <EntityEmrPrintTemplate>).FindIndex(t => t.templateId == templateId);
                            (Viewer.tvTemplate.DataSource as List <EntityEmrPrintTemplate>)[index] = templateVo;
                            Viewer.tvTemplate.RefreshDataSource();
                        }
                        DialogBox.Msg("保存打印模板成功!");
                    }
                    else
                    {
                        DialogBox.Msg("保存打印模板失败。");
                    }
                }
                Viewer.ValueChanged = false;
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
                return(false);
            }
            finally
            {
                IsSaving = false;
            }
            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// LoadTemplate
        /// </summary>
        /// <param name="tableVo"></param>
        void LoadTemplate(EntityEmrPrintTemplate templateVo)
        {
            if (isLoading || IsSaving)
            {
                return;
            }
            try
            {
                isLoading = true;
                uiHelper.BeginLoading(Viewer);
                Viewer.txtTemplateCode.Tag = templateVo;
                if (templateVo == null)
                {
                    Viewer.txtTemplateCode.Text      = string.Empty;
                    Viewer.txtTemplateName.Text      = string.Empty;
                    Viewer.txtTemplateDesc.Text      = string.Empty;
                    Viewer.dteUseEndDate.EditValue   = null;
                    Viewer.txtTableCols.Text         = "0";
                    Viewer.txtTableRows.Text         = "0";
                    Viewer.txtVersion.Text           = string.Empty;;
                    Viewer.chkTemplateStyle1.Checked = false;
                    Viewer.chkTemplateStyle2.Checked = false;
                    Viewer.chkTemplateStyle3.Checked = false;

                    Viewer.lstDataCols.ResetText();
                    xr = new XtraReport();
                    this.Viewer.ucPrintControl.PrintingSystem = xr.PrintingSystem;
                    xr.CreateDocument();
                }
                else
                {
                    Viewer.txtTemplateCode.Text    = templateVo.templateCode;
                    Viewer.txtTemplateName.Text    = templateVo.templateName;
                    Viewer.txtTemplateDesc.Text    = templateVo.templateRemark;
                    Viewer.dteUseEndDate.EditValue = templateVo.useEndDate;
                    Viewer.txtTableCols.Text       = templateVo.acrossCols == null ? "0" : templateVo.acrossCols.Value.ToString();
                    Viewer.txtTableRows.Text       = templateVo.vrows == null ? "0" : templateVo.vrows.Value.ToString();
                    Viewer.txtVersion.Text         = templateVo.templateVersion.ToString();

                    if (Function.Int(templateVo.tableType) == 0)
                    {
                        Viewer.chkTemplateStyle1.Checked = true;
                    }
                    else if (Function.Int(templateVo.tableType) == 1)
                    {
                        Viewer.chkTemplateStyle2.Checked = true;
                    }
                    else if (Function.Int(templateVo.tableType) == 2)
                    {
                        Viewer.chkTemplateStyle3.Checked = true;
                    }

                    #region 数据列
                    Viewer.lstDataCols.ResetText();
                    if (templateVo.templateColumns != null && templateVo.templateColumns.Length > 0)
                    {
                        string        colStr      = System.Text.Encoding.Default.GetString(templateVo.templateColumns);
                        char[]        sep         = new char[] { '\r', '\n' };
                        string[]      cols        = colStr.Split(sep, StringSplitOptions.RemoveEmptyEntries);
                        string[]      currCol     = null;
                        string        fieldName   = null;
                        string        displayName = null;
                        StringBuilder sb          = new StringBuilder();
                        foreach (string col in cols)
                        {
                            sb.AppendLine(col);
                        }
                        Viewer.lstDataCols.Text = sb.ToString();
                    }
                    #endregion

                    xr = new XtraReport();
                    if (templateVo.templateFile != null && templateVo.templateFile.Length > 0)
                    {
                        MemoryStream stream = new MemoryStream(templateVo.templateFile);
                        xr.LoadLayout(stream);
                        xr.DataSource = GetDataSource();
                    }
                    this.Viewer.ucPrintControl.PrintingSystem = xr.PrintingSystem;
                    xr.CreateDocument();
                }
                Viewer.ValueChanged = false;
            }
            catch (System.Exception e)
            {
                DialogBox.Msg(e.Message);
            }
            finally
            {
                isLoading = false;
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="isExit"></param>
        /// <returns></returns>
        internal bool Save(bool isExit)
        {
            // 1.mainInfo
            bool isRefresh = true;
            EntityEmrTableBasicInfo tableVo = new EntityEmrTableBasicInfo();
            EntityEmrTableBasicInfo tmpVo   = null;

            if (Viewer.txtTableCode.Tag != null)
            {
                tmpVo = Viewer.txtTableCode.Tag as EntityEmrTableBasicInfo;
                tableVo.origTableCode = tmpVo.tableCode;
            }
            tableVo.tableCode          = Viewer.txtTableCode.Text.Trim();
            tableVo.tableName          = Viewer.txtTableName.Text.Trim();
            tableVo.sortFieldName      = Viewer.txtSortFieldName.Text.Trim();
            tableVo.displayRows        = Function.Int(Viewer.txtRows.Text);
            tableVo.headerWidth        = Viewer.txtHeadWidth.Text.Trim();
            tableVo.rowHeight          = Function.Dec(Viewer.txtRowHeight.Text);
            tableVo.displayType        = (Viewer.chkTableStyle2.Checked ? 1 : 0);
            tableVo.tableHeaderDisplay = (Viewer.chkHeadStyle2.Checked ? 1 : 0);
            if (string.IsNullOrEmpty(tableVo.tableCode))
            {
                DialogBox.Msg("请输入表格代码。");
                Viewer.txtTableCode.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(tableVo.tableName))
            {
                DialogBox.Msg("请输入表格名称。");
                Viewer.txtTableName.Focus();
                return(false);
            }
            if (tableVo.displayRows.Value <= 0)
            {
                DialogBox.Msg("请输入表格行数。");
                Viewer.txtRows.Focus();
                return(false);
            }
            tableVo.pyCode = SpellCodeHelper.GetPyCode(tableVo.tableName);
            tableVo.wbCode = SpellCodeHelper.GetWbCode(tableVo.tableName);
            if (tmpVo != null && tmpVo.tableCode == tableVo.tableCode && tmpVo.tableName == tableVo.tableName)
            {
                isRefresh = false;
            }

            // 2.fieldInfo
            Viewer.gvTable.CloseEditor();
            List <EntityEmrTableFieldInfo> lstTableField = this.gvDataBindingSource.DataSource as List <EntityEmrTableFieldInfo>;

            if (lstTableField != null)
            {
                for (int i = lstTableField.Count - 1; i >= 0; i--)
                {
                    if (string.IsNullOrEmpty(lstTableField[i].bandName) && string.IsNullOrEmpty(lstTableField[i].fieldName))
                    {
                        lstTableField.RemoveAt(i);
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(lstTableField[i].bandName))
                        {
                            DialogBox.Msg(string.Format("第{0}行 分组名称不能为空,请输入.", Convert.ToString(i + 1)));
                            return(false);
                        }
                        if (string.IsNullOrEmpty(lstTableField[i].fieldName))
                        {
                            DialogBox.Msg(string.Format("第{0}行 字段名称不能为空,请输入.", Convert.ToString(i + 1)));
                            return(false);
                        }
                        lstTableField[i].tableCode = tableVo.tableCode;
                    }
                }
            }
            if (lstTableField != null && lstTableField.Count > 0)
            {
                //检查是否有两个以上相同字段
                foreach (EntityEmrTableFieldInfo item in lstTableField)
                {
                    if (lstTableField.Count(t => t.fieldName == item.fieldName) > 1)
                    {
                        DialogBox.Msg(string.Format("存在多个{0}字段", item.fieldName));
                        return(false);
                    }
                }
            }

            int ret = 0;

            using (ProxyFormDesign proxy = new ProxyFormDesign())
            {
                // 保存前检查
                if (string.IsNullOrEmpty(tableVo.origTableCode) || (!string.IsNullOrEmpty(tableVo.origTableCode) && tableVo.origTableCode != tableVo.tableCode))
                {
                    if (proxy.Service.IsExistsTableCodeOrName(tableVo.tableCode, tableVo.tableName))
                    {
                        DialogBox.Msg("表格代码、名称已经存在,请重新输入。");
                        return(false);
                    }
                }
                ret = proxy.Service.SaveTableInfo(tableVo, lstTableField);
            }
            if (ret > 0)
            {
                Viewer.ValueChanged = false;
                // 刷新树
                if (!isExit)
                {
                    if (isRefresh)
                    {
                        LoadDataSource(true);
                        FindTable(tableVo.tableCode, false);
                    }
                    tableVo.origTableCode   = string.Empty;
                    Viewer.txtTableCode.Tag = tableVo;
                }
                DialogBox.Msg("保存成功!");
                return(true);
            }
            else
            {
                DialogBox.Msg("保存失败。");
            }
            return(false);
        }
Esempio n. 8
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            uiHelper.BeginLoading(Viewer);
            try
            {
                MemoryStream ms = new MemoryStream();
                Viewer.xrDesignPanel.Report.SaveLayout(ms);
                ms.Seek(0, SeekOrigin.Begin);
                byte[] bytData = new byte[ms.Length];
                ms.Read(bytData, 0, bytData.Length);
                ms.Close();

                if (this.rptTypeId == 1)
                {
                    this.reportVo.rptFile = ms.ToArray();
                    using (ProxyFormDesign proxy = new ProxyFormDesign())
                    {
                        EntitySysReport updateVo = new EntitySysReport();
                        updateVo.rptId   = this.reportVo.rptId;
                        updateVo.rptFile = this.reportVo.rptFile;
                        if (proxy.Service.SaveReportFile(updateVo) > 0)
                        {
                            Viewer.IsSave = true;
                            Viewer.xrDesignPanel.ReportState = DevExpress.XtraReports.UserDesigner.ReportState.Saved;
                            DialogBox.Msg("保存成功!");
                        }
                        else
                        {
                            DialogBox.Msg("保存失败。");
                        }
                    }
                }
                else if (this.rptTypeId == 2)
                {
                    this.templateVo.templateFile = ms.ToArray();
                    using (ProxyFormDesign proxy = new ProxyFormDesign())
                    {
                        object obj = this.templateVo.dataSource;
                        this.templateVo.dataSource = null;
                        if (proxy.Service.UpdateFormPrintTemplate(this.templateVo) > 0)
                        {
                            Viewer.IsSave = true;
                            Viewer.xrDesignPanel.ReportState = DevExpress.XtraReports.UserDesigner.ReportState.Saved;
                            DialogBox.Msg("保存成功!");
                        }
                        else
                        {
                            DialogBox.Msg("保存失败。");
                        }
                        this.templateVo.dataSource = obj;
                    }
                }
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Save
        /// </summary>
        internal void Save()
        {
            EntityEmrBasicInfo caseVo = new EntityEmrBasicInfo();

            if (Viewer.txtCaseCode.Tag != null)
            {
                caseVo = Viewer.txtCaseCode.Tag as EntityEmrBasicInfo;
            }
            if (lueCataDatalog.Any(t => t.catalogId + "^" == caseVo.caseCode))
            {
                DialogBox.Msg("病历目录,无需保存。");
                return;
            }
            caseVo.caseCode         = Viewer.txtCaseCode.Text;
            caseVo.caseName         = Viewer.txtCaseName.Text;
            caseVo.formId           = Function.Int(Viewer.lueFormTemplate.Properties.DBValue);
            caseVo.printTemplateId  = Function.Int(Viewer.luePrintTemplate.Properties.DBValue);
            caseVo.typeId           = Viewer.cboFormType.SelectedIndex;
            caseVo.status           = Viewer.cboFormStatus.SelectedIndex;
            caseVo.catalogId        = Function.Int(Viewer.lueCaseCata.Properties.DBValue);
            caseVo.caseStyle        = Viewer.cboCaseStyle.SelectedIndex;
            caseVo.attribute        = Viewer.cboCaseAttribute.SelectedIndex - 1;
            caseVo.showCaseStatus   = Viewer.chkShowFormStatus1.Checked ? 1 : 0;
            caseVo.specialFlag      = Viewer.chkExpert1.Checked ? 1 : 0;
            caseVo.multiPageFlag    = Viewer.chkMultPage1.Checked ? 1 : 0;
            caseVo.referenceType    = Viewer.chkRef1.Checked ? 1 : 0;
            caseVo.bandingFlag      = Viewer.chkBanding1.Checked ? 1 : 0;
            caseVo.timeType         = Viewer.cboDateType.SelectedIndex;
            caseVo.lockDateDirector = Function.Int(Viewer.txtHeadOfDeptTime.EditValue);
            caseVo.timeLimit        = Function.Int(Viewer.txtWriteLimitTime.EditValue);
            caseVo.lockDateQcDept   = Function.Int(Viewer.txtQcOfDeptTime.EditValue);
            caseVo.timePeriod       = Function.Int(Viewer.txtTimePeriod.EditValue);
            caseVo.aheadTime        = Function.Int(Viewer.txtPriorTime.EditValue);
            caseVo.signLevel        = Viewer.cboSigLevel.SelectedIndex;
            caseVo.dirDoctSignFlag  = Viewer.chkHeadOfDeptCheck1.Checked ? 1 : 0;
            caseVo.supDoctSignFlag  = Viewer.chkSuperDoctCheck1.Checked ? 1 : 0;
            caseVo.caseScope        = 2; // 1 门诊病历; 2 住院病历

            if (string.IsNullOrEmpty(caseVo.caseCode) || caseVo.caseCode.Trim() == string.Empty)
            {
                DialogBox.Msg("请输入病历编码");
                Viewer.txtCaseCode.Focus();
                return;
            }

            if (string.IsNullOrEmpty(caseVo.caseName) || caseVo.caseName.Trim() == string.Empty)
            {
                DialogBox.Msg("请输入病历名称");
                Viewer.txtCaseName.Focus();
                return;
            }

            List <EntityEmrDept> lstEmrDept = new List <EntityEmrDept>();

            using (ProxyCommon proxy = new ProxyCommon())
            {
                bool isNew = caseVo.serNo <= 0 ? true : false;
                if (proxy.Service.SaveCaseBasicInfo(ref caseVo, lstEmrDept))
                {
                    Viewer.txtCaseCode.Tag = caseVo;
                    if (isNew)
                    {
                        this.RefreshData();
                    }
                    DialogBox.Msg("保存成功");
                }
                else
                {
                    DialogBox.Msg("保存失败");
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// LoadForm
        /// </summary>
        /// <param name="formVo"></param>
        void LoadFormData(EntityEmrBasicInfo caseVo)
        {
            try
            {
                uiHelper.BeginLoading(Viewer);
                Viewer.page1.Controls.Clear();
                Panel pnl = new Panel();
                pnl.BackColor = Color.FromArgb(196, 200, 205);
                pnl.Height    = 30;
                pnl.Dock      = DockStyle.Bottom;
                if (caseVo == null)
                {
                    Viewer.txtCaseCode.Text            = string.Empty;
                    Viewer.txtCaseName.Text            = string.Empty;
                    Viewer.lueFormTemplate.Text        = string.Empty;
                    Viewer.luePrintTemplate.Text       = string.Empty;
                    Viewer.cboVersion.Text             = string.Empty;
                    Viewer.cboFormType.Text            = string.Empty;
                    Viewer.cboFormStatus.Text          = string.Empty;
                    Viewer.lueCaseCata.Text            = string.Empty;;
                    Viewer.cboCaseStyle.Text           = string.Empty;
                    Viewer.cboCaseAttribute.Text       = string.Empty;
                    Viewer.chkShowFormStatus1.Checked  = false;
                    Viewer.chkShowFormStatus2.Checked  = false;
                    Viewer.chkExpert1.Checked          = false;
                    Viewer.chkExpert2.Checked          = false;
                    Viewer.chkMultPage1.Checked        = false;
                    Viewer.chkMultPage2.Checked        = false;
                    Viewer.chkRef1.Checked             = false;
                    Viewer.chkRef2.Checked             = false;
                    Viewer.chkBanding1.Checked         = false;
                    Viewer.chkBanding2.Checked         = false;
                    Viewer.cboDateType.Text            = string.Empty;
                    Viewer.txtHeadOfDeptTime.EditValue = null;
                    Viewer.txtWriteLimitTime.EditValue = null;
                    Viewer.txtQcOfDeptTime.EditValue   = null;
                    Viewer.txtTimePeriod.EditValue     = null;
                    Viewer.txtPriorTime.EditValue      = null;
                    Viewer.cboSigLevel.Text            = string.Empty;
                    Viewer.chkHeadOfDeptCheck1.Checked = false;
                    Viewer.chkHeadOfDeptCheck2.Checked = false;
                    Viewer.chkSuperDoctCheck1.Checked  = false;
                    Viewer.chkSuperDoctCheck2.Checked  = false;
                    Viewer.gcDept.DataSource           = null;
                }
                else
                {
                    if (caseVo.formId > 0)
                    {
                        ShowPanelForm efPanel = new ShowPanelForm((int)caseVo.formId);
                        efPanel.Location = new Point(12, 10);

                        XtraScrollableControl scrollCtrl = new XtraScrollableControl();
                        scrollCtrl.Dock      = DockStyle.Fill;
                        scrollCtrl.BackColor = Color.FromArgb(196, 200, 205);
                        scrollCtrl.Controls.Add(efPanel);
                        scrollCtrl.Controls.Add(pnl);
                        Viewer.page1.Controls.Add(scrollCtrl);
                    }

                    Viewer.txtCaseCode.Text = caseVo.caseCode;
                    Viewer.txtCaseName.Text = caseVo.caseName;
                    Viewer.lueFormTemplate.Properties.DBValue = caseVo.formId.ToString();
                    SetLueFormTemplate(caseVo.formId);
                    Viewer.luePrintTemplate.Properties.DBValue = caseVo.printTemplateId.ToString();
                    SetLuePrintTemplate(caseVo.printTemplateId);
                    Viewer.cboVersion.Text                = "1";
                    Viewer.cboFormType.SelectedIndex      = (int)caseVo.typeId;
                    Viewer.cboFormStatus.SelectedIndex    = caseVo.status;
                    Viewer.lueCaseCata.Properties.DBValue = caseVo.catalogId.ToString();
                    SetLueCaseCata(caseVo.catalogId);
                    Viewer.cboCaseStyle.SelectedIndex     = caseVo.caseStyle;
                    Viewer.cboCaseAttribute.SelectedIndex = Function.Int(caseVo.attribute) + 1;
                    Viewer.chkShowFormStatus1.Checked     = caseVo.showCaseStatus == 1 ? true : false;
                    Viewer.chkShowFormStatus2.Checked     = caseVo.showCaseStatus == 0 ? true : false;
                    Viewer.chkExpert1.Checked             = caseVo.specialFlag == 1 ? true : false;
                    Viewer.chkExpert2.Checked             = caseVo.specialFlag == 0 ? true : false;
                    Viewer.chkMultPage1.Checked           = caseVo.multiPageFlag == 1 ? true : false;
                    Viewer.chkMultPage2.Checked           = caseVo.multiPageFlag == 0 ? true : false;
                    Viewer.chkRef1.Checked             = caseVo.referenceType == 1 ? true : false;
                    Viewer.chkRef2.Checked             = caseVo.referenceType == 0 ? true : false;
                    Viewer.chkBanding1.Checked         = caseVo.bandingFlag == 1 ? true : false;
                    Viewer.chkBanding2.Checked         = caseVo.bandingFlag == 0 ? true : false;
                    Viewer.cboDateType.SelectedIndex   = caseVo.timeType;
                    Viewer.txtHeadOfDeptTime.EditValue = caseVo.lockDateDirector;
                    Viewer.txtWriteLimitTime.EditValue = caseVo.timeLimit;
                    Viewer.txtQcOfDeptTime.EditValue   = caseVo.lockDateQcDept;
                    Viewer.txtTimePeriod.EditValue     = caseVo.timePeriod;
                    Viewer.txtPriorTime.EditValue      = caseVo.aheadTime;
                    Viewer.cboSigLevel.SelectedIndex   = caseVo.signLevel;
                    Viewer.chkHeadOfDeptCheck1.Checked = caseVo.dirDoctSignFlag == 1 ? true : false;
                    Viewer.chkHeadOfDeptCheck2.Checked = caseVo.dirDoctSignFlag == 0 ? true : false;
                    Viewer.chkSuperDoctCheck1.Checked  = caseVo.supDoctSignFlag == 1 ? true : false;
                    Viewer.chkSuperDoctCheck2.Checked  = caseVo.supDoctSignFlag == 0 ? true : false;
                    LoadCaseDept(caseVo.caseCode);
                }
                // form.Main
                Viewer.txtCaseCode.Tag = caseVo;
            }
            catch (System.Exception e)
            {
                DialogBox.Msg(e.Message);
            }
            finally
            {
                uiHelper.CloseLoading(Viewer);
            }
        }