예제 #1
0
 internal void OnBeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
 {
     if (BeforeUpdateUserTask != null)
     {
         BeforeUpdateUserTask(task, idType, fields, context);
     }
 }
예제 #2
0
 public void OnBeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
 {
     foreach (UserTaskOpEventContainer container in EventContainers)
     {
         container.OnBeforeUpdateUserTask(task, idType, fields, Context);
     }
 }
 private void eventContainer_BeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary<object, object> context)
 {
     if ((fields & ~UserTaskFieldDefine.ReadTime) != UserTaskFieldDefine.None)
     {
         ProcessTaskByIDType(task, idType);
     }
 }
 private void eventContainer_BeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
 {
     if ((fields & ~UserTaskFieldDefine.ReadTime) != UserTaskFieldDefine.None)
     {
         ProcessTaskByIDType(task, idType);
     }
 }
예제 #5
0
        private static ORMappingItem GetMappingItemFromIDType(UserTaskIDType idType)
        {
            ORMappingItemCollection mappings = ORMapping.GetMappingInfo <UserTask>();

            ORMappingItem keyItem = GetMappingFromPropertyName(idType.ToString(), mappings);

            ExceptionHelper.FalseThrow(keyItem != null, "不能找到idType为{0}对应的字段", idType.ToString());

            return(keyItem);
        }
예제 #6
0
        internal int OnUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
        {
            int result = 0;

            if (UpdateUserTask != null)
            {
                result = UpdateUserTask(task, idType, fields, context);
            }

            return(result);
        }
예제 #7
0
        private static int eventContainer_UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(task != null, "task");

            WhereSqlClauseBuilder  wBuilder = GetWhereSqlClauseBuilderByUserTask(task, idType);
            UpdateSqlClauseBuilder uBuilder = GetUpdateSqlClauseBuilderByUserTask(task, fields);

            string sql = string.Format("UPDATE WF.USER_TASK SET {0} WHERE {1}",
                                       uBuilder.ToSqlString(TSqlBuilder.Instance),
                                       wBuilder.ToSqlString(TSqlBuilder.Instance));

            return(DbHelper.RunSql(sql, GetConnectionName()));
        }
예제 #8
0
        public int OnUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
        {
            int result = 0;

            foreach (UserTaskOpEventContainer container in EventContainers)
            {
                int r = container.OnUpdateUserTask(task, idType, fields, Context);

                if (r > result)
                {
                    result = r;
                }
            }

            return(result);
        }
예제 #9
0
        public int UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(task != null, "task");
            int result = 0;

            UserOpContext contexts = InitEventContexts();

            contexts.OnBeforeUpdateUserTask(task, idType, fields);

            using (TransactionScope scope = TransactionScopeFactory.Create())
            {
                result = contexts.OnUpdateUserTask(task, idType, fields);

                scope.Complete();
            }

            return(result);
        }
        private static void ProcessTaskByIDType(UserTask task, UserTaskIDType idType)
        {
            if ((idType & UserTaskIDType.SendToUserID) != UserTaskIDType.None)
            {
                TaskChangedUserIDs[task.SendToUserID] = task.SendToUserID;
            }

            UserTaskIDType otherType = idType & ~UserTaskIDType.SendToUserID;

            if (otherType != UserTaskIDType.None)
            {
                UserTaskCollection tasks = GetUserTasks(task, otherType);

                foreach (UserTask oneTask in tasks)
                {
                    TaskChangedUserIDs[oneTask.SendToUserID] = oneTask.SendToUserID;
                }
            }
        }
예제 #11
0
        public UserTaskCollection GetUserAccomplishedTasks(UserTaskIDType idType, UserTaskFieldDefine returnFields, bool nolock, params string[] ids)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(ids != null, "ids");

            UserTaskCollection utc = new UserTaskCollection();

            if (ids.Length > 0)
            {
                ORMappingItem keyItem = GetMappingItemFromIDType(idType);

                InSqlClauseBuilder iBuilder = new InSqlClauseBuilder();

                iBuilder.AppendItem(ids);

                string sql = string.Format("SELECT {0} FROM WF.USER_ACCOMPLISHED_TASK{1} WHERE {2} {3}",
                                           GetUserTaskSelectFields(returnFields),
                                           nolock ? "(NOLOCK)" : string.Empty,
                                           GetMappingItemFromIDType(idType).DataFieldName,
                                           iBuilder.ToSqlStringWithInOperator(TSqlBuilder.Instance));

                using (DbContext dbi = DbHelper.GetDBContext(GetConnectionName()))
                {
                    Database db = DatabaseFactory.Create(dbi);

                    using (IDataReader dr = db.ExecuteReader(CommandType.Text, sql))
                    {
                        while (dr.Read())
                        {
                            UserTask ut = new UserTask();

                            ORMapping.DataReaderToObject(dr, ut);

                            utc.Add(ut);
                        }
                    }
                }
            }

            return(utc);
        }
        private static UserTaskCollection GetUserTasks(UserTask task, UserTaskIDType idType)
        {
            UserTaskCollection result = new UserTaskCollection();

            foreach (EnumItemDescription desp in EnumItemDescriptionAttribute.GetDescriptionList(typeof(UserTaskIDType)))
            {
                UserTaskIDType enumIdType = (UserTaskIDType)desp.EnumValue;

                if ((enumIdType & idType) != UserTaskIDType.None && enumIdType != UserTaskIDType.SendToUserID)
                {
                    UserTaskIDType targetIDType = (UserTaskIDType)desp.EnumValue | (idType & UserTaskIDType.SendToUserID);

                    UserTaskCollection tasks = UserTaskAdapter.Instance.GetUserTasks(
                        targetIDType,
                        UserTaskFieldDefine.TaskID | UserTaskFieldDefine.SendToUserID | UserTaskFieldDefine.ActivityID,
                        true,
                        DefaultUserTaskOperationImpl.GetUserTaskIDValue(task, targetIDType));

                    result.CopyFrom(tasks);
                }
            }

            return(result);
        }
        private int eventContainer_UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary<object, object> context)
        {
            AttachTransactionEvent();

            return 0;
        }
