Example #1
0
        /// <summary>
        /// 新增流程类型
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int AddFlowCategory(FLOW_FLOWCATEGORY entity)
        {
            try
            {
                //string sql = "INSERT INTO FLOW_FLOWCATEGORY ( FLOWCATEGORYID,FLOWCATEGORYDESC) VALUES ('" + entity.FLOWCATEGORYID + "','" + entity.FLOWCATEGORYDESC + "' )";
                //
                //int result = dao.ExecuteNonQuery(sql);
                //return result;

                string insSql = "INSERT INTO FLOW_FLOWCATEGORY (FLOWCATEGORYID,FLOWCATEGORYDESC,COMPANYID) VALUES (:FLOWCATEGORYID,:FLOWCATEGORYDESC,:COMPANYID)";
            Parameter[] pageparm =
                {
                    new Parameter(":FLOWCATEGORYID",GetValue(entity.FLOWCATEGORYID)), //流程分类ID
                    new Parameter(":FLOWCATEGORYDESC",GetValue(entity.FLOWCATEGORYDESC)), //流程分类描述
                     new Parameter(":COMPANYID",GetValue(entity.COMPANYID)) //公司ID

                };
            ParameterCollection pras = new ParameterCollection();
            foreach (var item in pageparm)
            {
                pras.Add(item);
            }
            int result = dao.ExecuteNonQuery(insSql, System.Data.CommandType.Text, pras);
               return result;
            }
            catch (Exception ex)
            {
                Log.WriteLog(this, "AddFlowCategory()", "新增流程类型", ex);
                return 0;
            }
            finally
            {

            }
        }
Example #2
0
        public static void AddParameter(string name, object value, OracleType oracleType, ParameterCollection parameters)
        {
            Parameter p = new Parameter("p" + name, oracleType);
            switch (oracleType)
            {
                case OracleType.DateTime:
                    p.ParameterValue = value == null ? DateTime.Now : value;
                    break;
                default:
                      if (value == null)
                    {
                        p.ParameterValue = string.Empty;
                    }
                    else
                    {
                        if (value.ToString() == "")
                        {
                            p.ParameterValue = string.Empty;
                        }
                        else
                        {
                            p.ParameterValue = value;
                        }
                    }

                    break;

            }
            parameters.Add(p);
        }
Example #3
0
File: Program.cs Project: JuRogn/OA
        public static object ExecuteCustomerSql(string Sqlstring, ParameterCollection prameters)
        {
            string conn = ConfigurationManager.AppSettings["ConnectionString"].ToString();
            OracleDAO dao = new OracleDAO(conn);
            //prameters = new ParameterCollection();
            //prameters.Add("parme1", null);

            dao.ExecuteScalar(Sqlstring, System.Data.CommandType.Text);
            prameters = new ParameterCollection();
            dao.GetDataTable(Sqlstring, System.Data.CommandType.Text, prameters);

            return null;
        }
Example #4
0
        //添加默认消息
        public bool AddFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg)
        {
            try
            {
                int result = 0;

                //string sql = "insert into T_WF_MESSAGEBODYDEFINE(DEFINEID, SYSTEMCODE, MODELCODE, MESSAGEBODY, MESSAGEURL, CREATEDATE,COMPANYID,CREATEUSERNAME,CREATEUSERID,MESSAGETYPE)"
                //                                 + "values('" + FlowMsg.DEFINEID + "','" + FlowMsg.SYSTEMCODE + "','" + FlowMsg.MODELCODE + "',"
                //                                        + "'" + FlowMsg.MESSAGEBODY + "','" + FlowMsg.MESSAGEURL + "',to_date('" + FlowMsg.CREATEDATE + "','yyyy-mm-dd hh24:mi:ss'),"
                //                                        + "'" + FlowMsg.COMPANYID + "','" + FlowMsg.CREATEUSERNAME + "','" + FlowMsg.CREATEUSERID + "','" + FlowMsg.MESSAGETYPE + "')";
                //result = dao.ExecuteNonQuery(sql);

                 string insSql = "INSERT INTO T_WF_MESSAGEBODYDEFINE (DEFINEID,COMPANYID,SYSTEMCODE,MODELCODE,MESSAGEBODY,MESSAGEURL,MESSAGETYPE,CREATEDATE,CREATEUSERNAME,CREATEUSERID) VALUES (:DEFINEID,:COMPANYID,:SYSTEMCODE,:MODELCODE,:MESSAGEBODY,:MESSAGEURL,:MESSAGETYPE,:CREATEDATE,:CREATEUSERNAME,:CREATEUSERID)";
            Parameter[] pageparm =
                {
                    new Parameter(":DEFINEID",GetValue(FlowMsg.DEFINEID)), //默认消息ID
                    new Parameter(":COMPANYID",GetValue(FlowMsg.COMPANYID)), //公司ID
                    new Parameter(":SYSTEMCODE",GetValue(FlowMsg.SYSTEMCODE)), //系统代号
                    new Parameter(":MODELCODE",GetValue(FlowMsg.MODELCODE)), //模块代码
                    new Parameter(":MESSAGEBODY",GetValue(FlowMsg.MESSAGEBODY)), //消息体
                    new Parameter(":MESSAGEURL",GetValue(FlowMsg.MESSAGEURL)), //消息链接
                    new Parameter(":MESSAGETYPE",GetValue(FlowMsg.MESSAGETYPE)), //消息类型
                    new Parameter(":CREATEDATE",GetValue(FlowMsg.CREATEDATE)), //创建日期
                    new Parameter(":CREATEUSERNAME",GetValue(FlowMsg.CREATEUSERNAME)), //创建人名称
                    new Parameter(":CREATEUSERID",GetValue(FlowMsg.CREATEUSERID)) //创建人

                };
            ParameterCollection pras = new ParameterCollection();
            foreach (var item in pageparm)
            {
                pras.Add(item);
            }
            result = dao.ExecuteNonQuery(insSql, System.Data.CommandType.Text, pras);
                return result > 0 ? true : false;
            }
            catch
            {
                return false;
            }
            finally
            {

            }
        }
