Example #1
0
        internal static async Task AddPrompts(List <WorkflowTask> workflowTasksToAdd, string regNumber, int jobId)
        {
            var originalTaskToAddCount = workflowTasksToAdd.Count;

            Console.WriteLine($"Adding {originalTaskToAddCount} Prompts");
            Trace.WriteLine($"{regNumber}, ,Processing {originalTaskToAddCount} Prompts");

            using (var context = new TaskMgmtDbContext(connectionString))
            {
                var existingTask = await context.WorkflowTask.Where(wt => wt.ReferenceId == jobId).ToListAsync();

                Trace.WriteLine($"{regNumber}, ,Looking for duplicates because Milestone pages might have already created prompts");

                foreach (var wtTask in existingTask)
                {
                    workflowTasksToAdd.RemoveAll(wt => wt.Subject.Equals(wtTask.Subject,
                                                                         StringComparison.CurrentCultureIgnoreCase));
                }

                var revisedTaskToAddCount = workflowTasksToAdd.Count;

                if (revisedTaskToAddCount != originalTaskToAddCount)
                {
                    Trace.WriteLine($"{regNumber}, ,Found and removed duplicate prompts");
                }

                if (workflowTasksToAdd.Count == 0)
                {
                    return;
                }

                context.WorkflowTask.AddRange(workflowTasksToAdd);
                context.SaveChanges();
            }
        }
Example #2
0
        //public static string connectionString = @"data source=qaue2helix3sql01.database.windows.net;initial catalog=Helix3.Tasks;User ID=helix3_app;Password=V$@h@ERZnrDFGvZ9; Connect Timeout=120;MultipleActiveResultSets=True;";

        public static void ChangeDateCreated(int noteId, DateTime date, string regNumber)
        {
            using (var context = new TaskMgmtDbContext(connectionString))
            {
                var createdNote = context.Note.Find(noteId);

                createdNote.DateCreated = date;
                context.SaveChanges();
            }
        }
Example #3
0
        internal static void RemovePrompts()
        {
            Console.WriteLine($"Removing Prompts create on behalf of [email protected]");

            using (var context = new TaskMgmtDbContext(connectionString))
            {
                context.Database.ExecuteSqlCommand(@"
                                                Delete from WorkFlowTask
                                                where ModifiedBy = '*****@*****.**'
                                                ");
            }
        }
Example #4
0
        internal static async Task AddNotes(List <CreateJobNoteRequest> createJobNoteRequests, int jobId, string regNumber)
        {
            Console.WriteLine($"Adding {createJobNoteRequests.Count} Notes to Task");
            Trace.WriteLine($"{regNumber}, , Adding {createJobNoteRequests.Count} Notes to Task");

            var noteEntity = createJobNoteRequests.ToNotesEntity();

            using (var context = new TaskMgmtDbContext(connectionString))
            {
                context.Note.AddRange(noteEntity);
                context.SaveChanges();
            }
        }
Example #5
0
 public StatusesController(TaskMgmtDbContext context)
 {
     _context = context;
 }
 public CategoriesController(TaskMgmtDbContext context)
 {
     _context = context;
 }
 public WorklogsController(TaskMgmtDbContext context)
 {
     _context = context;
 }
 public TasksController(TaskMgmtDbContext context)
 {
     _context = context;
 }