Beispiel #1
0
        public void Update(string processID, WfProcessRelativeParamCollection relativeParams)
        {
            processID.CheckStringIsNullOrEmpty("processID");

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            StringBuilder strB = new StringBuilder();

            strB.AppendFormat("DELETE WF.PROCESS_RELATIVE_PARAMS WHERE {0}",
                              wBuilder.ToSqlString(TSqlBuilder.Instance));

            foreach (WfProcessRelativeParam rp in relativeParams)
            {
                if (strB.Length > 0)
                {
                    strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
                }

                strB.Append(ORMapping.GetInsertSql(rp, TSqlBuilder.Instance));
            }

            DbHelper.RunSqlWithTransaction(strB.ToString(), GetConnectionName());
        }
Beispiel #2
0
        public void Update(string processID, WfProcessCurrentAssigneeCollection assignees)
        {
            processID.CheckStringIsNullOrEmpty("processID");

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            string sqlDelete = string.Format(
                "DELETE WF.PROCESS_CURRENT_ASSIGNEES WHERE {0}",
                wBuilder.ToSqlString(TSqlBuilder.Instance));

            StringBuilder strB = new StringBuilder();

            foreach (WfProcessCurrentAssignee assignee in assignees)
            {
                if (strB.Length > 0)
                {
                    strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
                }

                strB.Append(ORMapping.GetInsertSql(assignee, TSqlBuilder.Instance));
            }

            string sql = sqlDelete;

            if (strB.Length > 0)
            {
                sql += TSqlBuilder.Instance.DBStatementSeperator + strB.ToString();
            }

            DbHelper.RunSqlWithTransaction(sql, GetConnectionName());
        }
        public override void Delete(WfRelativeProcess data)
        {
            ORMappingItemCollection mapping = ORMapping.GetMappingInfo <WfRelativeProcess>();

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", data.ProcessID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            string sql = string.Format("DELETE {0} WHERE {1}", mapping.TableName, wBuilder.ToSqlString(TSqlBuilder.Instance));

            DbHelper.RunSql(sql, GetConnectionName());
        }
        public void Update(string processID, WfProcessCurrentActivityCollection pcas)
        {
            processID.CheckStringIsNullOrEmpty("processID");
            pcas.NullCheck("pcas");

            StringBuilder      strB = new StringBuilder();
            InSqlClauseBuilder deleteActivityIDs = new InSqlClauseBuilder("ACTIVITY_ID");

            foreach (WfProcessCurrentActivity pca in pcas)
            {
                if (strB.Length > 0)
                {
                    strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
                }

                strB.Append(ORMapping.GetInsertSql(pca, TSqlBuilder.Instance));

                deleteActivityIDs.AppendItem(pca.ActivityID);
            }

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            string sqlDelete = string.Format("DELETE WF.PROCESS_CURRENT_ACTIVITIES WHERE {0}",
                                             wBuilder.ToSqlString(TSqlBuilder.Instance));

            if (deleteActivityIDs.Count > 0)
            {
                sqlDelete += string.Format(" AND {0}", deleteActivityIDs.ToSqlString(TSqlBuilder.Instance));
            }

            string sql = sqlDelete;

            if (strB.Length > 0)
            {
                sql += TSqlBuilder.Instance.DBStatementSeperator + strB.ToString();
            }

            DbHelper.RunSqlWithTransaction(sql, GetConnectionName());
        }
        /// <summary>
        /// 返回流程所有的已流转过的活动节点
        /// </summary>
        /// <param name="processID"></param>
        /// <returns></returns>
        public WfProcessCurrentActivityCollection Load(string processID)
        {
            processID.CheckStringIsNullOrEmpty(processID);

            WfProcessCurrentActivityCollection result = new WfProcessCurrentActivityCollection();

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            string sql = string.Format("SELECT * FROM WF.PROCESS_CURRENT_ACTIVITIES WHERE {0}",
                                       wBuilder.ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

            result.LoadFromDataView(table.DefaultView);

            return(result);
        }
		/// <summary>
		/// 返回流程所有的已流转过的活动节点
		/// </summary>
		/// <param name="processID"></param>
		/// <returns></returns>
		public WfProcessCurrentActivityCollection Load(string processID)
		{
			processID.CheckStringIsNullOrEmpty(processID);

			WfProcessCurrentActivityCollection result = new WfProcessCurrentActivityCollection();

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

			string sql = string.Format("SELECT * FROM WF.PROCESS_CURRENT_ACTIVITIES WHERE {0}",
                wBuilder.ToSqlString(TSqlBuilder.Instance));

			DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];

			result.LoadFromDataView(table.DefaultView);

			return result;
		}
        public void Update(string processID, WfRelativeProcessCollection relativeProcesses)
        {
            processID.CheckStringIsNullOrEmpty("processID");
            relativeProcesses.NullCheck("relativeProcesses");

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

            ORMappingItemCollection mapping = ORMapping.GetMappingInfo <WfRelativeProcess>();

            string sqlDelete = string.Format(
                "DELETE {0} WHERE {1}",
                mapping.TableName,
                wBuilder.ToSqlString(TSqlBuilder.Instance));

            StringBuilder strB = new StringBuilder();

            foreach (WfRelativeProcess relativeProcess in relativeProcesses)
            {
                if (strB.Length > 0)
                {
                    strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
                }

                strB.Append(ORMapping.GetInsertSql(relativeProcess, TSqlBuilder.Instance));
            }

            string sql = sqlDelete;

            if (strB.Length > 0)
            {
                sql += TSqlBuilder.Instance.DBStatementSeperator + strB.ToString();
            }

            DbHelper.RunSqlWithTransaction(sql, GetConnectionName());
        }
		public void Update(string processID, WfProcessCurrentActivityCollection pcas)
		{
			processID.CheckStringIsNullOrEmpty("processID");
			pcas.NullCheck("pcas");

			StringBuilder strB = new StringBuilder();
			InSqlClauseBuilder deleteActivityIDs = new InSqlClauseBuilder("ACTIVITY_ID");

			foreach (WfProcessCurrentActivity pca in pcas)
			{
				if (strB.Length > 0)
					strB.Append(TSqlBuilder.Instance.DBStatementSeperator);

				strB.Append(ORMapping.GetInsertSql(pca, TSqlBuilder.Instance));

				deleteActivityIDs.AppendItem(pca.ActivityID);
			}

            WhereSqlClauseBuilder wBuilder = new WhereSqlClauseBuilder();

            wBuilder.AppendItem("PROCESS_ID", processID);
            wBuilder.AppendTenantCodeSqlClause(typeof(WfProcessCurrentActivity));

			string sqlDelete = string.Format("DELETE WF.PROCESS_CURRENT_ACTIVITIES WHERE {0}",
                wBuilder.ToSqlString(TSqlBuilder.Instance));

			if (deleteActivityIDs.Count > 0)
				sqlDelete += string.Format(" AND {0}", deleteActivityIDs.ToSqlString(TSqlBuilder.Instance));

			string sql = sqlDelete;

			if (strB.Length > 0)
				sql += TSqlBuilder.Instance.DBStatementSeperator + strB.ToString();

			DbHelper.RunSqlWithTransaction(sql, GetConnectionName());
		}