Example #5
0
        public void ExecuteMessageSql(string sql, Parameter[] pageparm)
        {
            try
            {
                ParameterCollection pras = new ParameterCollection();
                foreach (var item in pageparm)
                {
                    pras.Add(item);
                }
                dao.ExecuteNonQuery(sql, CommandType.Text, pras);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {

            }
        }
Example #6
0
 /// <summary>
 /// 新增模块代码
 /// </summary>
 /// <param name="flowModel">FlowModel</param>
 /// <returns>string</returns>
 public string AddModelDefine(FLOW_MODELDEFINE_T flowModel)
 {
     try
     {
         ////OracleConnection conn = MicrosoftOracle.CreateOracleConnection(ConnectionString);
         StringBuilder inssql = new StringBuilder();
         inssql.Append("INSERT INTO FLOW_MODELDEFINE_T (MODELDEFINEID,SYSTEMCODE,SYSTEMNAME,MODELCODE,PARENTMODELCODE,DESCRIPTION,");
         inssql.Append("CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE) VALUES (:MODELDEFINEID,");
         inssql.Append(":SYSTEMCODE,:SYSTEMNAME,:MODELCODE,:PARENTMODELCODE,:DESCRIPTION,:CREATEUSERID,:CREATEUSERNAME,:CREATECOMPANYID,");
         inssql.Append(":CREATEDEPARTMENTID,:CREATEPOSTID,:CREATEDATE)");
         Parameter[] pageparm =
         {
             new Parameter(":MODELDEFINEID",GetValue(flowModel.MODELDEFINEID)), //模块ID
             new Parameter(":SYSTEMCODE",GetValue(flowModel.SYSTEMCODE)), //系统代码
             new Parameter(":SYSTEMNAME",GetValue(flowModel.SYSTEMNAME)), //系统代码
             new Parameter(":MODELCODE",GetValue(flowModel.MODELCODE)), //模块代码
             new Parameter(":PARENTMODELCODE",GetValue(flowModel.PARENTMODELCODE)), //上级模块代码
             new Parameter(":DESCRIPTION",GetValue(flowModel.DESCRIPTION)), //模块描述
             new Parameter(":CREATEUSERID",GetValue(flowModel.CREATEUSERID)), //创建人ID
             new Parameter(":CREATEUSERNAME",GetValue(flowModel.CREATEUSERNAME)), //创建人名
             new Parameter(":CREATECOMPANYID",GetValue(flowModel.CREATECOMPANYID)), //创建公司ID
             new Parameter(":CREATEDEPARTMENTID",GetValue(flowModel.CREATEDEPARTMENTID)), //创建部门ID
             new Parameter(":CREATEPOSTID",GetValue(flowModel.CREATEPOSTID)), //创建岗位ID
             new Parameter(":CREATEDATE",GetValue(DateTime.Now)) //创建时间
         };
         ParameterCollection pras = new ParameterCollection();
         foreach (var item in pageparm)
         {
             pras.Add(item);
         }
         int result = dao.ExecuteNonQuery(inssql.ToString(), CommandType.Text, pras);
         //MicrosoftOracle.Close(conn);
         return result > 0 ? "1" : "0";
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Example #7
0
		/// <summary>
		/// 执行查询,并返回查询所返回的结果集中第一行的第一列。忽略额外的列或行。
		/// </summary>
		/// <param name="sql">SQL语句</param>
		/// <param name="type">SQL语句的类型</param>
		/// <param name="parameters">相关参数</param>
		/// <returns>第一行第一列的值</returns>
		public object ExecuteScalar(string sql, CommandType type, ParameterCollection parameters)
		{
			object ret = null;
			SqlCommand oleCmd = new SqlCommand();

			try
			{
				// 判断是否有事务
				if (_transCount == 0)
				{
					_oleConn = OpenConnection();
					oleCmd.Connection = _oleConn;
				}
				else
				{
					oleCmd.Connection = _oleConn;
					oleCmd.Transaction = _oleTrans;
				}
                oleCmd.CommandText = WrapSql(sql, type);
                oleCmd.CommandType = CommandType.Text;
                // 设置参数
				for (int i = 0 ; i < parameters.Count ; i++)
				{
                    SqlParameter param = new SqlParameter();
					param.ParameterName = parameters[i].ParameterName;
					param.Value = parameters[i].ParameterValue;
                    if (parameters[i].ParameterValue is Guid)
                    {
                        param.DbType = DbType.Guid;
                    }
					oleCmd.Parameters.Add(param);
				}
				ret = oleCmd.ExecuteScalar();
				// 获取参数返回值
				for (int i = 0 ; i < parameters.Count ; i++)
				{
					parameters[i].ParameterValue = oleCmd.Parameters[parameters[i].ParameterName].Value;
				}
			}
			catch (Exception ex)
			{
				throw new TechException(ex.Message, sql, ex);
			}
			finally
			{
				oleCmd.Dispose();
				oleCmd = null;
				if (_transCount == 0 && _oleConn != null)
				{
					_oleConn.Dispose();
					_oleConn = null;
				}
			}
			return ret;
		}
Example #8
0
        /// <summary>
        /// 新增流程关系
        /// </summary>
        /// <param name="conn">数据库链接</param>
        /// <param name="command">数据库命令</param>
        /// <param name="relation">关系实体</param>
        /// <returns>bool</returns>
        private bool AddRelation(FLOW_MODELFLOWRELATION_T relation)
        {
            try
            {
            //                string relationSql = @"INSERT INTO FLOW_MODELFLOWRELATION_T (MODELFLOWRELATIONID,COMPANYID,DEPARTMENTID,COMPANYNAME,DEPARTMENTNAME,
            //                        SYSTEMCODE,MODELCODE,FLOWCODE,FLAG,FLOWTYPE,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,
            //                        CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,EDITDATE) VALUES (MODELFLOWRELATIONID,COMPANYID,DEPARTMENTID,
            //                        COMPANYNAME,DEPARTMENTNAME,SYSTEMCODE,MODELCODE,FLOWCODE,FLAG,FLOWTYPE,CREATEUSERID,CREATEUSERNAME,
            //                        CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,EDITDATE)";
                string relationSql = @"INSERT INTO FLOW_MODELFLOWRELATION_T (MODELFLOWRELATIONID,COMPANYID,DEPARTMENTID,COMPANYNAME,DEPARTMENTNAME,
                        SYSTEMCODE,MODELCODE,FLOWCODE,FLAG,FLOWTYPE,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,
                        CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,EDITDATE) VALUES (@MODELFLOWRELATIONID,@COMPANYID,@DEPARTMENTID,
                        @COMPANYNAME,@DEPARTMENTNAME,@SYSTEMCODE,@MODELCODE,@FLOWCODE,@FLAG,@FLOWTYPE,@CREATEUSERID,@CREATEUSERNAME,
                        @CREATECOMPANYID,@CREATEDEPARTMENTID,@CREATEPOSTID,@CREATEDATE,@EDITUSERID,@EDITUSERNAME,@EDITDATE)";
                Parameter[] relationParm =
                                {
                            new Parameter("@MODELFLOWRELATIONID",null),
                            new Parameter("@COMPANYID",null),
                            new Parameter("@DEPARTMENTID",null),
                            new Parameter("@COMPANYNAME",null),
                            new Parameter("@DEPARTMENTNAME",null),
                            new Parameter("@SYSTEMCODE",null),
                            new Parameter("@MODELCODE",null),
                            new Parameter("@FLOWCODE",null),
                            new Parameter("@FLAG",null),
                            new Parameter("@FLOWTYPE",null),
                            new Parameter("@CREATEUSERID",null),
                            new Parameter("@CREATEUSERNAME",null),
                            new Parameter("@CREATECOMPANYID",null),
                            new Parameter("@CREATEDEPARTMENTID",null),
                            new Parameter("@CREATEPOSTID",null),
                            new Parameter("@CREATEDATE",null),
                            new Parameter("@EDITUSERID",null),
                            new Parameter("@EDITUSERNAME",null),
                            new Parameter("@EDITDATE",null)
                                };
                relationParm[0].ParameterValue = Guid.NewGuid().ToString();//关联ID
                relationParm[1].ParameterValue = GetValue(relation.COMPANYID);//公司ID
                relationParm[2].ParameterValue = GetValue(relation.DEPARTMENTID);//部门ID
                relationParm[3].ParameterValue = GetValue(relation.COMPANYNAME);//公司名称
                relationParm[4].ParameterValue = GetValue(relation.DEPARTMENTNAME);//部门名称
                relationParm[5].ParameterValue = GetValue(relation.SYSTEMCODE);//系统代码
                relationParm[6].ParameterValue = GetValue(relation.MODELCODE);//模块代码
                relationParm[7].ParameterValue = GetValue(relation.FLOWCODE);//流程代码
                relationParm[8].ParameterValue = "1";//1这可用,0为不可用
                relationParm[9].ParameterValue = GetValue(relation.FLOWTYPE);//0:审批流程,1:任务流程
                relationParm[10].ParameterValue = GetValue(relation.CREATEUSERID);//操作人员ID
                relationParm[11].ParameterValue = GetValue(relation.CREATEUSERNAME);//操作人员名
                relationParm[12].ParameterValue = GetValue(relation.CREATECOMPANYID);//创建公司ID
                relationParm[13].ParameterValue = GetValue(relation.CREATEDEPARTMENTID);//创建部门ID
                relationParm[14].ParameterValue = GetValue(relation.CREATEPOSTID);//创建岗位ID
                relationParm[15].ParameterValue = DateTime.Now;//创建时间
                relationParm[16].ParameterValue = GetValue(relation.CREATEUSERID);//修改人ID
                relationParm[17].ParameterValue = GetValue(relation.CREATEUSERNAME);//修改人用户名
                relationParm[18].ParameterValue = DateTime.Now;//修改时间

                ParameterCollection pras = new ParameterCollection();
                foreach(var item in relationParm)
                {
                    pras.Add(item);
                }
                int k = dao.ExecuteNonQuery(relationSql, CommandType.Text, pras);
                if (k > 0)
                {
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Example #9
0
        /// <summary>
        /// 新增流程定义
        /// </summary>
        /// <param name="conn">链接</param>
        /// <param name="command">数据库命令</param>
        /// <param name="define">流程定义</param>
        /// <returns>bool</returns>
        private bool AddFlow(FLOW_FLOWDEFINE_T define)
        {
            try
            {
            //                string insSql = @"INSERT INTO FLOW_FLOWDEFINE_T (FLOWDEFINEID,FLOWCODE,DESCRIPTION,XOML,RULES,LAYOUT,FLOWTYPE,
            //                            CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,
            //                            EDITDATE,SYSTEMCODE,BUSINESSOBJECT,WFLAYOUT) VALUES (FLOWDEFINEID,FLOWCODE,DESCRIPTION,XOML,RULES,LAYOUT,
            //                            FLOWTYPE,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,
            //                            EDITDATE,SYSTEMCODE,BUSINESSOBJECT,WFLAYOUT)";
                string insSql = @"INSERT INTO FLOW_FLOWDEFINE_T (FLOWDEFINEID,FLOWCODE,DESCRIPTION,XOML,RULES,LAYOUT,FLOWTYPE,
                            CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE,EDITUSERID,EDITUSERNAME,
                            EDITDATE,SYSTEMCODE,BUSINESSOBJECT,WFLAYOUT) VALUES (@FLOWDEFINEID,@FLOWCODE,@DESCRIPTION,@XOML,@RULES,@LAYOUT,
                            @FLOWTYPE,@CREATEUSERID,@CREATEUSERNAME,@CREATECOMPANYID,@CREATEDEPARTMENTID,@CREATEPOSTID,@CREATEDATE,@EDITUSERID,@EDITUSERNAME,
                            @EDITDATE,@SYSTEMCODE,@BUSINESSOBJECT,@WFLAYOUT)";
                Parameter[] pageparm =
                                    {
                                    #region  参数
                                    new Parameter("@FLOWDEFINEID",null),
                                    new Parameter("@FLOWCODE",null),
                                    new Parameter("@DESCRIPTION",null),
                                    new Parameter("@XOML",null),
                                    new Parameter("@RULES",null),
                                    new Parameter("@LAYOUT",null),
                                    new Parameter("@FLOWTYPE",null),
                                    new Parameter("@CREATEUSERID",null),
                                    new Parameter("@CREATEUSERNAME",null),
                                    new Parameter("@CREATECOMPANYID",null),
                                    new Parameter("@CREATEDEPARTMENTID",null),
                                    new Parameter("@CREATEPOSTID",null),
                                    new Parameter("@CREATEDATE",null),
                                    new Parameter("@EDITUSERID",null),
                                    new Parameter("@EDITUSERNAME",null),
                                    new Parameter("@EDITDATE",null),
                                    new Parameter("@SYSTEMCODE",null),
                                    new Parameter("@BUSINESSOBJECT",null),
                                    new Parameter("@WFLAYOUT",null)
                                    #endregion
                                };
                pageparm[0].ParameterValue = GetValue(Guid.NewGuid().ToString().Replace("-", string.Empty));//流程定义ID
                pageparm[1].ParameterValue = GetValue(define.FLOWCODE);//流程代码
                pageparm[2].ParameterValue = GetValue(define.DESCRIPTION); ;//名称描述
                pageparm[3].ParameterValue = GetValue(define.XOML);//模型文件
                pageparm[4].ParameterValue = GetValue(define.RULES);//模型规则
                pageparm[5].ParameterValue = GetValue(define.LAYOUT);//模型布局
                pageparm[6].ParameterValue = GetValue(define.FLOWTYPE);//流程类型 -- 0:审批流程, 1:任务流程
                pageparm[7].ParameterValue = GetValue(define.CREATEUSERID);//操作人员ID
                pageparm[8].ParameterValue = GetValue(define.CREATEUSERNAME);//操作人员名
                pageparm[9].ParameterValue = GetValue(define.CREATECOMPANYID);//创建公司ID
                pageparm[10].ParameterValue = GetValue(define.CREATEDEPARTMENTID);//创建部门ID
                pageparm[11].ParameterValue = GetValue(define.CREATEPOSTID);//创建岗位ID
                pageparm[12].ParameterValue = DateTime.Now;//创建时间
                pageparm[13].ParameterValue = GetValue(define.EDITUSERID);//修改人ID
                pageparm[14].ParameterValue = GetValue(define.EDITUSERNAME);//修改人用户名
                pageparm[15].ParameterValue = DateTime.Now; //修改时间
                pageparm[16].ParameterValue = GetValue(define.SYSTEMCODE);//业务系统:OA,HR,TM等
                pageparm[17].ParameterValue = GetValue(define.BUSINESSOBJECT);//业务对象:各种申请报销单
                pageparm[18].ParameterValue = GetValue(define.WFLAYOUT);//流程定义文件,把旧的ID换成新的ID

                ParameterCollection pras = new ParameterCollection();
                foreach (var item in pageparm)
                {
                    pras.Add(item);
                }

                int n = dao.ExecuteNonQuery(insSql,CommandType.Text,pras);
                if (n > 0)
                {
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Example #10
0
 public int ExecuteNonQuery(string sql, CommandType type, Parameter[] pageparm)
 {
     ParameterCollection pras = new ParameterCollection();
     foreach (var item in pageparm)
     {
         pras.Add(item);
     }
     return ExecuteNonQuery(sql, type, pras);
 }
Example #11
0
        /// <summary>
        /// 修改流程类型
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int UpdateFlowCategory(FLOW_FLOWCATEGORY entity)
        {
            try
            {
               // string sql = "UPDATE FLOW_FLOWCATEGORY SET FLOWCATEGORYDESC='" + entity.FLOWCATEGORYDESC + "' WHERE FLOWCATEGORYID= '" + entity.FLOWCATEGORYID + "'";

                 string updSql = "UPDATE FLOW_FLOWCATEGORY SET FLOWCATEGORYDESC=:FLOWCATEGORYDESC WHERE   FLOWCATEGORYID=:FLOWCATEGORYID";
                Parameter[] pageparm =
                {
                    new Parameter(":FLOWCATEGORYID",GetValue(entity.FLOWCATEGORYID)), //流程分类ID
                    new Parameter(":FLOWCATEGORYDESC",GetValue(entity.FLOWCATEGORYDESC)) //流程分类描述

                };
                ParameterCollection pras = new ParameterCollection();
                foreach (var item in pageparm)
                {
                    pras.Add(item);
                }
                int result = dao.ExecuteNonQuery(updSql, System.Data.CommandType.Text, pras);
                return result;

            }
            catch (Exception ex)
            {
                Log.WriteLogFrist(this, "UpdateFlowCategory()", "修改流程类型", ex);
                return 0;
            }
            finally
            {

            }
        }
Example #12
0
        // 用rownum方式
        private DataTable GetDataTableByRowNum(string sql, CommandType type, int pageIndex, int pageSize, ParameterCollection parameters)
        {
            //SELECT * 
            //FROM (select *,ROW_NUMBER() Over(order by id) as rowNum from table_info )as myTable
            //where rowNum between 50 and 60;

            //注:SQL Server 的ROW_NUMBER()函数性能,通用性都不够,暂不使用

            return null;

        }
Example #13
0
        /// <summary>
        /// 新增定时触发数据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool AddTimingTrigger(T_WF_TIMINGTRIGGERACTIVITY entity)
        {
            try
            {

                    string insSql = @"INSERT INTO T_WF_TIMINGTRIGGERACTIVITY (TRIGGERID, BUSINESSID,TRIGGERNAME,COMPANYID,SYSTEMCODE,SYSTEMNAME,
                            MODELCODE,MODELNAME,TRIGGERACTIVITYTYPE,TRIGGERTIME,TRIGGERSTART,TRIGGEREND,TRIGGERROUND,TRIGGERMULTIPLE,WCFURL,FUNCTIONNAME,FUNCTIONPARAMTER,PAMETERSPLITCHAR,
                            WCFBINDINGCONTRACT,RECEIVERUSERID,RECEIVEROLE,RECEIVERNAME,MESSAGEBODY,MESSAGEURL,TRIGGERTYPE,TRIGGERDESCRIPTION,CONTRACTTYPE,
                            CREATEUSERID,CREATEUSERNAME,REMARK) VALUES (:TRIGGERID,:BUSINESSID,:TRIGGERNAME,:COMPANYID,:SYSTEMCODE,:SYSTEMNAME,
                            :MODELCODE,:MODELNAME,:TRIGGERACTIVITYTYPE,:TRIGGERTIME,:TRIGGERSTART,:TRIGGEREND,:TRIGGERROUND,:TRIGGERMULTIPLE,:WCFURL,:FUNCTIONNAME,:FUNCTIONPARAMTER,:PAMETERSPLITCHAR,
                            :WCFBINDINGCONTRACT,:RECEIVERUSERID,:RECEIVEROLE,:RECEIVERNAME,:MESSAGEBODY,:MESSAGEURL,:TRIGGERTYPE,:TRIGGERDESCRIPTION,:CONTRACTTYPE,
                            :CREATEUSERID,:CREATEUSERNAME,:REMARK)";
                    Parameter[] pageparm =
                {
                    new Parameter(":TRIGGERID",GetValue(entity.TRIGGERID)),
                    new Parameter(":BUSINESSID",GetValue(entity.BUSINESSID)),
                    new Parameter(":TRIGGERNAME",GetValue(entity.TRIGGERNAME)),
                    new Parameter(":COMPANYID",GetValue(entity.COMPANYID)),
                    new Parameter(":SYSTEMCODE",GetValue(entity.SYSTEMCODE)),
                    new Parameter(":SYSTEMNAME",GetValue(entity.SYSTEMNAME)),
                    new Parameter(":MODELCODE",GetValue(entity.MODELCODE)),
                    new Parameter(":MODELNAME",GetValue(entity.MODELNAME)),
                    new Parameter(":TRIGGERACTIVITYTYPE",GetValue(entity.TRIGGERACTIVITYTYPE)),
                    new Parameter(":TRIGGERTIME",GetValue(entity.TRIGGERTIME)),
                    new Parameter(":TRIGGERSTART",GetValue(entity.TRIGGERSTART)),
                    new Parameter(":TRIGGEREND",GetValue(entity.TRIGGEREND)),
                    new Parameter(":TRIGGERROUND",GetValue(entity.TRIGGERROUND)),
                    new Parameter(":TRIGGERMULTIPLE",GetValue(entity.TRIGGERMULTIPLE)),
                    new Parameter(":WCFURL",GetValue(entity.WCFURL)),
                    new Parameter(":FUNCTIONNAME",GetValue(entity.FUNCTIONNAME)),
                    new Parameter(":FUNCTIONPARAMTER",GetValue(entity.FUNCTIONPARAMTER)),
                    new Parameter(":PAMETERSPLITCHAR",GetValue(entity.PAMETERSPLITCHAR)),
                    new Parameter(":WCFBINDINGCONTRACT",GetValue(entity.WCFBINDINGCONTRACT)),
                    new Parameter(":RECEIVERUSERID",GetValue(entity.RECEIVERUSERID)),
                    new Parameter(":RECEIVEROLE",GetValue(entity.RECEIVEROLE)),
                    new Parameter(":RECEIVERNAME",GetValue(entity.RECEIVERNAME)),
                    new Parameter(":MESSAGEBODY",GetValue(entity.MESSAGEBODY)),
                    new Parameter(":MESSAGEURL",GetValue(entity.MESSAGEURL)),
                    new Parameter(":TRIGGERTYPE",GetValue(entity.TRIGGERTYPE)),
                    new Parameter(":TRIGGERDESCRIPTION",GetValue(entity.TRIGGERDESCRIPTION)),
                    new Parameter(":CONTRACTTYPE",GetValue(entity.CONTRACTTYPE)),
                    new Parameter(":CREATEUSERID",GetValue(entity.CREATEUSERID)),
                    new Parameter(":CREATEUSERNAME",GetValue(entity.CREATEUSERNAME)),
                    new Parameter(":REMARK",GetValue(entity.REMARK))
                };
                    ParameterCollection paras = new ParameterCollection();
                    foreach (var item in pageparm)
                    {
                        paras.Add(item);
                    }
                    int insert = dao.ExecuteNonQuery(insSql, CommandType.Text, paras);
                    return insert > 0 ? true : false;

            }
            catch (Exception ex)
            {

                throw new Exception(ex.Message, ex);
            }
            finally
            {

            }
        }
Example #14
0
        /// <summary>
        /// 新增待办
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="dr1"></param>
        /// <param name="SourceValueDT"></param>
        /// <param name="strAPPFIELDVALUE"></param>
        public void AddDoTask(T_WF_DOTASK entity, DataRow dr1, DataTable SourceValueDT, string strAPPFIELDVALUE)
        {
            ClosedDoTaskStatus(entity.SYSTEMCODE, entity.ORDERID, null);
            try
            {
                string[] strListUser;
                if (entity.RECEIVEUSERID.IndexOf('|') != -1)
                {
                    strListUser = entity.RECEIVEUSERID.ToString().Split('|');
                }
                else
                {
                    strListUser = new string[1];
                    strListUser[0] = entity.RECEIVEUSERID.ToString();
                }
                //
                foreach (string User in strListUser)
                {
                    string insSql = @"INSERT INTO T_WF_DOTASK (DOTASKID,COMPANYID,ORDERID,ORDERUSERID,ORDERUSERNAME,ORDERSTATUS,MESSAGEBODY,
                                     APPLICATIONURL,RECEIVEUSERID,BEFOREPROCESSDATE,DOTASKTYPE,DOTASKSTATUS,MAILSTATUS,
                                     RTXSTATUS,APPFIELDVALUE,FLOWXML,APPXML,SYSTEMCODE,MODELCODE,MODELNAME)
                                     VALUES (:DOTASKID,:COMPANYID,:ORDERID,:ORDERUSERID,:ORDERUSERNAME,:ORDERSTATUS,:MESSAGEBODY,:APPLICATIONURL,
                                    :RECEIVEUSERID,:BEFOREPROCESSDATE,:DOTASKTYPE,:DOTASKSTATUS,:MAILSTATUS,:RTXSTATUS,
                                    :APPFIELDVALUE,:FLOWXML,:APPXML,:SYSTEMCODE,:MODELCODE,:MODELNAME)";
                    Parameter[] pageparm =
                        {
                            new Parameter(":DOTASKID",null),
                            new Parameter(":COMPANYID",null),
                            new Parameter(":ORDERID",null),
                            new Parameter(":ORDERUSERID",null),
                            new Parameter(":ORDERUSERNAME",null),
                            new Parameter(":ORDERSTATUS",null),
                            new Parameter(":MESSAGEBODY",null),
                            new Parameter(":APPLICATIONURL",null),
                            new Parameter(":RECEIVEUSERID",null),
                            new Parameter(":BEFOREPROCESSDATE",null),
                            new Parameter(":DOTASKTYPE",null),
                            new Parameter(":DOTASKSTATUS",null),
                            new Parameter(":MAILSTATUS",null),
                            new Parameter(":RTXSTATUS",null),
                            new Parameter(":APPFIELDVALUE",null),
                            new Parameter(":FLOWXML",null),
                            new Parameter(":APPXML",null),
                            new Parameter(":SYSTEMCODE",null),
                            new Parameter(":MODELCODE",null),
                            new Parameter(":MODELNAME",null),

                        };
                    pageparm[0].ParameterValue = GetValue(Guid.NewGuid().ToString());//待办任务ID
                    pageparm[1].ParameterValue = GetValue(entity.COMPANYID);//公司ID
                    pageparm[2].ParameterValue = GetValue(entity.ORDERID);//单据ID
                    pageparm[3].ParameterValue = GetValue(entity.ORDERUSERID);//单据所属人ID
                    pageparm[4].ParameterValue = GetValue(entity.ORDERUSERNAME);//单据所属人名称
                    pageparm[5].ParameterValue = GetValue(entity.ORDERSTATUS);//单据状态
                    #region 消息体
                    string XmlTemplete = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "\r\n" +
                                  "<System>" + "\r\n" +
                                  "{0}" +
                                  "</System>";
                    if (dr1["MESSAGEBODY"].ToString() == "")//默认消息为空
                    {
                        string strMsgBody = string.Empty;
                        string strMsgUrl = string.Empty;
                        ModelMsgDefine(dr1["SYSTEMCODE"].ToString(), dr1["MODELCODE"].ToString(), entity.COMPANYID, ref strMsgBody, ref strMsgUrl);
                        if (string.IsNullOrEmpty(strMsgBody))
                        {
                            try
                            {
                                DataRow[] drvList = SourceValueDT.Select("ColumnName='ModelName'");
                                if (drvList.Count() == 1)
                                {
                                    pageparm[6].ParameterValue = GetValue(drvList[0]["ColumnText"].ToString() + "已审批通过");//消息体
                                }
                                else
                                {
                                    pageparm[6].ParameterValue = GetValue(entity.ORDERID + "已审批通过");//消息体

                                }
                            }
                            catch { }

                        }
                        else
                        {
                            pageparm[6].ParameterValue = GetValue(ReplaceMessageBody(strMsgBody, SourceValueDT));//消息体
                        }
                        string strUrl = string.Format(XmlTemplete, ReplaceValue(strMsgUrl, SourceValueDT));
                        pageparm[7].ParameterValue = GetValue(strUrl);//应用URL
                    }
                    else//在引擎配置界面定义了消息内容
                    {
                        pageparm[6].ParameterValue = GetValue(ReplaceMessageBody(dr1["MESSAGEBODY"].ToString(), SourceValueDT));//消息体
                        pageparm[7].ParameterValue = GetValue(string.Format(XmlTemplete, ReplaceValue(dr1["APPLICATIONURL"].ToString(), SourceValueDT)));//应用URL

                    }
                    #endregion
                    pageparm[8].ParameterValue = GetValue(entity.RECEIVEUSERID);//接收用户ID
                    if (entity.BEFOREPROCESSDATE != null)//流程过期时间属性
                    {
                        //sql += "to_date('" + entity.BEFOREPROCESSDATE + "','YYYY-MM-DD hh24:mi:ss')";
                        pageparm[9].ParameterValue = GetValue(entity.BEFOREPROCESSDATE);//可处理时间(主要针对KPI考核)
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(dr1["LASTDAYS"].ToString()))
                        {
                            pageparm[9].ParameterValue = GetValue(DateTime.Now.AddDays(3));//可处理时间(主要针对KPI考核)
                        }
                        else
                        {
                            pageparm[9].ParameterValue = GetValue(DateTime.Now.AddDays(int.Parse(dr1["LASTDAYS"].ToString())));//可处理时间(主要针对KPI考核)
                        }
                    }
                    pageparm[10].ParameterValue = GetValue(0);//待办任务类型(0、待办任务、1、流程咨询、3 )
                    pageparm[11].ParameterValue = GetValue(0);//代办任务状态(0、未处理 1、已处理 、2、任务撤销 10、删除)
                    pageparm[12].ParameterValue = GetValue(0);//邮件状态(0、未发送 1、已发送、2、未知 )
                    pageparm[13].ParameterValue = GetValue(0);//RTX状态(0、未发送 1、已发送、2、未知 )
                    pageparm[14].ParameterValue = GetValue(strAPPFIELDVALUE);//应用字段值
                    pageparm[15].ParameterValue = GetValue(entity.FLOWXML);//流程XML
                    pageparm[16].ParameterValue = GetValue(entity.APPXML);//应用XML
                    pageparm[17].ParameterValue = GetValue(entity.SYSTEMCODE);//系统代码
                    pageparm[18].ParameterValue = GetValue(entity.MODELCODE);//模块代码
                    pageparm[19].ParameterValue = GetValue(entity.MODELNAME);//模块名称

                    ParameterCollection paras = new ParameterCollection();
                    foreach(var item in pageparm)
                    {
                        paras.Add(item);
                    }
                    int result = dao.ExecuteNonQuery(insSql, CommandType.Text, paras);
                }

            }
            catch (Exception ex)
            {
                Tracer.Debug("命名空间:SMT.Workflow.Engine.Services.DAL类方法:AddDoTask()" + ex.Message);
            }
        }
Example #15
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="strReceiveUser"></param>
        /// <param name="SystemCode"></param>
        /// <param name="strModelCode"></param>
        /// <param name="FormID"></param>
        /// <param name="Content"></param>
        /// <param name="Url"></param>
        /// <param name="APPFIELDVALUE"></param>
        /// <param name="strAppXML"></param>
        public void SendTriggerTaskMsg(string strReceiveID, string SystemCode, string strModelCode, string FormID, string Content, string Url, string APPFIELDVALUE, string strAppXML)
        {
            try
            {
                    string insSql = @"INSERT INTO T_WF_DOTASK (DOTASKID,COMPANYID,ORDERID,MESSAGEBODY,APPLICATIONURL,RECEIVEUSERID,BEFOREPROCESSDATE,DOTASKTYPE,
                                     DOTASKSTATUS,MAILSTATUS,RTXSTATUS,APPFIELDVALUE,FLOWXML,APPXML,SYSTEMCODE,MODELCODE,REMARK) VALUES (:DOTASKID,:COMPANYID,:ORDERID,:MESSAGEBODY,:APPLICATIONURL,
                                    :RECEIVEUSERID,:BEFOREPROCESSDATE,:DOTASKTYPE,:DOTASKSTATUS,:MAILSTATUS,:RTXSTATUS,:APPFIELDVALUE,:FLOWXML,:APPXML,:SYSTEMCODE,:MODELCODE,:REMARK)";
                    Parameter[] pageparm =
                    {
                         new Parameter(":DOTASKID",null),
                        new Parameter(":COMPANYID",null),
                        new Parameter(":ORDERID",null),
                        new Parameter(":MESSAGEBODY",null),
                        new Parameter(":APPLICATIONURL",null),
                        new Parameter(":RECEIVEUSERID",null),
                        new Parameter(":BEFOREPROCESSDATE",null),
                        new Parameter(":DOTASKTYPE",null),
                        new Parameter(":DOTASKSTATUS",null),
                        new Parameter(":MAILSTATUS",null),
                        new Parameter(":RTXSTATUS",null),
                        new Parameter(":APPFIELDVALUE",null),
                        new Parameter(":FLOWXML",null),
                        new Parameter(":APPXML",null),
                        new Parameter(":SYSTEMCODE",null),
                        new Parameter(":MODELCODE",null),
                        new Parameter(":REMARK",null)

                    };
                    pageparm[0].ParameterValue = GetValue(Guid.NewGuid().ToString());//待办任务ID
                    pageparm[1].ParameterValue = GetValue(GetValue(null));//公司ID
                    pageparm[2].ParameterValue = GetValue(FormID);//单据ID
                    pageparm[3].ParameterValue = GetValue(Content);//消息体
                    pageparm[4].ParameterValue = GetValue(Url);//应用URL
                    pageparm[5].ParameterValue = GetValue(strReceiveID);//接收用户ID
                    pageparm[6].ParameterValue = GetValue(DateTime.Now.AddDays(3));//可处理时间(主要针对KPI考核)
                    pageparm[7].ParameterValue = GetValue(0);//待办任务类型(0、待办任务、1、流程咨询、3 )
                    pageparm[8].ParameterValue = GetValue(0);//代办任务状态(0、未处理 1、已处理 、2、任务撤销 10、删除)
                    pageparm[9].ParameterValue = GetValue(0);//邮件状态(0、未发送 1、已发送、2、未知 )
                    pageparm[10].ParameterValue = GetValue(0);//RTX状态(0、未发送 1、已发送、2、未知 )
                    pageparm[11].ParameterValue = GetValue(APPFIELDVALUE);//应用字段值
                    pageparm[12].ParameterValue = GetValue(null);//流程XML
                    pageparm[13].ParameterValue = GetValue(strAppXML);//应用XML
                    pageparm[14].ParameterValue = GetValue(SystemCode);//系统代码
                    pageparm[15].ParameterValue = GetValue(strModelCode);//模块代码
                    pageparm[16].ParameterValue = GetValue("直发代办");//备注

                    ParameterCollection paras = new ParameterCollection();
                    foreach (var item in pageparm)
                    {
                        paras.Add(item);
                    }
                    int insert = dao.ExecuteNonQuery(insSql, CommandType.Text, paras);// dao.ExecuteNonQuery(addsql);

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {

            }
        }
Example #16
0
 public IDataReader ExecuteReader(string sql, ParameterCollection parameters)
 {
     return ExecuteReader(sql, CommandType.Text, parameters);
 }
Example #17
0
 public IDataReader ExecuteReader(string sql)
 {
     ParameterCollection pras = new ParameterCollection();
     return ExecuteReader(sql, CommandType.Text, pras);
 }
Example #18
0
		/// <summary>
		/// 获取数据集
		/// </summary>
		/// <param name="sql">SQL语句</param>
		/// <param name="type">SQL语句类型</param>
		/// <param name="parameters">条件参数</param>
		/// <returns>数据集</returns>
		public DataTable GetDataTable(string sql, CommandType type, ParameterCollection parameters)
		{
			DataTable ret = new DataTable();
			SqlDataAdapter da = new SqlDataAdapter();
			SqlCommand oleCmd = new SqlCommand();

			try
			{
				// 判断是否有事务
				if (_transCount == 0)
				{
					_oleConn = OpenConnection();
					oleCmd.Connection = _oleConn;
				}
				else
				{
					oleCmd.Connection = _oleConn;
					oleCmd.Transaction = _oleTrans;
				}
                oleCmd.CommandText = WrapSql(sql, type);
                oleCmd.CommandType = CommandType.Text;
                // 设置参数
				for (int i = 0 ; i < parameters.Count ; i++)
				{
					SqlParameter param = new SqlParameter();
					param.ParameterName = parameters[i].ParameterName;
					param.Value = parameters[i].ParameterValue;
                    if (parameters[i].ParameterValue is Guid)
                    {
                        param.DbType = DbType.Guid;
                    }
					oleCmd.Parameters.Add(param);
				}
				da.SelectCommand = oleCmd;
				da.Fill(ret);
			}
			catch (Exception ex)
			{
				throw new TechException(ex.Message, sql, ex);
			}
			finally
			{
				oleCmd.Dispose();
				oleCmd = null;
				da.Dispose();
				da = null;
				if (_transCount == 0 && _oleConn != null)
				{
					_oleConn.Dispose();
					_oleConn = null;
				}
			}
			return ret;
        }
Example #19
0
		/// <summary>
		/// 获取数据集
		/// </summary>
		/// <param name="sql">SQL语句</param>
		/// <param name="type">SQL语句类型</param>
		/// <param name="pageIndex">当前页数</param>
		/// <param name="pageSize">当前页显示的记录数</param>
		/// <param name="parameters">条件参数</param>
		/// <returns>数据集</returns>
		public DataTable GetDataTable(string sql, CommandType type, int pageIndex, int pageSize, ParameterCollection parameters)
		{
            if (type == CommandType.Text)
            {
                //return GetDataTableByRowNum(sql, type, pageIndex, pageSize, parameters);
                return GetDataTableByDataReader(sql, type, pageIndex, pageSize, parameters);
            }
            else
            {
                return GetDataTableByDataReader(sql, type, pageIndex, pageSize, parameters);
            }
        }
Example #20
0
        //修改默认消息
        public bool UpdateFlowMsgDefine(T_WF_MESSAGEBODYDEFINE FlowMsg)
        {
            try
            {
                int result = 0;

                //string sql = "update  T_WF_MESSAGEBODYDEFINE set "
                //                         + "SYSTEMCODE = '" + FlowMsg.SYSTEMCODE + "', "
                //                         + "MODELCODE = '" + FlowMsg.MODELCODE + "', "
                //                         + "MESSAGEBODY = '" + FlowMsg.MESSAGEBODY + "',"
                //                         + "MESSAGEURL = '" + FlowMsg.MESSAGEURL + "' "
                //                         + "where DEFINEID = '" + FlowMsg.DEFINEID + "' ";

                //result = dao.ExecuteNonQuery(sql);

                 string updSql = "UPDATE T_WF_MESSAGEBODYDEFINE SET SYSTEMCODE=:SYSTEMCODE,MODELCODE=:MODELCODE,MESSAGEBODY=:MESSAGEBODY,MESSAGEURL=:MESSAGEURL WHERE   DEFINEID=:DEFINEID";
            Parameter[] pageparm =
                {
                    new Parameter(":DEFINEID",GetValue(FlowMsg.DEFINEID)), //默认消息ID
                    new Parameter(":SYSTEMCODE",GetValue(FlowMsg.SYSTEMCODE)), //系统代号
                    new Parameter(":MODELCODE",GetValue(FlowMsg.MODELCODE)), //模块代码
                    new Parameter(":MESSAGEBODY",GetValue(FlowMsg.MESSAGEBODY)), //消息体
                    new Parameter(":MESSAGEURL",GetValue(FlowMsg.MESSAGEURL)) //消息链接

                };
            ParameterCollection pras = new ParameterCollection();
            foreach (var item in pageparm)
            {
                pras.Add(item);
            }
            result = dao.ExecuteNonQuery(updSql, System.Data.CommandType.Text, pras);
                return result > 0 ? true : false;
            }
            catch
            {
                return false;
            }
            finally
            {

            }
        }
Example #21
0
        // 用Reader方式
        private DataTable GetDataTableByDataReader(string sql, CommandType type, int pageIndex, int pageSize, ParameterCollection parameters)
        {
            DataTable ret = new DataTable();

            int startIndex = 0;
            int endIndex = 0;
            int rowIndex = 0;
            DataRow row = null;
            SqlDataReader dr = null;
            SqlCommand oleCmd = new SqlCommand();

            try
            {
                startIndex = pageSize * (pageIndex - 1);
                endIndex = startIndex + pageSize - 1;
                // 判断是否有事务
                if (_transCount == 0)
                {
                    _oleConn = OpenConnection();
                    oleCmd.Connection = _oleConn;
                }
                else
                {
                    oleCmd.Connection = _oleConn;
                    oleCmd.Transaction = _oleTrans;
                }
                oleCmd.CommandText = WrapSql(sql, type);
                oleCmd.CommandType = CommandType.Text;
                // 设置参数
                for (int i = 0; i < parameters.Count; i++)
                {
                    SqlParameter param = new SqlParameter();
                    param.ParameterName = parameters[i].ParameterName;
                    param.Value = parameters[i].ParameterValue;
                    if (parameters[i].ParameterValue is Guid)
                    {
                        param.DbType = DbType.Guid;
                    }
                    oleCmd.Parameters.Add(param);
                }
                dr = oleCmd.ExecuteReader();

                for (int i = 0; i < dr.FieldCount; i++)
                {
                    ret.Columns.Add(dr.GetName(i), dr.GetFieldType(i));
                }

                while (dr.Read())
                {
                    rowIndex++;
                    if (rowIndex > startIndex)
                    {
                        row = ret.NewRow();
                        for (int i = 0; i < ret.Columns.Count; i++)
                        {
                            row[i] = dr.GetValue(i);
                        }
                        ret.Rows.Add(row);
                    }
                    if (rowIndex > endIndex)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new TechException(ex.Message, sql, ex);
            }
            finally
            {
                dr = null;
                oleCmd.Dispose();
                oleCmd = null;
                if (_transCount == 0 && _oleConn != null)
                {
                    _oleConn.Dispose();
                    _oleConn = null;
                }
            }

            return ret;
        }
Example #22
0
        public bool AddDoTask(T_PF_PERSONALRECORD model)
        {
            ClosedDoTaskStatus(model.SYSTYPE, model.MODELID, model.OWNERID);
            try
            {
                    string insSql = @"INSERT INTO T_WF_DOTASK (DOTASKID,COMPANYID,ORDERID,ORDERUSERID,ORDERUSERNAME,ORDERSTATUS,MESSAGEBODY,
                                     APPLICATIONURL,RECEIVEUSERID,BEFOREPROCESSDATE,ENGINECODE,DOTASKTYPE,DOTASKSTATUS,MAILSTATUS,
                                     RTXSTATUS,SYSTEMCODE,MODELCODE,REMARK)
                                     VALUES (:DOTASKID,:COMPANYID,:ORDERID,:ORDERUSERID,:ORDERUSERNAME,:ORDERSTATUS,:MESSAGEBODY,
                                    :APPLICATIONURL,:RECEIVEUSERID,:BEFOREPROCESSDATE,:ENGINECODE,:DOTASKTYPE,:DOTASKSTATUS,:MAILSTATUS,
                                    :RTXSTATUS,:SYSTEMCODE,:MODELCODE,:REMARK)";
                    #region
                    #region
                    Parameter[] pageparm =
                        {
                            new Parameter(":DOTASKID",null),
                            new Parameter(":COMPANYID",null),
                            new Parameter(":ORDERID",null),
                            new Parameter(":ORDERUSERID",null),
                            new Parameter(":ORDERUSERNAME",null),
                            new Parameter(":ORDERSTATUS",null),
                            new Parameter(":MESSAGEBODY",null),
                            new Parameter(":APPLICATIONURL",null),
                            new Parameter(":RECEIVEUSERID",null),
                            new Parameter(":BEFOREPROCESSDATE",null),
                            new Parameter(":ENGINECODE",null),
                            new Parameter(":DOTASKTYPE",null),
                            new Parameter(":DOTASKSTATUS",null),
                            new Parameter(":MAILSTATUS",null),
                            new Parameter(":RTXSTATUS",null),
                            new Parameter(":SYSTEMCODE",null),
                            new Parameter(":MODELCODE",null),
                            new Parameter(":REMARK",null),

                        };
                    #endregion
                    pageparm[0].ParameterValue = GetValue(Guid.NewGuid().ToString());//待办任务ID
                    pageparm[1].ParameterValue = GetValue(model.OWNERCOMPANYID);//公司ID
                    pageparm[2].ParameterValue = GetValue(model.MODELID);//单据ID
                    pageparm[3].ParameterValue = GetValue(model.OWNERID);//单据所属人ID
                    pageparm[4].ParameterValue = GetValue("");//单据所属人名称
                    pageparm[5].ParameterValue = GetValue(0);//单据状态
                    pageparm[6].ParameterValue = GetValue(model.MODELDESCRIPTION);
                    pageparm[7].ParameterValue = GetValue(model.CONFIGINFO);
                    pageparm[8].ParameterValue = GetValue(model.OWNERID);
                    pageparm[9].ParameterValue = GetValue(DateTime.Now.AddDays(3));
                    pageparm[10].ParameterValue = GetValue("");//
                    pageparm[11].ParameterValue = GetValue(4);//待办任务类型(0、待办任务、1、流程咨询、3  )
                    pageparm[12].ParameterValue = GetValue(0);//代办任务状态(0、未处理 1、已处理 、2、任务撤销 10、删除)
                    pageparm[13].ParameterValue = GetValue(1);//邮件状态(0、未发送 1、已发送、2、未知 )
                    pageparm[14].ParameterValue = GetValue(1);//RTX状态(0、未发送 1、已发送、2、未知 )
                    pageparm[15].ParameterValue = GetValue(model.SYSTYPE);
                    pageparm[16].ParameterValue = GetValue(model.MODELCODE);
                    pageparm[17].ParameterValue = GetValue("未提交单据");
                    #endregion

                    ParameterCollection paras = new ParameterCollection();
                    foreach (var item in pageparm)
                    {
                        paras.Add(item);
                    }
                    return dao.ExecuteNonQuery(insSql, CommandType.Text, paras) > 0 ? true : false;

            }
            catch (Exception ex)
            {
                Tracer.Debug("新增未提交单据待办消息出错:" + ex);
                throw new Exception(ex.Message, ex);
            }
        }
        /// <summary>
        /// 得到审核主表最新的一个实体
        /// </summary>
        /// <param name="conn">//OracleConnection</param>
        /// <param name="formid">formid</param>
        /// <returns></returns>
        public FLOW_FLOWRECORDMASTER_T GetFlowerMasterIDByFormid(string formid)
        {
            try
               {
               FLOW_FLOWRECORDMASTER_T model = new FLOW_FLOWRECORDMASTER_T();
               string selSql = "SELECT INSTANCEID,FORMID,EDITUSERID,EDITUSERNAME FROM FLOW_FLOWRECORDMASTER_T WHERE   FORMID=:FORMID   ORDER BY CREATEDATE DESC";
               Parameter[] pageparm =
                {
                    new Parameter(":FORMID",null)

                };
               pageparm[0].ParameterValue = formid;
               ParameterCollection pras = new ParameterCollection();
               foreach (var item in pageparm)
               {
                   pras.Add(item);
               }

               DataTable dt = dao.GetDataTable(selSql, CommandType.Text, pras);
               if (dt.Rows.Count > 0)
               {//多次提交单据的时候,取最新的一条数据
                   model.INSTANCEID = dt.Rows[0]["INSTANCEID"].ToString();//
                   model.FORMID = dt.Rows[0]["FORMID"].ToString();//
                   model.EDITUSERID = dt.Rows[0]["EDITUSERID"].ToString();//
                   model.EDITUSERNAME = dt.Rows[0]["EDITUSERNAME"].ToString();//

               }
               return model;
               }
               catch (Exception e)
               {
               throw new Exception(e.Message, e);
               }
        }
Example #24
0
        public IDataReader ExecuteReader(string sql, CommandType type, ParameterCollection parameters)
        {
            SqlCommand oleCmd = new SqlCommand();
            // 判断是否有事务
            if (_transCount == 0)
            {
                _oleConn = OpenConnection();
                oleCmd.Connection = _oleConn;
            }
            else
            {
                oleCmd.Connection = _oleConn;
                oleCmd.Transaction = _oleTrans;
            }
            oleCmd.CommandText = WrapSql(sql, type);
            oleCmd.CommandType = CommandType.Text;
            // 设置参数
            for (int i = 0; i < parameters.Count; i++)
            {
                SqlParameter param = new SqlParameter();
                param.ParameterName = parameters[i].ParameterName;
                param.Value = parameters[i].ParameterValue;
                if (parameters[i].ParameterValue is Guid)
                {
                    param.DbType = DbType.Guid;
                }
                oleCmd.Parameters.Add(param);
            }

            SqlDataReader dr = null;
            try
            {
                dr = oleCmd.ExecuteReader();
            }
            catch (Exception ex)
            {
                Tracer.Debug(ex.ToString());
            }
            return (IDataReader)dr;
        }
Example #25
0
        /// <summary>
        /// 修改模块代码
        /// </summary>
        /// <param name="flowModel">flowModel</param>
        /// <returns>string</returns>
        public string UpdateModelDefine(FLOW_MODELDEFINE_T flowModel)
        {
            try
            {
                ////OracleConnection conn = MicrosoftOracle.CreateOracleConnection(ConnectionString);
                string updSql = "UPDATE FLOW_MODELDEFINE_T SET MODELDEFINEID=:MODELDEFINEID,SYSTEMCODE=:SYSTEMCODE,SYSTEMNAME=:SYSTEMNAME,PARENTMODELCODE=:PARENTMODELCODE,DESCRIPTION=:DESCRIPTION,EDITUSERID=:EDITUSERID,EDITUSERNAME=:EDITUSERNAME,EDITDATE=:EDITDATE WHERE   MODELCODE=:MODELCODE";
                Parameter[] pageparm =
                {
                    new Parameter(":MODELDEFINEID",GetValue(flowModel.MODELDEFINEID)), //模块ID
                    new Parameter(":SYSTEMCODE",GetValue(flowModel.SYSTEMCODE)), //系统代码
                    new Parameter(":SYSTEMNAME",GetValue(flowModel.SYSTEMNAME)), //系统代码
                    new Parameter(":MODELCODE",GetValue(flowModel.MODELCODE)), //模块代码
                    new Parameter(":PARENTMODELCODE",GetValue(flowModel.PARENTMODELCODE)), //上级模块代码
                    new Parameter(":DESCRIPTION",GetValue(flowModel.DESCRIPTION)), //模块描述
                    new Parameter(":EDITUSERID",GetValue(flowModel.EDITUSERID)), //修改人ID
                    new Parameter(":EDITUSERNAME",GetValue(flowModel.EDITUSERNAME)), //修改人用户名
                    new Parameter(":EDITDATE",GetValue(DateTime.Now)) //修改时间
                };
                ParameterCollection pras = new ParameterCollection();
                foreach (var item in pageparm)
                {
                    pras.Add(item);
                }

                int result = dao.ExecuteNonQuery(updSql, CommandType.Text, pras);
                if (result > 0)
                {
                    #region  哪些公司在模块中可以允许自选流程
                    if (flowModel.FreeFlowCompanyList != null && flowModel.FreeFlowCompanyList.Count > 0)
                    {
                        foreach (var ent in flowModel.FreeFlowCompanyList)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("declare  ");
                            sb.AppendLine("  i integer;");
                            sb.AppendLine("  MODELDEFINEFREEFLOWID varchar2(50) :='" + ent.MODELDEFINEFREEFLOWID + "';");
                            sb.AppendLine("  MODELCODE_temp varchar2(50) :='" + ent.MODELCODE + "';");
                            sb.AppendLine("  COMPANYNAME_temp varchar2(50) :='" + ent.COMPANYNAME + "';");
                            sb.AppendLine("  COMPANYID_temp varchar2(50) :='" + ent.COMPANYID + "';");
                            sb.AppendLine("  CREATEUSERID_temp varchar2(50) :='" + ent.CREATEUSERID + "';");
                            sb.AppendLine("  CREATEUSERNAME_temp varchar2(50) :='" + ent.CREATEUSERNAME + "';");
                            sb.AppendLine("  CREATECOMPANYID_temp varchar2(50) :='" + ent.CREATECOMPANYID + "';");
                            sb.AppendLine("  CREATEDEPARTMENTID_temp varchar2(50) :='" + ent.CREATEDEPARTMENTID + "';");
                            sb.AppendLine("  CREATEPOSTID_temp varchar2(50) :='" + ent.CREATEPOSTID + "';");
                            sb.AppendLine("  CREATEDATE_temp date :=to_date('" + DateTime.Now.ToString() + "', 'yyyy/mm/dd hh24:mi:ss');");
                            sb.AppendLine("begin");
                            sb.AppendLine("   select count(1) into i from FLOW_MODELDEFINE_FREEFLOW t where t.MODELCODE='" + ent.MODELCODE + "' and t.COMPANYID='" + ent.COMPANYID + "';");
                            sb.AppendLine("   if i<1 then");
                            sb.AppendLine("      execute immediate 'INSERT INTO FLOW_MODELDEFINE_FREEFLOW (MODELDEFINEFREEFLOWID,MODELCODE,COMPANYNAME,COMPANYID,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE) values (:MODELDEFINEFREEFLOWID,:MODELCODE,:COMPANYNAME,:COMPANYID,:CREATEUSERID,:CREATEUSERNAME,:CREATECOMPANYID,:CREATEDEPARTMENTID,:CREATEPOSTID,:CREATEDATE)'");
                            sb.AppendLine("      using MODELDEFINEFREEFLOWID,MODELCODE_temp,COMPANYNAME_temp,COMPANYID_temp,CREATEUSERID_temp,CREATEUSERNAME_temp,CREATECOMPANYID_temp,CREATEDEPARTMENTID_temp,CREATEPOSTID_temp,CREATEDATE_temp; ");
                            sb.AppendLine("      --commit;   ");
                            sb.AppendLine("   end if;");
                            sb.AppendLine("end;");

                            int n = dao.ExecuteNonQuery(sb.ToString());
                        }
                    }
                    #endregion
                    #region  哪些公司在模块中可以允许提单人撒回流程
                    if (flowModel.FlowCancelCompanyList != null && flowModel.FlowCancelCompanyList.Count > 0)
                    {
                        foreach (var ent in flowModel.FlowCancelCompanyList)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("declare  ");
                            sb.AppendLine("  i integer;");
                            sb.AppendLine("  MODELDEFINEFLOWCANCLEID_temp varchar2(50) :='" + ent.MODELDEFINEFLOWCANCLEID + "';");
                            sb.AppendLine("  MODELCODE_temp varchar2(50) :='" + ent.MODELCODE + "';");
                            sb.AppendLine("  COMPANYNAME_temp varchar2(50) :='" + ent.COMPANYNAME + "';");
                            sb.AppendLine("  COMPANYID_temp varchar2(50) :='" + ent.COMPANYID + "';");
                            sb.AppendLine("  CREATEUSERID_temp varchar2(50) :='" + ent.CREATEUSERID + "';");
                            sb.AppendLine("  CREATEUSERNAME_temp varchar2(50) :='" + ent.CREATEUSERNAME + "';");
                            sb.AppendLine("  CREATECOMPANYID_temp varchar2(50) :='" + ent.CREATECOMPANYID + "';");
                            sb.AppendLine("  CREATEDEPARTMENTID_temp varchar2(50) :='" + ent.CREATEDEPARTMENTID + "';");
                            sb.AppendLine("  CREATEPOSTID_temp varchar2(50) :='" + ent.CREATEPOSTID + "';");
                            sb.AppendLine("  CREATEDATE_temp date :=to_date('" + DateTime.Now.ToString() + "', 'yyyy/mm/dd hh24:mi:ss');");
                            sb.AppendLine("begin");
                            sb.AppendLine("   select count(1) into i from FLOW_MODELDEFINE_FLOWCANCLE t where  t.MODELCODE='" + ent.MODELCODE + "' and t.COMPANYID='" + ent.COMPANYID + "';");
                            sb.AppendLine("   if i<1 then");
                            sb.AppendLine("      execute immediate 'INSERT INTO FLOW_MODELDEFINE_FLOWCANCLE (MODELDEFINEFLOWCANCLEID,MODELCODE,COMPANYNAME,COMPANYID,CREATEUSERID,CREATEUSERNAME,CREATECOMPANYID,CREATEDEPARTMENTID,CREATEPOSTID,CREATEDATE) values (:MODELDEFINEFLOWCANCLEID,:MODELCODE,:COMPANYNAME,:COMPANYID,:CREATEUSERID,:CREATEUSERNAME,:CREATECOMPANYID,:CREATEDEPARTMENTID,:CREATEPOSTID,:CREATEDATE)'");
                            sb.AppendLine("      using MODELDEFINEFLOWCANCLEID_temp,MODELCODE_temp,COMPANYNAME_temp,COMPANYID_temp,CREATEUSERID_temp,CREATEUSERNAME_temp,CREATECOMPANYID_temp,CREATEDEPARTMENTID_temp,CREATEPOSTID_temp,CREATEDATE_temp; ");
                            sb.AppendLine("      --commit;   ");
                            sb.AppendLine("   end if;");
                            sb.AppendLine("end;");
                            int n = dao.ExecuteNonQuery(sb.ToString());
                        }
                    }
                    #endregion
                }
                //MicrosoftOracle.Close(conn);
                return result > 0 ? "1" : "0";
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
        /// <summary>
        /// 得到流程持久化实例一个对象实体
        /// </summary>
        /// <param name="conn">//OracleConnection</param>
        /// <param name="instance_id">实例ID</param>
        /// <returns></returns>
        public FLOW_INSTANCE_STATE GetInstanceModel(string instance_id)
        {
            FLOW_INSTANCE_STATE model = new FLOW_INSTANCE_STATE();
               string selSql = "SELECT INSTANCE_ID,STATE,STATUS,UNLOCKED,BLOCKED,INFO,MODIFIED,OWNER_ID,OWNED_UNTIL,NEXT_TIMER FROM INSTANCE_STATE WHERE   INSTANCE_ID=:INSTANCE_ID";
               Parameter[] pageparm =
                {
                    new Parameter(":INSTANCE_ID",null)

                };
               pageparm[0].ParameterValue = instance_id;
               ParameterCollection pras = new ParameterCollection();
               foreach (var item in pageparm)
               {
               pras.Add(item);
               }

               IDataReader dr = dao.ExecuteReader(selSql, pras);
               if (dr.Read())
               {
               model.INSTANCE_ID = dr["INSTANCE_ID"].ToString();//
               model.STATE = (byte[])dr["STATE"];//
               model.STATUS = dr["STATUS"].ToString() != "" ? Convert.ToDecimal(dr["STATUS"]) : 0; //
               model.UNLOCKED = dr["UNLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["UNLOCKED"]) : 0; //
               model.BLOCKED = dr["BLOCKED"].ToString() != "" ? Convert.ToDecimal(dr["BLOCKED"]) : 0; //
               model.INFO = dr["INFO"].ToString();//
               model.MODIFIED = dr["MODIFIED"].ToString() != "" ? Convert.ToDateTime(dr["MODIFIED"]) : DateTime.Now; //
               model.OWNER_ID = dr["OWNER_ID"].ToString();//
               model.OWNED_UNTIL = dr["OWNED_UNTIL"].ToString() != "" ? Convert.ToDateTime(dr["OWNED_UNTIL"]) : DateTime.Now; //
               model.NEXT_TIMER = dr["NEXT_TIMER"].ToString() != "" ? Convert.ToDateTime(dr["NEXT_TIMER"]) : DateTime.Now; //

               }
               dr.Close();

               return model;
        }