/// <summary> /// 模块定义 /// </summary> /// <param name="con">OracleConnection</param> /// <param name="ModelCode">模块代码</param> /// <returns></returns> public static List <FLOW_MODELDEFINE_T> GetModelDefineByCode(OracleConnection con, string ModelCode) { if (string.IsNullOrEmpty(con.ConnectionString)) { con.ConnectionString = ADOHelper.ConnectionString; } List <FLOW_MODELDEFINE_T> list = new List <FLOW_MODELDEFINE_T>(); OracleDataReader dr = null; try { #region //OracleCommand cmd = con.CreateCommand(); //cmd.CommandText = "select * from FLOW_MODELDEFINE_T where MODELCODE='" + ModelCode + "'"; //dr = cmd.ExecuteReader(); string sql = "select * from FLOW_MODELDEFINE_T where MODELCODE='" + ModelCode + "'"; dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region define FLOW_MODELDEFINE_T define = new FLOW_MODELDEFINE_T(); define.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); define.CREATEDATE = (DateTime)dr["CREATEDATE"]; define.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); define.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); define.DESCRIPTION = dr["DESCRIPTION"] == DBNull.Value ? null : dr["DESCRIPTION"].ToString(); define.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; define.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); define.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); define.MODELCODE = dr["MODELCODE"] == DBNull.Value ? null : dr["MODELCODE"].ToString(); define.MODELDEFINEID = dr["MODELDEFINEID"] == DBNull.Value ? null : dr["MODELDEFINEID"].ToString(); define.PARENTMODELCODE = dr["PARENTMODELCODE"] == DBNull.Value ? null : dr["PARENTMODELCODE"].ToString(); define.SYSTEMCODE = dr["SYSTEMCODE"] == DBNull.Value ? null : dr["SYSTEMCODE"].ToString(); list.Add(define); #endregion } dr.Close(); #endregion return(list); } catch (Exception ex) { if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("GetModelDefineByCode-->" + ex.Message); } }
/// <summary> /// 根据ID获取我的单据实体 /// </summary> /// <param name="PERSONALRECORDID">PERSONALRECORDID</param> /// <returns></returns> public static T_WF_PERSONALRECORD GetPersonalRecordByPersonalrecordid(OracleConnection con, string personalrecordid) { if (string.IsNullOrEmpty(con.ConnectionString)) { con.ConnectionString = ADOHelper.ConnectionString; } T_WF_PERSONALRECORD model = new T_WF_PERSONALRECORD(); OracleDataReader dr = null; try { #region string sql = "select * from T_WF_PERSONALRECORD where PERSONALRECORDID='" + personalrecordid + "'"; dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region define model.PERSONALRECORDID = dr["PERSONALRECORDID"].ToString(); //个人单据ID model.SYSTYPE = dr["SYSTYPE"].ToString(); //系统类型 model.MODELCODE = dr["MODELCODE"].ToString(); //所属模块代码 model.MODELID = dr["MODELID"].ToString(); //单据ID model.CHECKSTATE = dr["CHECKSTATE"].ToString() != "" ? Convert.ToDecimal(dr["CHECKSTATE"]) : 0; //单据审核状态 model.OWNERID = dr["OWNERID"].ToString(); //所属员工ID model.OWNERPOSTID = dr["OWNERPOSTID"].ToString(); //所属岗位ID model.OWNERDEPARTMENTID = dr["OWNERDEPARTMENTID"].ToString(); //所属部门ID model.OWNERCOMPANYID = dr["OWNERCOMPANYID"].ToString(); //所属公司ID model.CONFIGINFO = dr["CONFIGINFO"].ToString(); //参数配置 model.MODELDESCRIPTION = dr["MODELDESCRIPTION"].ToString(); //单据简要描叙 model.ISFORWARD = dr["ISFORWARD"].ToString() != "" ? Convert.ToDecimal(dr["ISFORWARD"]) : 0; //是否转发(0表示非转发,1表示转发) model.ISVIEW = dr["ISVIEW"].ToString() != "" ? Convert.ToDecimal(dr["ISVIEW"]) : 0; //是否已查看(0表示未查看,1表示已查看) model.CREATEDATE = dr["CREATEDATE"].ToString() != "" ? Convert.ToDateTime(dr["CREATEDATE"]) : DateTime.Now; //创建时间 model.UPDATEDATE = dr["UPDATEDATE"].ToString() != "" ? Convert.ToDateTime(dr["UPDATEDATE"]) : DateTime.Now; //修改时间 #endregion } dr.Close(); #endregion return(model); } catch (Exception ex) { if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("我的单据异常信息-->" + ex.Message); } }
/// <summary> /// 流程模型定义 /// </summary> /// <param name="con"></param> /// <param name="CompanyID"></param> /// <param name="ModelCode"></param> /// <returns></returns> public static List <FLOW_FLOWDEFINE_T> GetFlowByModelName(OracleConnection con, string CompanyID, string ModelCode) { List <FLOW_FLOWDEFINE_T> listDefine = new List <FLOW_FLOWDEFINE_T>(); OracleDataReader dr = null; try { if (con.State != ConnectionState.Open) { con.Open(); } #region string sqlFLOW_MODELFLOWRELATION_T = @"select * from FLOW_MODELFLOWRELATION_T where COMPANYID='" + CompanyID + "' and FLAG='1'"; string sqlFLOW_FLOWDEFINE_T = @"select * from FLOW_FLOWDEFINE_T where MODELCODE='" + ModelCode + "'"; string sql = @"select FLOW_FLOWDEFINE_T.* from (" + sqlFLOW_MODELFLOWRELATION_T + ") FLOW_MODELFLOWRELATION_T join (" + sqlFLOW_FLOWDEFINE_T + ") FLOW_FLOWDEFINE_T on FLOW_MODELFLOWRELATION_T.FLOWCODE=FLOW_FLOWDEFINE_T.FLOWCODE"; //OracleCommand cmd = con.CreateCommand(); //cmd.CommandText = sql; //dr = cmd.ExecuteReader(); LogHelper.WriteLog("FLOW_FLOWDEFINE_TDAL->GetFlowByModelName SQL语句:" + sql); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_FLOWDEFINE_T FLOW_FLOWDEFINE_T define = new FLOW_FLOWDEFINE_T(); define.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); define.CREATEDATE = (DateTime)dr["CREATEDATE"]; define.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); define.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); define.DESCRIPTION = dr["DESCRIPTION"] == DBNull.Value ? null : dr["DESCRIPTION"].ToString(); define.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; define.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); define.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); define.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); define.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); define.FLOWDEFINEID = dr["FLOWDEFINEID"] == DBNull.Value ? null : dr["FLOWDEFINEID"].ToString(); define.LAYOUT = dr["LAYOUT"] == DBNull.Value ? null : dr["LAYOUT"].ToString(); define.RULES = dr["RULES"] == DBNull.Value ? null : dr["RULES"].ToString(); define.XOML = dr["XOML"] == DBNull.Value ? null : dr["XOML"].ToString();; listDefine.Add(define); break; #endregion } dr.Close(); #endregion return(listDefine); } catch (Exception ex) { #region if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("GetFlowByModelName-->" + ex.Message); #endregion } }
/// <summary> /// 查询 [模块与流程定义关联] /// </summary> /// <param name="CompanyID">创建公司ID</param> /// <param name="DepartID">创建部门ID</param> /// <param name="ModelCode">模块代码</param> /// <param name="FlowType">0:审批流程,1:任务流程</param> /// <param name="OrgType">1:代表部门ID为空,否则部门ID不为空</param> /// <returns></returns> public static List <FLOW_MODELFLOWRELATION_T> GetFlowByModelName(OracleConnection con, string CompanyID, string DepartID, string ModelCode, string FlowType, string OrgType) { List <FLOW_MODELFLOWRELATION_T> listRelation = new List <FLOW_MODELFLOWRELATION_T>(); OracleDataReader dr = null; string sql = ""; try { if (con.State != ConnectionState.Open) { con.Open(); } sql = @" select * from FLOW_MODELFLOWRELATION_T where COMPANYID='{0}' and FLOWTYPE='{1}' and FLAG='1' and MODELCODE='{2}'"; if (OrgType != "1") { sql = sql + " and DEPARTMENTID is null"; } else { sql = sql + " and DEPARTMENTID='{3}'"; } sql = string.Format(sql, CompanyID, FlowType, ModelCode, DepartID); #region //OracleCommand cmd = con.CreateCommand(); //cmd.CommandText = sql; //dr = cmd.ExecuteReader(); LogHelper.WriteLog("FLOW_MODELFLOWRELATION_TDAL->GetFlowByModelName SQL语句:" + sql); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_MODELFLOWRELATION_T FLOW_MODELFLOWRELATION_T relation = new FLOW_MODELFLOWRELATION_T(); relation.COMPANYID = dr["COMPANYID"] == DBNull.Value ? null : dr["COMPANYID"].ToString(); relation.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); relation.CREATEDATE = (DateTime)dr["CREATEDATE"]; relation.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); relation.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); relation.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); relation.DEPARTMENTID = dr["DEPARTMENTID"] == DBNull.Value ? null : dr["DEPARTMENTID"].ToString(); relation.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; relation.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); relation.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); relation.FLAG = dr["FLAG"] == DBNull.Value ? null : dr["FLAG"].ToString(); relation.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); relation.MODELFLOWRELATIONID = dr["MODELFLOWRELATIONID"] == DBNull.Value ? null : dr["MODELFLOWRELATIONID"].ToString(); relation.FLOW_FLOWDEFINE_T = new FLOW_FLOWDEFINE_T(); relation.FLOW_FLOWDEFINE_T.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); listRelation.Add(relation); break; #endregion } dr.Close(); if (listRelation.Count > 0) { sql = @"select * from FLOW_FLOWDEFINE_T where FLOWCODE='" + listRelation[0].FLOW_FLOWDEFINE_T.FLOWCODE + "'"; //dr = cmd.ExecuteReader(); dr = MsOracle.ExecuteReaderByTransaction(con, sql, null); while (dr.Read()) { #region FLOW_FLOWDEFINE_T FLOW_FLOWDEFINE_T define = new FLOW_FLOWDEFINE_T(); define.CREATECOMPANYID = dr["CREATECOMPANYID"] == DBNull.Value ? null : dr["CREATECOMPANYID"].ToString(); define.CREATEDATE = (DateTime)dr["CREATEDATE"]; define.CREATEDEPARTMENTID = dr["CREATEDEPARTMENTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEPOSTID = dr["CREATEPOSTID"] == DBNull.Value ? null : dr["CREATEDEPARTMENTID"].ToString(); define.CREATEUSERID = dr["CREATEUSERID"] == DBNull.Value ? null : dr["CREATEUSERID"].ToString(); define.CREATEUSERNAME = dr["CREATEUSERNAME"] == DBNull.Value ? null : dr["CREATEUSERNAME"].ToString(); define.DESCRIPTION = dr["DESCRIPTION"] == DBNull.Value ? null : dr["DESCRIPTION"].ToString(); define.EDITDATE = dr["EDITDATE"] == DBNull.Value ? null : (DateTime?)dr["EDITDATE"]; define.EDITUSERID = dr["EDITUSERID"] == DBNull.Value ? null : dr["EDITUSERID"].ToString(); define.EDITUSERNAME = dr["EDITUSERNAME"] == DBNull.Value ? null : dr["EDITUSERNAME"].ToString(); define.FLOWCODE = dr["FLOWCODE"] == DBNull.Value ? null : dr["FLOWCODE"].ToString(); define.FLOWTYPE = dr["FLOWTYPE"] == DBNull.Value ? null : dr["FLOWTYPE"].ToString(); define.FLOWDEFINEID = dr["FLOWDEFINEID"] == DBNull.Value ? null : dr["FLOWDEFINEID"].ToString(); define.LAYOUT = dr["LAYOUT"] == DBNull.Value ? null : dr["LAYOUT"].ToString(); define.RULES = dr["RULES"] == DBNull.Value ? null : dr["RULES"].ToString(); define.XOML = dr["XOML"] == DBNull.Value ? null : dr["XOML"].ToString();; listRelation[0].FLOW_FLOWDEFINE_T = define; break; #endregion } dr.Close(); } #endregion return(listRelation); } catch (Exception ex) { if (dr != null && !dr.IsClosed) { dr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } throw new Exception("GetFlowByModelName-->" + ex.Message); } }