예제 #14
0
 internal static string GetUserTaskIDValue(UserTask task, UserTaskIDType idType)
 {
     return((string)task.GetType().GetProperty(idType.ToString()).GetValue(task, null));
 }
예제 #15
0
        internal static WhereSqlClauseBuilder GetWhereSqlClauseBuilderByUserTask(UserTask task, UserTaskIDType idType)
        {
            WhereSqlClauseBuilder   builder  = new WhereSqlClauseBuilder();
            EnumItemDescriptionList despList = EnumItemDescriptionAttribute.GetDescriptionList(typeof(UserTaskIDType));

            foreach (EnumItemDescription desp in despList)
            {
                if (((UserTaskIDType)desp.EnumValue & idType) != UserTaskIDType.None)
                {
                    builder.AppendItem(desp.Description, GetUserTaskIDValue(task, (UserTaskIDType)desp.EnumValue));
                }
            }

            return(builder);
        }
예제 #16
0
		internal void OnBeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary<object, object> context)
		{
			if (BeforeUpdateUserTask != null)
				BeforeUpdateUserTask(task, idType, fields, context);
		}
예제 #17
0
		private static ORMappingItem GetMappingItemFromIDType(UserTaskIDType idType)
		{
			ORMappingItemCollection mappings = ORMapping.GetMappingInfo<UserTask>();

			ORMappingItem keyItem = GetMappingFromPropertyName(idType.ToString(), mappings);

			ExceptionHelper.FalseThrow(keyItem != null, "不能找到idType为{0}对应的字段", idType.ToString());

			return keyItem;
		}
예제 #18
0
		internal int OnUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary<object, object> context)
		{
			int result = 0;

			if (UpdateUserTask != null)
				result = UpdateUserTask(task, idType, fields, context);

			return result;
		}
예제 #19
0
		public void OnBeforeUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
		{
			foreach (UserTaskOpEventContainer container in EventContainers)
				container.OnBeforeUpdateUserTask(task, idType, fields, Context);
		}
 internal static string GetUserTaskIDValue(UserTask task, UserTaskIDType idType)
 {
     return (string)task.GetType().GetProperty(idType.ToString()).GetValue(task, null);
 }
        private static void ProcessTaskByIDType(UserTask task, UserTaskIDType idType)
        {
            if ((idType & UserTaskIDType.SendToUserID) != UserTaskIDType.None)
                TaskChangedUserIDs[task.SendToUserID] = task.SendToUserID;

            UserTaskIDType otherType = idType & ~UserTaskIDType.SendToUserID;

            if (otherType != UserTaskIDType.None)
            {
                UserTaskCollection tasks = GetUserTasks(task, otherType);

                foreach (UserTask oneTask in tasks)
                    TaskChangedUserIDs[oneTask.SendToUserID] = oneTask.SendToUserID;
            }
        }
