Ejemplo n.º 1
0
        private void m_mthFilter(int p_intElementID)
        {
            ProxyCommon proxy = new ProxyCommon();

            lstTemplateSource = proxy.Service.GetElementTemplate(p_intElementID);
            proxy             = null;
            if (lstTemplateSource != null)
            {
                foreach (EntityElementTemplate obj in lstTemplateSource)
                {
                    obj.pyCode = SpellCodeHelper.GetPyCode(obj.colcontent);
                    obj.wbCode = SpellCodeHelper.GetWbCode(obj.colcontent);
                }
                BindingListView <EntityElementTemplate> bindingSource = new BindingListView <EntityElementTemplate>();
                bindingSource.AddRange(lstTemplateSource);
                this.clstElement.DisplayMember = EntityElementTemplate.Columns.colcontent;
                this.clstElement.ValueMember   = EntityElementTemplate.Columns.serno;
                this.clstElement.DataSource    = bindingSource;
                for (int i = 0; i < bindingSource.Count; i++)
                {
                    this.clstElement.SetItemChecked(i, false);
                }
            }
            else
            {
                this.clstElement.DataSource = null;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 通用字典
 /// </summary>
 void LoadDicCommon()
 {
     try
     {
         using (ProxyEntityFactory proxy = new ProxyEntityFactory())
         {
             GlobalDic.DataSourceDicCommon = EntityTools.ConvertToEntityList <EntityCommonDic>(proxy.Service.SelectFullTable(new EntityCommonDic()));
             if (GlobalDic.DataSourceDicCommon != null)
             {
                 foreach (EntityCommonDic item in GlobalDic.DataSourceDicCommon)
                 {
                     if (!string.IsNullOrEmpty(item.Itemname))
                     {
                         item.Pycode = SpellCodeHelper.GetPyCode(item.Itemname);
                         item.Wbcode = SpellCodeHelper.GetWbCode(item.Itemname);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// LoadDicFee
 /// </summary>
 void LoadDicFee()
 {
     try
     {
         using (ProxyEntityFactory proxy = new ProxyEntityFactory())
         {
             DataTable dt = proxy.Service.SelectFullTable(new EntityCodeFee());
             GlobalDic.DataSourceDicFee = EntityTools.ConvertToEntityList <EntityCodeFee>(dt);
             if (GlobalDic.DataSourceDicFee != null)
             {
                 for (int i = GlobalDic.DataSourceDicFee.Count - 1; i >= 0; i--)
                 {
                     if (!string.IsNullOrEmpty(GlobalDic.DataSourceDicFee[i].instFlag) && GlobalDic.DataSourceDicFee[i].instFlag.ToUpper() == "T" &&
                         GlobalDic.DataSourceDicFee[i].leafFlag.ToUpper() == "T")
                     {
                         GlobalDic.DataSourceDicFee[i].pyCode = SpellCodeHelper.GetPyCode(GlobalDic.DataSourceDicFee[i].feeName);
                         GlobalDic.DataSourceDicFee[i].wbCode = SpellCodeHelper.GetWbCode(GlobalDic.DataSourceDicFee[i].feeName);
                     }
                     else
                     {
                         GlobalDic.DataSourceDicFee.RemoveAt(i);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// LoadDataSource
        /// </summary>
        void LoadDataSource(bool isFind)
        {
            this.isInit = true;
            using (ProxyEntityFactory proxy = new ProxyEntityFactory())
            {
                DataTable dt = proxy.Service.SelectFullTable(new EntityEmrTableBasicInfo());
                DataSourceTable = EntityTools.ConvertToEntityList <EntityEmrTableBasicInfo>(dt);
            }
            if (DataSourceTable == null)
            {
                DataSourceTable = new List <EntityEmrTableBasicInfo>();
            }
            foreach (EntityEmrTableBasicInfo item in DataSourceTable)
            {
                if (string.IsNullOrEmpty(item.pyCode))
                {
                    item.pyCode = SpellCodeHelper.GetPyCode(item.tableName);
                }
                if (string.IsNullOrEmpty(item.wbCode))
                {
                    item.wbCode = SpellCodeHelper.GetWbCode(item.tableName);
                }
                item.imageIndex = 1;
                item.parent     = "99";
                item.isLeaf     = true;
            }
            EntityEmrTableBasicInfo defaultVo = null;

            if (DataSourceTable.Count > 0 && defaultVo == null)
            {
                defaultVo = DataSourceTable[0];
            }
            EntityEmrTableBasicInfo vo = new EntityEmrTableBasicInfo();

            vo.tableCode  = "99";
            vo.tableName  = "全部表格";
            vo.imageIndex = 2;
            DataSourceTable.Add(vo);

            Viewer.tvTable.BeginUpdate();
            Viewer.tvTable.DataSource = DataSourceTable;
            Viewer.tvTable.ExpandAll();
            Viewer.tvTable.EndUpdate();
            if (defaultVo != null && isFind == false)
            {
                LoadTable(defaultVo);
            }
            Viewer.ValueChanged = false;
            this.isInit         = false;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取员工-科室对应表
        /// </summary>
        /// <returns></returns>
        public List <EntityDefDeptemployee> GetDefDeptEmployee()
        {
            string Sql = string.Empty;
            List <EntityDefDeptemployee> data = new List <EntityDefDeptemployee>();
            SqlHelper svc = null;

            try
            {
                Sql = @"select b.defaultflag as defaultflag,
                               null          as deptid,
                               a.dept_code   as deptcode,
                               a.dept_name   as deptname,
                               a.py_code     as pycode,
                               a.wb_code     as wbcode,
                               c.OPER_CODE   as operCode,
                               c.OPER_NAME   as operName
                          from code_department a
                         inner join defDeptemployee b
                            on a.dept_code = b.deptcode
                         inner join code_operator c
                            on b.operCode = c.OPER_CODE";
                svc = new SqlHelper(EnumBiz.onlineDB);
                DataTable             dt = svc.GetDataTable(Sql);
                EntityDefDeptemployee vo = null;
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        vo             = new EntityDefDeptemployee();
                        vo.operCode    = dr["operCode"].ToString();
                        vo.deptCode    = dr["deptcode"].ToString();
                        vo.defaultFlag = Function.Int(dr["defaultflag"].ToString());
                        vo.deptName    = dr["deptname"].ToString();
                        vo.operName    = dr["operName"].ToString();
                        vo.pyCode      = SpellCodeHelper.GetPyCode(dr["operName"].ToString());
                        vo.wbCode      = SpellCodeHelper.GetWbCode(dr["operName"].ToString());
                        data.Add(vo);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message));
            }
            finally
            {
                svc = null;
            }
            return(data);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadDataSource
        /// </summary>
        internal void LoadDataSource(bool isFind)
        {
            this.isInit = true;
            using (ProxyEntityFactory proxy = new ProxyEntityFactory())
            {
                DataTable dt = proxy.Service.SelectFullTable(new EntityEmrPrintTemplate());
                DataSourcePrtTemplate = EntityTools.ConvertToEntityList <EntityEmrPrintTemplate>(dt);
            }
            if (DataSourcePrtTemplate == null)
            {
                DataSourcePrtTemplate = new List <EntityEmrPrintTemplate>();
            }
            foreach (EntityEmrPrintTemplate item in DataSourcePrtTemplate)
            {
                if (string.IsNullOrEmpty(item.pyCode))
                {
                    item.pyCode = SpellCodeHelper.GetPyCode(item.templateName);
                }
                if (string.IsNullOrEmpty(item.wbCode))
                {
                    item.wbCode = SpellCodeHelper.GetWbCode(item.templateName);
                }
                item.imageIndex = 1;
                //item.parent = "999999999";
                item.isLeaf = true;
            }
            EntityEmrPrintTemplate defaultVo = null;

            if (DataSourcePrtTemplate.Count > 0 && defaultVo == null)
            {
                defaultVo = DataSourcePrtTemplate[0];
            }
            //EntityEmrPrintTemplate vo = new EntityEmrPrintTemplate();
            //vo.templateId = 999999999;
            //vo.templateName = "全部模板";
            //vo.imageIndex = 2;
            //DataSourcePrtTemplate.Add(vo);

            Viewer.tvTemplate.BeginUpdate();
            Viewer.tvTemplate.DataSource = DataSourcePrtTemplate;
            Viewer.tvTemplate.ExpandAll();
            Viewer.tvTemplate.EndUpdate();
            if (defaultVo != null && isFind == false)
            {
                LoadTemplate(defaultVo);
            }
            Viewer.ValueChanged = false;
            this.isInit         = false;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// GetTopicItems
        /// </summary>
        /// <param name="fieldId"></param>
        /// <returns></returns>
        public List <EntityDicQnSummary> GetTopicItems(string fieldId)
        {
            SqlHelper svc = new SqlHelper(EnumBiz.onlineDB);
            List <EntityDicQnSummary> data = EntityTools.ConvertToEntityList <EntityDicQnSummary>(svc.Select(new EntityDicQnSummary()
            {
                parentFieldId = fieldId
            }, EntityDicQnSummary.Columns.parentFieldId));

            if (data != null)
            {
                data.Sort();
                foreach (EntityDicQnSummary item in data)
                {
                    item.pyCode = SpellCodeHelper.GetPyCode(item.fieldName);
                    item.wbCode = SpellCodeHelper.GetWbCode(item.fieldName);
                }
            }
            return(data);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// LoadDicJob
 /// </summary>
 void LoadDicJob()
 {
     try
     {
         using (ProxyEntityFactory proxy = new ProxyEntityFactory())
         {
             GlobalDic.DataSourceDicJob = EntityTools.ConvertToEntityList <EntityCodeJob>(proxy.Service.SelectFullTable(new EntityCodeJob()));
             if (GlobalDic.DataSourceDicJob != null)
             {
                 foreach (EntityCodeJob item in GlobalDic.DataSourceDicJob)
                 {
                     item.pyCode = SpellCodeHelper.GetPyCode(item.name);
                     item.wbCode = SpellCodeHelper.GetWbCode(item.name);
                 }
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// GetTopics
        /// </summary>
        /// <returns></returns>
        public List <EntityDicQnSetting> GetTopics()
        {
            SqlHelper svc = new SqlHelper(EnumBiz.onlineDB);
            List <EntityDicQnSetting> data = EntityTools.ConvertToEntityList <EntityDicQnSetting>(svc.Select(new EntityDicQnSetting()
            {
                isParent = 1, status = 1
            }, new List <string>()
            {
                EntityDicQnSetting.Columns.isParent, EntityDicQnSetting.Columns.status
            }));

            if (data != null)
            {
                data.Sort();
                foreach (EntityDicQnSetting item in data)
                {
                    item.pyCode = SpellCodeHelper.GetPyCode(item.fieldName);
                    item.wbCode = SpellCodeHelper.GetWbCode(item.fieldName);
                }
            }
            return(data);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// LoadDicFrequency
 /// </summary>
 void LoadDicFrequency()
 {
     try
     {
         using (ProxyEntityFactory proxy = new ProxyEntityFactory())
         {
             DataTable dt = proxy.Service.SelectFullTable(new EntityCodeFrequency());
             GlobalDic.DataSourceDicFrequency = EntityTools.ConvertToEntityList <EntityCodeFrequency>(dt);
             if (GlobalDic.DataSourceDicFrequency != null)
             {
                 foreach (EntityCodeFrequency item in GlobalDic.DataSourceDicFrequency)
                 {
                     item.pyCode = SpellCodeHelper.GetPyCode(item.freqName);
                     item.wbCode = SpellCodeHelper.GetWbCode(item.freqName);
                 }
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 保存.电子申请单
        /// </summary>
        /// <param name="formVo"></param>
        /// <param name="formId"></param>
        /// <returns></returns>
        public int SaveForm(EntityFormDesign formVo, out int formId)
        {
            int       affectRows = 0;
            string    Sql        = string.Empty;
            SqlHelper svc        = null;

            formId = 0;
            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                List <DacParm> lstPara = new List <DacParm>();

                bool isExsit = true;
                if (formVo.Formid <= 0)
                {
                    isExsit       = false;
                    formVo.Formid = svc.GetNextID(EntityTools.GetTableName(formVo), EntityTools.GetFieldName(formVo, EntityFormDesign.Columns.Formid));
                }
                lstPara.Add(svc.GetInsertParm(formVo));

                if (isExsit == false)
                {
                    string tbName = "emrFormRtf" + formVo.Formid.ToString();

                    // 自动生成
                    EntityEmrBasicInfo vo = new EntityEmrBasicInfo();
                    vo.typeId    = 1;
                    vo.formId    = formVo.Formid;
                    vo.formName  = formVo.Formname;
                    vo.caseCode  = formVo.Formid.ToString();
                    vo.pyCode    = SpellCodeHelper.GetPyCode(formVo.Formname);
                    vo.wbCode    = SpellCodeHelper.GetWbCode(formVo.Formname);
                    vo.tableName = tbName;
                    vo.attribute = 0;
                    vo.showType  = 0;
                    vo.caseStyle = 0;
                    vo.catalogId = 23;  // 其他类
                    vo.fieldXml  = EmrTool.GetBasicFieldXml(formVo.Layout);
                    vo.status    = 1;
                    lstPara.Add(svc.GetInsertParm(vo));

                    Sql = @"if exists (select 1
                                        from  sysobjects
                                       where  id = object_id('{0}')
                                        and   type = 'U')
                               drop table {1}";
                    lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName)));

                    Sql = @"create table {0} (                               
                               registerid           varchar(20)          not null,
                               recorddate           datetime             not null,
                               fieldname            varchar(50)          not null,
                               rowindex             numeric(10,0)        not null,
                               tablecode            varchar(100)         null,
                               contentrtf           image                null,
                               printrtf             image                null,
                               isprint              numeric(1,0)         not null,
                               constraint pk_{0} primary key (registerid, recorddate, fieldname, rowindex)
                            )";
                    lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName)));
                }
                else
                {
                    EntityEmrBasicInfo vo = new EntityEmrBasicInfo();
                    vo.formId   = formVo.Formid;
                    vo.formName = formVo.Formname;
                    vo.pyCode   = SpellCodeHelper.GetPyCode(formVo.Formname);
                    vo.wbCode   = SpellCodeHelper.GetWbCode(formVo.Formname);
                    vo.fieldXml = EmrTool.GetBasicFieldXml(formVo.Layout);
                    DataTable dt = svc.Select(vo, new List <string>()
                    {
                        EntityEmrBasicInfo.Columns.formId
                    });
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        lstPara.Add(svc.GetUpdateParm(vo, new List <string>()
                        {
                            EntityEmrBasicInfo.Columns.formName, EntityEmrBasicInfo.Columns.pyCode,
                            EntityEmrBasicInfo.Columns.wbCode, EntityEmrBasicInfo.Columns.fieldXml
                        },
                                                      new List <string>()
                        {
                            EntityEmrBasicInfo.Columns.formId
                        }));
                    }
                }

                if (formVo.Formid > 0)
                {
                    using (TransactionScope scope = svc.TransactionScope)
                    {
                        if (DelForm((int)formVo.Formid, (int)formVo.Version) < 0)
                        {
                            return(-1);
                        }
                        affectRows = svc.Commit(lstPara);
                        scope.Complete();
                    }
                }
                else
                {
                    affectRows = svc.Commit(lstPara);
                }
                formId = (int)formVo.Formid;
                if (formId > 0 && affectRows <= 0)
                {
                    affectRows = 1;
                }
            }
            catch (Exception e)
            {
                ExceptionLog.OutPutException(e);
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存.电子申请单
        /// </summary>
        /// <param name="formVo"></param>
        /// <param name="formId"></param>
        /// <returns></returns>
        public int SaveForm(EntityFormDesign formVo, out int formId)
        {
            int       affectRows = 0;
            string    Sql        = string.Empty;
            SqlHelper svc        = null;

            formId = 0;
            try
            {
                svc = new SqlHelper(EnumBiz.onlineDB);
                List <DacParm> lstPara = new List <DacParm>();

                bool isExsit = true;
                if (formVo.Formid <= 0)
                {
                    isExsit       = false;
                    formVo.Formid = svc.GetNextID(EntityTools.GetTableName(formVo), EntityTools.GetFieldName(formVo, EntityFormDesign.Columns.Formid));
                }
                lstPara.Add(svc.GetInsertParm(formVo));

                if (Function.Int(formVo.Formtype) < 3)
                {
                    if (isExsit == false)
                    {
                        string tbName = "emrFormRtf" + formVo.Formid.ToString();

                        // 自动生成
                        EntityEmrBasicInfo vo = new EntityEmrBasicInfo();
                        vo.typeId    = 1;
                        vo.formId    = formVo.Formid;
                        vo.caseName  = formVo.Formname;
                        vo.caseCode  = formVo.Formid.ToString();
                        vo.pyCode    = SpellCodeHelper.GetPyCode(formVo.Formname);
                        vo.wbCode    = SpellCodeHelper.GetWbCode(formVo.Formname);
                        vo.tableName = tbName;
                        vo.attribute = 0;
                        vo.showType  = 0;
                        vo.caseStyle = 0;
                        vo.catalogId = 23;  // 其他类
                        vo.fieldXml  = EmrTool.GetBasicFieldXml(formVo.Layout);
                        vo.status    = 1;
                        lstPara.Add(svc.GetInsertParm(vo));

                        if (svc.enumDBMS == EnumDBMS.Oracle)
                        {
                        }
                        else
                        {
                            Sql = @"if exists (select 1
                                                from  sysobjects
                                               where  id = object_id('{0}')
                                                and   type = 'U')
                                       drop table {1}";
                            lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName)));

                            Sql = @"create table {0} (                               
                                           registerid           varchar(20)          not null,
                                           recorddate           datetime             not null,
                                           fieldname            varchar(50)          not null,
                                           rowindex             numeric(10,0)        not null,
                                           tablecode            varchar(100)         null,
                                           contentrtf           image                null,
                                           printrtf             image                null,
                                           isprint              numeric(1,0)         not null,
                                           constraint pk_{0} primary key (registerid, recorddate, fieldname, rowindex)
                                        )";
                        }

                        lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, string.Format(Sql, tbName, tbName)));
                    }
                    else
                    {
                        EntityEmrBasicInfo vo = new EntityEmrBasicInfo();
                        vo.formId   = formVo.Formid;
                        vo.caseName = formVo.Formname;
                        vo.pyCode   = SpellCodeHelper.GetPyCode(formVo.Formname);
                        vo.wbCode   = SpellCodeHelper.GetWbCode(formVo.Formname);
                        vo.fieldXml = EmrTool.GetBasicFieldXml(formVo.Layout);
                        DataTable dt = svc.Select(vo, new List <string>()
                        {
                            EntityEmrBasicInfo.Columns.formId
                        });
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            //lstPara.Add(svc.GetUpdateParm(vo, new List<string>() { EntityEmrBasicInfo.Columns.caseName, EntityEmrBasicInfo.Columns.pyCode,
                            //                                                   EntityEmrBasicInfo.Columns.wbCode, EntityEmrBasicInfo.Columns.fieldXml },
                            //                                  new List<string>() { EntityEmrBasicInfo.Columns.formId }));
                            Sql = @"update emrBasicInfo
                                       set caseName = ?, pyCode = ?, wbCode = ?, fieldXml = ?
                                     where formId = ?";

                            IDataParameter[] parms = svc.CreateParm(5);
                            parms[0].Value = vo.caseName;
                            parms[1].Value = vo.pyCode;
                            parms[2].Value = vo.wbCode;
                            parms[3].Value = vo.fieldXml;
                            if (!string.IsNullOrEmpty(vo.fieldXml) && vo.fieldXml.Trim() != null)
                            {
                                parms[3].ParameterName = "xmltype";
                            }
                            parms[4].Value = vo.formId;
                            lstPara.Add(svc.GetDacParm(EnumExecType.ExecSql, Sql, parms));
                        }
                    }
                }
                if (formVo.Formid > 0)
                {
                    using (TransactionScope scope = svc.TransactionScope)
                    {
                        if (DelForm((int)formVo.Formid, (int)formVo.Version) < 0)
                        {
                            return(-1);
                        }
                        affectRows = svc.Commit(lstPara);
                        scope.Complete();
                    }
                }
                else
                {
                    affectRows = svc.Commit(lstPara);
                }
                formId = (int)formVo.Formid;
                if (formId > 0 && affectRows <= 0)
                {
                    affectRows = 1;
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.OutPutException(Function.GetExceptionCaption(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message));
                affectRows = -1;
            }
            finally
            {
                svc = null;
            }
            return(affectRows);
        }
Ejemplo n.º 13
0
 private void txtTemplateName_EditValueChanged(object sender, EventArgs e)
 {
     txtPYCode.Text = SpellCodeHelper.GetPyCode(txtTemplateName.Text);
     txtWBCode.Text = SpellCodeHelper.GetWbCode(txtTemplateName.Text);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Save
        /// </summary>
        /// <param name="isExit"></param>
        internal void Save(bool isExit)
        {
            // 1.main
            EntityCodeOperator mainVo = new EntityCodeOperator();

            mainVo.operCode = Viewer.txtEmpNo.Text.Trim();
            mainVo.operName = Viewer.txtEmpName.Text.Trim();
            mainVo.pwd      = Viewer.txtPwd.Text;
            if (mainVo.pwd != string.Empty)
            {
                if (1 != 1)
                {
                    mainVo.pwd = (new clsSymmetricAlgorithm()).Encrypt(mainVo.pwd, clsSymmetricAlgorithm.enmSymmetricAlgorithmType.DES);
                }
            }
            if (Viewer.cboStatus.SelectedIndex == 2)
            {
                mainVo.disable = "T";
            }
            else if (Viewer.cboStatus.SelectedIndex == 1)
            {
                mainVo.disable = "F";
            }
            else
            {
                mainVo.disable = "F";
            }
            mainVo.ukey      = Viewer.txtCakey.Text.Trim();
            mainVo.innerFlag = "T";

            EntityPlusOperator plusVo = new EntityPlusOperator();

            plusVo.operCode = mainVo.operCode;
            plusVo.pyCode   = SpellCodeHelper.GetPyCode(mainVo.operName);
            plusVo.wbCode   = SpellCodeHelper.GetWbCode(mainVo.operName);
            plusVo.clsCode  = Viewer.lueType.Properties.DBValue;
            plusVo.dutyCode = Viewer.lueDuty.Properties.DBValue;
            plusVo.rankCode = Viewer.lueRank.Properties.DBValue;
            if (!string.IsNullOrEmpty(plusVo.clsCode))
            {
                plusVo.clsCode = plusVo.clsCode.Trim();
            }
            if (!string.IsNullOrEmpty(plusVo.dutyCode))
            {
                plusVo.dutyCode = plusVo.dutyCode.Trim();
            }
            if (!string.IsNullOrEmpty(plusVo.rankCode))
            {
                plusVo.rankCode = plusVo.rankCode.Trim();
            }
            if (Viewer.gvDept.RowCount > 0)
            {
                plusVo.deptCode = GetFieldValueStr(Viewer.gvDept, 0, EntityDefDeptemployee.Columns.deptCode);
            }
            else
            {
                plusVo.deptCode = "&";
            }
            plusVo.birth = Viewer.dtmBirth.Text;
            plusVo.tel   = Viewer.txtContactTel.Text.Trim();
            plusVo.addr  = Viewer.txtContactAddr.Text.Trim();
            plusVo.sex   = Viewer.cboSex.SelectedIndex.ToString();

            #region 校验

            if (string.IsNullOrEmpty(mainVo.operCode))
            {
                DialogBox.Msg("请输入职工编码。");
                Viewer.txtEmpNo.Focus();
                return;
            }

            if (string.IsNullOrEmpty(mainVo.operName))
            {
                DialogBox.Msg("请输入职工名称");
                Viewer.txtEmpName.Focus();
                return;
            }

            if (string.IsNullOrEmpty(plusVo.rankCode))
            {
                DialogBox.Msg("请选择职工职称");
                Viewer.lueRank.Focus();
                return;
            }

            if (string.IsNullOrEmpty(plusVo.clsCode))
            {
                DialogBox.Msg("请选择职工类型");
                Viewer.lueType.Focus();
                return;
            }
            #endregion

            // 1.main
            EntityCodeOperator operOrig = new EntityCodeOperator();
            if (Viewer.txtEmpNo.Tag != null)
            {
                operOrig = Viewer.txtEmpNo.Tag as EntityCodeOperator;
            }

            ProxyDictionary proxy = new ProxyDictionary();
            int             ret   = proxy.Service.SaveOperator(mainVo, plusVo, operOrig);
            proxy = null;
            if (ret > 0)
            {
                Viewer.ValueChanged = false;
                // 刷新树
                if (!isExit)
                {
                    Viewer.txtEmpNo.Tag = mainVo;
                    Refresh();
                    FindDept(plusVo.deptCode);
                    for (int i = 0; i < Viewer.gvEmployee.RowCount; i++)
                    {
                        if (GetFieldValueStr(Viewer.gvEmployee, i, EntityOperatorDisp.Columns.operCode) == mainVo.operCode)
                        {
                            Viewer.gvEmployee.FocusedRowHandle = i;
                            break;
                        }
                    }
                }
                DialogBox.Msg("保存成功!");
            }
            else
            {
                DialogBox.Msg("保存失败。");
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Init
 /// </summary>
 void Init()
 {
     //
     DataSourceForm = new List <EntityObjectList>();
     //
     this.lueForm.Properties.PopupWidth          = 280;
     this.lueForm.Properties.PopupHeight         = 400;
     this.lueForm.Properties.ValueColumn         = EntityObjectList.Columns.formId;
     this.lueForm.Properties.DisplayColumn       = EntityObjectList.Columns.formName;
     this.lueForm.Properties.Essential           = false;
     this.lueForm.Properties.IsShowColumnHeaders = true;
     this.lueForm.Properties.ColumnWidth.Add(EntityObjectList.Columns.formCode, 80);
     this.lueForm.Properties.ColumnWidth.Add(EntityObjectList.Columns.formName, 200);
     this.lueForm.Properties.ColumnHeaders.Add(EntityObjectList.Columns.formCode, "编码");
     this.lueForm.Properties.ColumnHeaders.Add(EntityObjectList.Columns.formName, "名称");
     this.lueForm.Properties.ShowColumn      = EntityObjectList.Columns.formCode + "|" + EntityObjectList.Columns.formName;
     this.lueForm.Properties.IsUseShowColumn = true;
     this.lueForm.Properties.FilterColumn    = EntityObjectList.Columns.formCode + "|" + EntityObjectList.Columns.formName + "|" + EntityObjectList.Columns.pyCode + "|" + EntityObjectList.Columns.wbCode;
     // 表单
     using (ProxyFormDesign proxy = new ProxyFormDesign())
     {
         List <EntityFormDesign> data = proxy.Service.GetForm(0, false);
         if (data != null && data.Count > 0)
         {
             foreach (EntityFormDesign item in data)
             {
                 DataSourceForm.Add(new EntityObjectList()
                 {
                     formId = "a" + item.Formid.ToString(), formCode = item.Formcode, formName = item.Formname, pyCode = item.Pycode, wbCode = item.Wbcode
                 });
             }
         }
     }
     // 表格
     using (ProxyEntityFactory proxy = new ProxyEntityFactory())
     {
         DataTable dt = proxy.Service.SelectFullTable(new EntityEmrTableBasicInfo());
         List <EntityEmrTableBasicInfo> DataSourceTable = EntityTools.ConvertToEntityList <EntityEmrTableBasicInfo>(dt);
         if (DataSourceTable == null)
         {
             DataSourceTable = new List <EntityEmrTableBasicInfo>();
         }
         foreach (EntityEmrTableBasicInfo item in DataSourceTable)
         {
             DataSourceForm.Add(new EntityObjectList()
             {
                 formId = "b" + item.tableCode, formCode = item.tableCode, formName = item.tableName, pyCode = SpellCodeHelper.GetPyCode(item.tableName), wbCode = SpellCodeHelper.GetWbCode(item.tableName)
             });
         }
     }
     if (DataSourceForm != null && DataSourceForm.Count > 0)
     {
         this.lueForm.Properties.DataSource = DataSourceForm.ToArray();
     }
     this.lueForm.Properties.SetSize();
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Init
        /// </summary>
        void Init()
        {
            try
            {
                uiHelper.BeginLoading(this);

                using (ProxyEntityFactory proxy = new ProxyEntityFactory())
                {
                    lstPeDept = EntityTools.ConvertToEntityList <EntityDicPeDepartment>(proxy.Service.SelectFullTable(new EntityDicPeDepartment()));
                    if (lstPeDept != null)
                    {
                        foreach (EntityDicPeDepartment item in lstPeDept)
                        {
                            item.pyCode = SpellCodeHelper.GetPyCode(item.deptName);
                            item.wbCode = SpellCodeHelper.GetWbCode(item.deptName);
                        }
                    }
                }

                #region lue
                // lueDept
                this.lueDept.Properties.PopupWidth          = 170;
                this.lueDept.Properties.PopupHeight         = 350;
                this.lueDept.Properties.ValueColumn         = EntityDicPeDepartment.Columns.deptId;
                this.lueDept.Properties.DisplayColumn       = EntityDicPeDepartment.Columns.deptName;
                this.lueDept.Properties.Essential           = false;
                this.lueDept.Properties.IsShowColumnHeaders = true;
                this.lueDept.Properties.ColumnWidth.Add(EntityDicPeDepartment.Columns.deptId, 50);
                this.lueDept.Properties.ColumnWidth.Add(EntityDicPeDepartment.Columns.deptName, 120);
                this.lueDept.Properties.ColumnHeaders.Add(EntityDicPeDepartment.Columns.deptId, "编码");
                this.lueDept.Properties.ColumnHeaders.Add(EntityDicPeDepartment.Columns.deptName, "名称");
                this.lueDept.Properties.ShowColumn      = EntityDicPeDepartment.Columns.deptId + "|" + EntityDicPeDepartment.Columns.deptName;
                this.lueDept.Properties.IsUseShowColumn = true;
                this.lueDept.Properties.FilterColumn    = EntityDicPeDepartment.Columns.deptId + "|" + EntityDicPeDepartment.Columns.deptId + "|" + EntityDicPeDepartment.Columns.pyCode + "|" + EntityDicPeDepartment.Columns.wbCode;
                if (lstPeDept != null)
                {
                    this.lueDept.Properties.DataSource = lstPeDept.ToArray();
                    this.lueDept.Properties.SetSize();
                }

                #endregion

                if (this.PeItemVo != null)
                {
                    this.txtItemName.Text     = this.PeItemVo.itemName;
                    this.txtMinAge.Text       = this.PeItemVo.minValue.ToString();
                    this.txtMaxAge.Text       = this.PeItemVo.maxValue.ToString();
                    this.cboSex.SelectedIndex = this.PeItemVo.gender;
                    //this.txtRang1.Text = this.PeItemVo.refRange;
                    this.txtUnit.Text             = this.PeItemVo.unit;
                    this.txtRef.Text              = this.PeItemVo.refRange;
                    this.cboCompare.SelectedIndex = this.PeItemVo.isCompare;
                    this.cboImport.SelectedIndex  = this.PeItemVo.isMain;
                    this.txtSortNo.Text           = this.PeItemVo.sortNo.ToString();
                    this.txtIntroduce.Text        = this.PeItemVo.itemInfo;

                    if (!string.IsNullOrEmpty(this.PeItemVo.deptId) && this.PeItemVo.deptId != "")
                    {
                        this.lueDept.SetDisplayText <EntityDicPeDepartment>(this.PeItemVo.deptName);
                    }
                }
            }
            finally
            {
                uiHelper.CloseLoading(this);
            }
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Init
        /// </summary>
        internal void Init()
        {
            try
            {
                uiHelper.BeginLoading(Viewer);
                IsInit = true;
                // 11 健康档案; 12 报表
                if (Function.Int(Viewer.FormType) <= 0)
                {
                    Viewer.FormType = "12";
                }
                string caption = string.Empty;
                switch (Viewer.FormType)
                {
                case "1":
                    caption = "电子病历";
                    break;

                case "11":
                    caption = "健康档案";
                    break;

                case "12":
                    caption = "报表";
                    break;

                case "13":
                    caption = "病理模板";
                    break;

                default:
                    break;
                }
                Viewer.Text += " ... " + caption;
                Viewer.cboType.Properties.Items.Add(caption);
                #region init.lue
                DataSourcePrintTemplate = new List <EntityEmrPrintTemplate>();
                using (ProxyEntityFactory proxy = new ProxyEntityFactory())
                {
                    DataTable dt = proxy.Service.SelectFullTable(new EntityEmrPrintTemplate());
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        DataSourcePrintTemplate = EntityTools.ConvertToEntityList <EntityEmrPrintTemplate>(dt);
                    }
                }
                foreach (EntityEmrPrintTemplate item in DataSourcePrintTemplate)
                {
                    if (string.IsNullOrEmpty(item.pyCode))
                    {
                        item.pyCode = SpellCodeHelper.GetPyCode(item.templateName);
                    }
                    if (string.IsNullOrEmpty(item.wbCode))
                    {
                        item.wbCode = SpellCodeHelper.GetWbCode(item.templateName);
                    }
                }
                Viewer.luePrint.Properties.PopupWidth          = 400;
                Viewer.luePrint.Properties.PopupHeight         = 400;
                Viewer.luePrint.Properties.ValueColumn         = EntityEmrPrintTemplate.Columns.templateId;
                Viewer.luePrint.Properties.DisplayColumn       = EntityEmrPrintTemplate.Columns.templateName;
                Viewer.luePrint.Properties.Essential           = false;
                Viewer.luePrint.Properties.IsShowColumnHeaders = true;
                Viewer.luePrint.Properties.ColumnWidth.Add(EntityEmrPrintTemplate.Columns.templateCode, 130);
                Viewer.luePrint.Properties.ColumnWidth.Add(EntityEmrPrintTemplate.Columns.templateName, 270);
                Viewer.luePrint.Properties.ColumnHeaders.Add(EntityEmrPrintTemplate.Columns.templateCode, "编码");
                Viewer.luePrint.Properties.ColumnHeaders.Add(EntityEmrPrintTemplate.Columns.templateName, "名称");
                Viewer.luePrint.Properties.ShowColumn      = EntityEmrPrintTemplate.Columns.templateCode + "|" + EntityEmrPrintTemplate.Columns.templateName;
                Viewer.luePrint.Properties.IsUseShowColumn = true;
                //Viewer.luePrint.Properties.FilterColumn = EntityEmrPrintTemplate.Columns.templateCode + "|" + EntityEmrPrintTemplate.Columns.templateName + "|" + EntityEmrPrintTemplate.Columns.pyCode + "|" + EntityEmrPrintTemplate.Columns.wbCode;
                if (DataSourcePrintTemplate != null && DataSourcePrintTemplate.Count > 0)
                {
                    Viewer.luePrint.Properties.DataSource = DataSourcePrintTemplate.ToArray();
                }
                Viewer.luePrint.Properties.SetSize();

                #endregion

                CreateTree();
                LoadDataSource();

                Viewer.rdoStatus.SelectedIndex = 1;
                SetEditValueChangedEvent(Viewer.plMainInfo);
                Viewer.timer.Enabled = true;
                Viewer.ValueChanged  = false;
            }
            finally
            {
                IsInit = false;
                uiHelper.CloseLoading(Viewer);
            }
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Save
        /// </summary>
        internal bool Save()
        {
            if (isSave)
            {
                return(false);
            }
            isSave = true;
            try
            {
                bool            isNew    = false;
                EntitySysReport reportVo = null;
                if (Viewer.txtRptNo.Tag == null)
                {
                    reportVo            = new EntitySysReport();
                    reportVo.creatorId  = GlobalLogin.objLogin.EmpNo;
                    reportVo.createDate = Utils.ServerTime();
                    isNew = true;
                }
                else
                {
                    reportVo = Viewer.txtRptNo.Tag as EntitySysReport;
                }
                reportVo.rptNo   = Viewer.txtRptNo.Text.Trim();
                reportVo.rptName = Viewer.txtRptName.Text.Trim();
                reportVo.rptSql  = Viewer.txtSql.Text.Trim();

                if (string.IsNullOrEmpty(reportVo.rptNo))
                {
                    DialogBox.Msg("请输入报表编号。");
                    Viewer.txtRptNo.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(reportVo.rptName))
                {
                    DialogBox.Msg("请输入报表名称。");
                    Viewer.txtRptName.Focus();
                    return(false);
                }
                reportVo.pyCode = SpellCodeHelper.GetPyCode(reportVo.rptName);
                reportVo.wbCode = SpellCodeHelper.GetWbCode(reportVo.rptName);
                reportVo.type   = 1;
                reportVo.status = 1;

                using (ProxyFrame proxy = new ProxyFrame())
                {
                    if (proxy.Service.SaveReport(ref reportVo) > 0)
                    {
                        Viewer.txtRptNo.Tag = reportVo;
                        if (isNew)
                        {
                            (Viewer.tvRport.DataSource as List <EntitySysReport>).Add(reportVo);
                            Viewer.tvRport.RefreshDataSource();
                            Viewer.tvRport.FocusedNode = Viewer.tvRport.FindNodeByKeyID(reportVo.rptId);
                        }
                        else
                        {
                            int index = (Viewer.tvRport.DataSource as List <EntitySysReport>).FindIndex(t => t.rptId == reportVo.rptId);
                            (Viewer.tvRport.DataSource as List <EntitySysReport>)[index] = reportVo;
                            Viewer.tvRport.RefreshDataSource();
                        }
                        DialogBox.Msg("保存报表成功!");
                    }
                    else
                    {
                        DialogBox.Msg("保存报表失败。");
                    }
                }
                Viewer.ValueChanged = false;
            }
            catch (Exception ex)
            {
                DialogBox.Msg(ex.Message);
                return(false);
            }
            finally
            {
                isSave = false;
            }
            return(true);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// CreateCatalog
        /// </summary>
        /// <param name="dataSourceEmrCatalog"></param>
        /// <param name="dataSourceEmrBasicInfo"></param>
        /// <param name="dataSourceEmrPnType"></param>
        /// <param name="caseType"></param>
        void CreateCatalog(List <EntityEmrCatalog> dataSourceEmrCatalog, List <EntityEmrBasicInfo> dataSourceEmrBasicInfo, List <EntityProgressNoteType> dataSourceEmrPnType)
        {
            // 树结构
            Viewer.tvForm.Columns.Clear();
            uiHelper.SetGridCol(Viewer.tvForm, new string[] { "caseName" }, new string[] { "病历列表" }, new int[] { 200 });
            Viewer.tvForm.Columns["caseName"].AppearanceCell.Font = new Font("宋体", 9);
            Viewer.tvForm.KeyFieldName        = "caseCode";
            Viewer.tvForm.ParentFieldName     = "parentCode";
            Viewer.tvForm.ImageIndexFieldName = "tempSerNo";

            Viewer.tvForm.OptionsView.ShowFocusedFrame = false;
            Viewer.tvForm.Appearance.FocusedRow.Options.UseBackColor       = true;
            Viewer.tvForm.Appearance.FocusedRow.BackColor                  = Color.LightGreen; // Color.LightSkyBlue;
            Viewer.tvForm.Appearance.FocusedRow.BackColor2                 = Color.White;
            Viewer.tvForm.Appearance.HideSelectionRow.Options.UseBackColor = true;
            Viewer.tvForm.Appearance.HideSelectionRow.BackColor            = Color.LightGreen; // Color.LightSkyBlue;
            Viewer.tvForm.Appearance.HideSelectionRow.BackColor2           = Color.White;

            EntityEmrBasicInfo        emrBasicInfo     = null;
            List <decimal>            lstCatalogID     = new List <decimal>();
            List <EntityEmrBasicInfo> lstCaseBasicInfo = new List <EntityEmrBasicInfo>();

            // 主目录
            foreach (EntityEmrCatalog catalog in dataSourceEmrCatalog)
            {
                emrBasicInfo            = new EntityEmrBasicInfo();
                emrBasicInfo.serNo      = -1;
                emrBasicInfo.caseCode   = catalog.catalogId.ToString() + "^"; // 避免文件夹的自增序号与casecode相同
                emrBasicInfo.parentCode = string.Empty;
                emrBasicInfo.tableName  = string.Empty;
                emrBasicInfo.tempSerNo  = 2;
                emrBasicInfo.caseName   = catalog.catalogName;
                emrBasicInfo.pyCode     = SpellCodeHelper.GetPyCode(catalog.catalogName);
                emrBasicInfo.wbCode     = SpellCodeHelper.GetWbCode(catalog.catalogName);

                if (lstCaseBasicInfo.Any(t => t.caseCode == emrBasicInfo.caseCode))
                {
                    continue;
                }
                if (lstCatalogID.IndexOf(catalog.catalogId) < 0)
                {
                    lstCatalogID.Add(catalog.catalogId);
                }
                if (catalog.type == 0)
                {
                    lstCaseBasicInfo.Add(emrBasicInfo);
                }
                else
                {
                    if (catalog.type == 1)
                    {
                        //if (emrBasicInfo.caseName == "病程记录") emrBasicInfo.caseCode = progressNoteCaseCode;
                        lstCaseBasicInfo.Add(emrBasicInfo);
                    }
                    else if (catalog.type == 2)
                    {
                        lstCaseBasicInfo.Add(emrBasicInfo);
                    }
                }
            }

            List <string> lstExistsCaseCode   = new List <string>(); // 记录不需要显示的表单
            List <string> lstProgressCaseCode = new List <string>();

            foreach (EntityEmrBasicInfo caseInfo in dataSourceEmrBasicInfo)
            {
                //if (caseInfo.catalogId != 0 && lstCatalogID.IndexOf(caseInfo.catalogId) < 0) continue;
                #region doct.Case
                // 公用、医生
                if (caseInfo.attribute == 0 || caseInfo.attribute == 1)
                {
                    if (lstCaseBasicInfo.Any(t => t.caseCode == caseInfo.caseCode))
                    {
                        continue;
                    }
                    if (lstProgressCaseCode.IndexOf(caseInfo.caseCode) >= 0)
                    {
                        continue;
                    }
                    else
                    {
                        bool blnChk = false;
                        foreach (EntityProgressNoteType pnType in dataSourceEmrPnType)
                        {
                            if (pnType.caseCode == caseInfo.caseCode)
                            {
                                blnChk = true;
                                break;
                            }
                        }
                        if (blnChk)
                        {
                            continue;
                        }
                    }
                    caseInfo.parentCode = Function.Dec(caseInfo.catalogId).ToString() + "^";
                    caseInfo.tempSerNo  = 1;
                    caseInfo.pyCode     = SpellCodeHelper.GetPyCode(caseInfo.caseName);
                    caseInfo.wbCode     = SpellCodeHelper.GetWbCode(caseInfo.caseName);
                    lstCaseBasicInfo.Add(caseInfo);
                }
                #endregion

                #region nurse.Case
                if (caseInfo.attribute == 0 || caseInfo.attribute == 2)
                {
                    if (lstCaseBasicInfo.Any(t => t.caseCode == caseInfo.caseCode))
                    {
                        continue;
                    }
                    caseInfo.parentCode = caseInfo.catalogId.ToString() + "^";
                    caseInfo.tempSerNo  = 1;
                    caseInfo.pyCode     = SpellCodeHelper.GetPyCode(caseInfo.caseName);
                    caseInfo.wbCode     = SpellCodeHelper.GetWbCode(caseInfo.caseName);
                    lstCaseBasicInfo.Add(caseInfo);
                }
                #endregion
            }
            foreach (EntityEmrBasicInfo item in lstCaseBasicInfo)
            {
                if (item.multiPageFlag == 1)
                {
                    item.tempSerNo = 2;
                }
            }
            Viewer.tvForm.BeginUpdate();
            Viewer.tvForm.DataSource = lstCaseBasicInfo;
            //EntityEmrBasicInfo[] tmpArr = new EntityEmrBasicInfo[lstCaseBasicInfo.Count];
            //lstCaseBasicInfo.CopyTo(tmpArr);
            Viewer.tvForm.FocusedNodeChanged -= new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(tvForm_FocusedNodeChanged);
            Viewer.tvForm.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(tvForm_FocusedNodeChanged);
            Viewer.tvForm.ExpandAll();
            Viewer.tvForm.EndUpdate();
        }