public static void Run() { var service = UnityConfig.GetConfiguredContainer().Resolve <AssignmentService>(); var statuses = UnityConfig.GetConfiguredContainer().Resolve <StatusService>(); var playbook = service.GetPlaybookForWeekShift(0); var newRow = new PlaybookRow { Description = "This is a description", Duration = 0.25, IntraweekID = GetID <IntraweekEntity>(service.UnitOfWork, "Tue"), PriorityID = GetID <PriorityEntity>(service.UnitOfWork, "BAU"), WhatID = 5, ResourceID = 2, StatusID = statuses.Booked.ID, }; service.CreateAssignment(playbook.WeekID, newRow, 1); }
public void CreateAssignment(int weekID, PlaybookRow newRow, int requestorID) { var task = new AssignmentEntity { Description = newRow.Description, Duration = newRow.Duration, IntraweekID = newRow.IntraweekID, PriorityID = newRow.PriorityID, StatusID = _statuses.Booked.ID, RequestorID = requestorID, RequestedStamp = DateTime.Now, ResourceID = newRow.ResourceID, WhatID = newRow.WhatID, WhenID = weekID, Completed = 0.0, }; _repository.Add(task); UnitOfWork.Commit(); }