예제 #22
0
		public int OnUpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
		{
			int result = 0;

			foreach (UserTaskOpEventContainer container in EventContainers)
			{
				int r = container.OnUpdateUserTask(task, idType, fields, Context);

				if (r > result)
					result = r;
			}

			return result;
		}
        private int eventContainer_UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
        {
            AttachTransactionEvent();

            return(0);
        }
        private static UserTaskCollection GetUserTasks(UserTask task, UserTaskIDType idType)
        {
            UserTaskCollection result = new UserTaskCollection();

            foreach (EnumItemDescription desp in EnumItemDescriptionAttribute.GetDescriptionList(typeof(UserTaskIDType)))
            {
                UserTaskIDType enumIdType = (UserTaskIDType)desp.EnumValue;

                if ((enumIdType & idType) != UserTaskIDType.None && enumIdType != UserTaskIDType.SendToUserID)
                {
                    UserTaskIDType targetIDType = (UserTaskIDType)desp.EnumValue | (idType & UserTaskIDType.SendToUserID);

                    UserTaskCollection tasks = UserTaskAdapter.Instance.GetUserTasks(
                                targetIDType,
                                UserTaskFieldDefine.TaskID | UserTaskFieldDefine.SendToUserID | UserTaskFieldDefine.ActivityID,
                                true,
                                DefaultUserTaskOperationImpl.GetUserTaskIDValue(task, targetIDType));

                    result.CopyFrom(tasks);
                }
            }

            return result;
        }
        internal static WhereSqlClauseBuilder GetWhereSqlClauseBuilderByUserTask(UserTask task, UserTaskIDType idType)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
            EnumItemDescriptionList despList = EnumItemDescriptionAttribute.GetDescriptionList(typeof(UserTaskIDType));

            foreach (EnumItemDescription desp in despList)
                if (((UserTaskIDType)desp.EnumValue & idType) != UserTaskIDType.None)
                    builder.AppendItem(desp.Description, GetUserTaskIDValue(task, (UserTaskIDType)desp.EnumValue));

            return builder;
        }
예제 #26
0
        private int eventContainer_UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary <object, object> context)
        {
            Write(GetMessageContent(task), "UpdateUserTask");

            return(0);
        }
예제 #27
0
		/// <summary>
		/// 根据Task的ID获得UserTask对象集合
		/// </summary>
		/// <param name="idType"></param>
		/// <param name="returnFields"></param>
		/// <param name="ids"></param>
		/// <returns></returns>
		public UserTaskCollection GetUserTasks(UserTaskIDType idType, UserTaskFieldDefine returnFields, params string[] ids)
		{
			return GetUserTasks(idType, returnFields, false, ids);
		}
예제 #28
0
 /// <summary>
 /// 根据Task的ID获得UserTask对象集合
 /// </summary>
 /// <param name="idType"></param>
 /// <param name="returnFields"></param>
 /// <param name="ids"></param>
 /// <returns></returns>
 public UserTaskCollection GetUserTasks(UserTaskIDType idType, UserTaskFieldDefine returnFields, params string[] ids)
 {
     return(GetUserTasks(idType, returnFields, false, ids));
 }
예제 #29
0
		public UserTaskCollection GetUserAccomplishedTasks(UserTaskIDType idType, UserTaskFieldDefine returnFields, bool nolock, params string[] ids)
		{
			ExceptionHelper.FalseThrow<ArgumentNullException>(ids != null, "ids");

			UserTaskCollection utc = new UserTaskCollection();

			if (ids.Length > 0)
			{
				ORMappingItem keyItem = GetMappingItemFromIDType(idType);

				InSqlClauseBuilder iBuilder = new InSqlClauseBuilder();

				iBuilder.AppendItem(ids);

				string sql = string.Format("SELECT {0} FROM WF.USER_ACCOMPLISHED_TASK{1} WHERE {2} {3}",
					GetUserTaskSelectFields(returnFields),
					nolock ? "(NOLOCK)" : string.Empty,
					GetMappingItemFromIDType(idType).DataFieldName,
					iBuilder.ToSqlStringWithInOperator(TSqlBuilder.Instance));

				using (DbContext dbi = DbHelper.GetDBContext(GetConnectionName()))
				{
					Database db = DatabaseFactory.Create(dbi);

					using (IDataReader dr = db.ExecuteReader(CommandType.Text, sql))
					{
						while (dr.Read())
						{
							UserTask ut = new UserTask();

							ORMapping.DataReaderToObject(dr, ut);

							utc.Add(ut);
						}
					}
				}
			}

			return utc;
		}
예제 #30
0
		public int UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields)
		{
			ExceptionHelper.FalseThrow<ArgumentNullException>(task != null, "task");
			int result = 0;

			UserOpContext contexts = InitEventContexts();

			contexts.OnBeforeUpdateUserTask(task, idType, fields);

			using (TransactionScope scope = TransactionScopeFactory.Create())
			{
				result = contexts.OnUpdateUserTask(task, idType, fields);

				scope.Complete();
			}

			return result;
		}
        private static int eventContainer_UpdateUserTask(UserTask task, UserTaskIDType idType, UserTaskFieldDefine fields, Dictionary<object, object> context)
        {
            ExceptionHelper.FalseThrow<ArgumentNullException>(task != null, "task");

            WhereSqlClauseBuilder wBuilder = GetWhereSqlClauseBuilderByUserTask(task, idType);
            UpdateSqlClauseBuilder uBuilder = GetUpdateSqlClauseBuilderByUserTask(task, fields);

            string sql = string.Format("UPDATE WF.USER_TASK SET {0} WHERE {1}",
                uBuilder.ToSqlString(TSqlBuilder.Instance),
                wBuilder.ToSqlString(TSqlBuilder.Instance));

            return DbHelper.RunSql(sql, GetConnectionName());
        }