예제 #1
0
        /// <summary>
        /// Recalculates the object TotalMinutes and TotalApproved.
        /// </summary>
        /// <param name="objectId">The object id.</param>
        /// <param name="objectTypeId">The object type id.</param>
        /// <param name="projectId">The project id.</param>
        private static void RecalculateObjectAndProject(int?objectId, int?objectTypeId, int projectId)
        {
            using (DbTransaction tran = DbTransaction.Begin())
            {
                if (objectId.HasValue && objectTypeId.HasValue)
                {
                    DbTimeTracking.RecalculateObject(objectId.Value, objectTypeId.Value, projectId);
                }

                if (projectId > 0)
                {
                    DbTimeTracking.RecalculateProject(projectId);
                }

                tran.Commit();
            }
        }
예제 #2
0
        /// <summary>
        /// Recalculates the project and objects TotalMinutes and TotalApproved.
        /// </summary>
        /// <param name="block">The block.</param>
        private static void RecalculateProjectAndObjects(TimeTrackingBlock block)
        {
            int projectId = GetProjectIdByTimeTrackingBlock(block);

            if (projectId > 0)
            {
                TimeTrackingEntry[] entryList = TimeTrackingEntry.List(
                    FilterElement.EqualElement("ParentBlockId", block.PrimaryKeyId.Value),
                    FilterElement.IsNotNullElement("ObjectId"),
                    FilterElement.IsNotNullElement("ObjectTypeId"));
                foreach (TimeTrackingEntry entry in entryList)
                {
                    DbTimeTracking.RecalculateObject((int)entry.Properties["ObjectId"].Value, (int)entry.Properties["ObjectTypeId"].Value, block.ProjectId.Value);
                }

                DbTimeTracking.RecalculateProject(projectId);
            }
        }
예제 #3
0
 /// <summary>
 /// This method calls if the TaskTime value of Event, Task, ToDo, Incident or Document was changed.
 /// It also calls after deleting the Event, Task, ToDo, Incident or Document.
 /// </summary>
 /// <param name="projectId"></param>
 public static void RecalculateProjectTaskTime(int projectId)
 {
     DbTimeTracking.RecalculateProjectTaskTime(projectId);
 }
예제 #4
0
 public static DataTable GetListTimeTrackingItemsForAdd_DataTable(int blockTypeInstanceId, DateTime startDate, int userId)
 {
     return(DbTimeTracking.GetListTimeTrackingItemsForAdd_DataTable(blockTypeInstanceId, startDate, userId));
 }
예제 #5
0
 /// <summary>
 ///  ObjectId, ObjectTypeId, ObjectName, BlockTypeInstanceId
 /// </summary>
 /// <returns></returns>
 public static IDataReader GetListTimeTrackingItemsForAdd(int blockTypeInstanceId, DateTime startDate, int userId)
 {
     return(DbTimeTracking.GetListTimeTrackingItemsForAdd(blockTypeInstanceId, startDate, userId));
 }
예제 #6
0
 // Resets ObjectId and ObjectTypeId in cls_TimeSheetEntry
 public static void ResetObjectId(int objectTypeId, int objectId)
 {
     DbTimeTracking.ResetObjectId(objectTypeId, objectId);
 }