/// <summary> /// GetEmpRoleList /// </summary> /// <returns></returns> public Dictionary <string, List <string> > GetEmpRoleList() { Dictionary <string, List <string> > data = new Dictionary <string, List <string> >(); SqlHelper svc = null; try { EntityDefOperatorRole vo = new EntityDefOperatorRole(); svc = new SqlHelper(EnumBiz.onlineDB); DataTable dt = svc.Select(new EntityDefOperatorRole()); if (dt != null) { string empId = string.Empty; string roleID = string.Empty; List <string> lstRoleID = null; foreach (DataRow dr in dt.Rows) { empId = dr[EntityTools.GetFieldName(vo, EntityDefOperatorRole.Columns.operCode)].ToString(); roleID = dr[EntityTools.GetFieldName(vo, EntityDefOperatorRole.Columns.roleCode)].ToString(); if (data.ContainsKey(empId)) { data[empId].Add(roleID); } else { lstRoleID = new List <string>() { roleID }; data.Add(empId, lstRoleID); } } } } 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); }
/// <summary> /// 保存.表单打印模板 /// </summary> /// <param name="templateVo"></param> /// <param name="templateId"></param> /// <returns></returns> public int SaveFormPrintTemplate(EntityEmrPrintTemplate templateVo, out int templateId) { int affectRows = 0; string Sql = string.Empty; SqlHelper svc = null; templateId = 0; try { svc = new SqlHelper(EnumBiz.onlineDB); List <DacParm> lstPara = new List <DacParm>(); bool isExsit = true; if (templateVo.templateId <= 0) { isExsit = false; templateVo.templateId = svc.GetNextID(EntityTools.GetTableName(templateVo), EntityTools.GetFieldName(templateVo, EntityEmrPrintTemplate.Columns.templateId)); } lstPara.Add(svc.GetInsertParm(templateVo)); if (templateVo.templateId > 0) { using (TransactionScope scope = svc.TransactionScope) { if (DelFormPrintTemplate((int)templateVo.templateId) < 0) { return(-1); } affectRows = svc.Commit(lstPara); scope.Complete(); } } else { affectRows = svc.Commit(lstPara); } templateId = (int)templateVo.templateId; if (templateId > 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); }
/// <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); }
/// <summary> /// 保存 /// </summary> /// <param name="vo"></param> /// <param name="rptId"></param> /// <returns></returns> internal int SaveContagion(EntityRptContagion vo, string reqNo, out decimal rptId) { int affectRows = 0; rptId = 0; string Sql = string.Empty; IDataParameter[] parm = null; SqlHelper svc = null; try { List <DacParm> lstParm = new List <DacParm>(); svc = new SqlHelper(EnumBiz.onlineDB); EntityRptContagionData voData = new EntityRptContagionData(); if (vo.rptId <= 0) // new { rptId = svc.GetNextID(EntityTools.GetTableName(vo), EntityTools.GetFieldName(vo, EntityRptContagion.Columns.rptId)); vo.rptId = rptId; lstParm.Add(svc.GetInsertParm(vo)); voData.rptId = rptId; voData.xmlData = vo.xmlData; lstParm.Add(svc.GetInsertParm(voData)); if (!string.IsNullOrEmpty(reqNo)) { Sql = @"update rptContagion set reques_no = ? where rptId = ?"; parm = svc.CreateParm(2); parm[0].Value = reqNo; parm[1].Value = rptId; lstParm.Add(svc.GetDacParm(EnumExecType.ExecSql, Sql, parm)); } } else // edit { lstParm.Add(svc.GetUpdateParm(vo, new List <string>() { EntityRptContagion.Columns.reportTime, EntityRptContagion.Columns.reportOperCode, EntityRptContagion.Columns.reportOperName, EntityRptContagion.Columns.reportId, EntityRptContagion.Columns.registerCode, EntityRptContagion.Columns.patType, EntityRptContagion.Columns.patNo, EntityRptContagion.Columns.patName, EntityRptContagion.Columns.patSex, EntityRptContagion.Columns.birthday, EntityRptContagion.Columns.idCard, EntityRptContagion.Columns.contactAddr, EntityRptContagion.Columns.contactTel, EntityRptContagion.Columns.deptCode, EntityRptContagion.Columns.formId, EntityRptContagion.Columns.operCode, EntityRptContagion.Columns.recordDate, EntityRptContagion.Columns.status }, new List <string>() { EntityRptContagion.Columns.rptId })); voData.rptId = vo.rptId; voData.xmlData = vo.xmlData; lstParm.Add(svc.GetUpdateParm(voData, new List <string>() { EntityRptEventData.Columns.xmlData }, new List <string>() { EntityRptEventData.Columns.rptId })); rptId = vo.rptId; } affectRows = svc.Commit(lstParm); } catch (Exception e) { ExceptionLog.OutPutException(e); affectRows = -1; } finally { svc = null; } return(affectRows); }
/// <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); }