コード例 #1
0
 private static ServiceRequest CreateServiceRequestInDatabase(int creatingUserId, int priorityId)
 {
     using (EducationDataContext context = new EducationDataContext())
     {
         ServiceRequestFulfillment newServiceRequestFulfillment = new ServiceRequestFulfillment { FulfillmentStatusId = 1, Notes = "Test", CreatingUserId = 1 };
         ServiceRequest newRequestToEdit = new ServiceRequest { CreatingUserId = creatingUserId, PriorityId = priorityId, ServiceTypeId = 1, StudentId = 6, SubjectId = 2, FulfillmentDetails = new List<ServiceRequestFulfillment> { newServiceRequestFulfillment } };
         context.ServiceRequests.Add(newRequestToEdit);
         context.SaveChanges();
         return newRequestToEdit;
     }
 }
        public void WhenConstruct_ThenCreateTimeSet()
        {
            ServiceRequestFulfillment actual = new ServiceRequestFulfillment();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }
 public void Update(ServiceRequestFulfillment item)
 {
     Context.SetModified(item);
 }
 public void Remove(ServiceRequestFulfillment item)
 {
     Context.ServiceRequestFulfillments.Remove(item);
 }
 public void Add(ServiceRequestFulfillment item)
 {
     Context.ServiceRequestFulfillments.Add(item);
 }
コード例 #6
0
        public void WhenConstruct_ThenCreateTimeSet()
        {
            ServiceRequestFulfillment actual = new ServiceRequestFulfillment();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }
コード例 #7
0
 private void CreateFulfillmentDetail(ServiceRequest model, EducationSecurityPrincipal user, ServiceRequestModel viewModel)
 {
     int selectedStatusId = viewModel.SelectedStatusId != 0 ? viewModel.SelectedStatusId : 1;
     var newDetail = new ServiceRequestFulfillment
     {
         FulfilledById = viewModel.SelectedAssignedOfferingId,
         CreatingUser = user.Identity.User,
         ServiceRequest = model,
         FulfillmentStatusId = selectedStatusId,
         Notes = viewModel.FulfillmentNotes
     };
     if (model.FulfillmentDetails == null)
     {
         model.FulfillmentDetails = new List<ServiceRequestFulfillment> { newDetail };
     }
     else
     {
         model.FulfillmentDetails.Add(newDetail);
     }
 }