コード例 #1
0
        public void VoidRecordedService_Fail()
        {
            var url = baseRoute + "VoidRecordedService";
            var voidServiceModel = new VoidServiceModel
            {
                ServiceRecordingID           = -1,
                ServiceRecordingVoidReasonID = 1,
                IncorrectOrganization        = true,
                IncorrectServiceType         = true,
                IncorrectServiceItem         = true,
                IncorrectServiceStatus       = true,
                IncorrectSupervisor          = true,
                IncorrectAdditionalUser      = true,
                IncorrectAttendanceStatus    = true,
                IncorrectStartDate           = true,
                IncorrectStartTime           = true,
                IncorrectEndDate             = true,
                IncorrectEndTime             = true,
                IncorrectDeliveryMethod      = true,
                IncorrectServiceLocation     = true,
                IncorrectRecipientCode       = true,
                IncorrectTrackingField       = true,
                Comments   = "",
                ModifiedOn = DateTime.Now
            };
            //Act
            var response = communicationManager.Post <VoidServiceModel, Response <VoidServiceModel> >(voidServiceModel, url);

            //Assert
            Assert.IsNull(response, "Response is null");
            Assert.IsNull(response.DataItems, "Unable to void service");
        }
コード例 #2
0
        public static Response <VoidServiceViewModel> ToViewModel(this Response <VoidServiceModel> entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dataItems = new List <VoidServiceViewModel>();

            if (entity.DataItems != null)
            {
                entity.DataItems.ForEach(delegate(VoidServiceModel VoidServiceModel)
                {
                    var transformedModel = VoidServiceModel.ToModel();
                    dataItems.Add(transformedModel);
                });
            }
            else
            {
                dataItems = null;
            }

            var model = new Response <VoidServiceViewModel>
            {
                ResultCode       = entity.ResultCode,
                ResultMessage    = entity.ResultMessage,
                DataItems        = dataItems,
                RowAffected      = entity.RowAffected,
                AdditionalResult = entity.AdditionalResult
            };

            return(model);
        }
コード例 #3
0
        private List <SqlParameter> BuildParams(VoidServiceModel voidServiceModel, bool isCreateCopyToEdit)
        {
            var spParameters = new List <SqlParameter>();

            if (isCreateCopyToEdit)
            {
                spParameters.Add(new SqlParameter("IsCreateCopyToEdit", voidServiceModel.IsCreateCopyToEdit));
            }

            spParameters.AddRange(new List <SqlParameter> {
                new SqlParameter("ServiceRecordingID", voidServiceModel.ServiceRecordingID),
                new SqlParameter("ServiceRecordingVoidReasonID", voidServiceModel.ServiceRecordingVoidReasonID),
                new SqlParameter("ContactID", (object)voidServiceModel.ContactID ?? DBNull.Value),
                new SqlParameter("IncorrectOrganization", voidServiceModel.IncorrectOrganization),
                new SqlParameter("IncorrectServiceType", voidServiceModel.IncorrectServiceType),
                new SqlParameter("IncorrectServiceItem", voidServiceModel.IncorrectServiceItem),
                new SqlParameter("IncorrectServiceStatus", voidServiceModel.IncorrectServiceStatus),
                new SqlParameter("IncorrectSupervisor", voidServiceModel.IncorrectSupervisor),
                new SqlParameter("IncorrectAdditionalUser", voidServiceModel.IncorrectAdditionalUser),
                new SqlParameter("IncorrectAttendanceStatus", voidServiceModel.IncorrectAttendanceStatus),
                new SqlParameter("IncorrectStartDate", voidServiceModel.IncorrectStartDate),
                new SqlParameter("IncorrectStartTime", voidServiceModel.IncorrectStartTime),
                new SqlParameter("IncorrectEndDate", (object)voidServiceModel.IncorrectEndDate ?? DBNull.Value),
                new SqlParameter("IncorrectEndTime", voidServiceModel.IncorrectEndTime),
                new SqlParameter("IncorrectDeliveryMethod", voidServiceModel.IncorrectDeliveryMethod),
                new SqlParameter("IncorrectServiceLocation", voidServiceModel.IncorrectServiceLocation),
                new SqlParameter("IncorrectRecipientCode", voidServiceModel.IncorrectRecipientCode),
                new SqlParameter("IncorrectTrackingField", voidServiceModel.IncorrectTrackingField),
                new SqlParameter("Comments", (object)voidServiceModel.Comments ?? DBNull.Value),
                new SqlParameter("NoteHeaderID", (object)voidServiceModel.NoteHeaderID ?? DBNull.Value),
                new SqlParameter("ModifiedOn", voidServiceModel.ModifiedOn)
            });
            return(spParameters);
        }
コード例 #4
0
        /// <summary>
        /// set call center service as void
        /// </summary>
        /// <param name="voidService">The voidService identifier.</param>
        /// <returns></returns>
        public Response <VoidServiceModel> VoidServiceCallCenter(VoidServiceModel voidService)
        {
            var voidServiceRepository = unitOfWork.GetRepository <VoidServiceModel>(SchemaName.Core);
            var procParams            = BuildParams(voidService, true);
            var response = unitOfWork.EnsureInTransaction(voidServiceRepository.ExecuteNQStoredProc, "usp_AddServiceRecordingVoidCallCenter", procParams,
                                                          idResult: true, forceRollback: voidService.ForceRollback.GetValueOrDefault(false));

            return(response);
        }
コード例 #5
0
        public static VoidServiceModel ToModel(this VoidServiceViewModel entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new VoidServiceModel
            {
                ServiceRecordingVoidID       = entity.ServiceRecordingVoidID,
                ServiceRecordingID           = entity.ServiceRecordingID,
                ServiceRecordingVoidReasonID = entity.ServiceRecordingVoidReasonID,
                IncorrectOrganization        = entity.IncorrectOrganization,
                IncorrectServiceType         = entity.IncorrectServiceType,
                IncorrectServiceItem         = entity.IncorrectServiceItem,
                IncorrectServiceStatus       = entity.IncorrectServiceStatus,
                IncorrectSupervisor          = entity.IncorrectSupervisor,
                IncorrectAdditionalUser      = entity.IncorrectAdditionalUser,
                IncorrectAttendanceStatus    = entity.IncorrectAttendanceStatus,
                IncorrectStartDate           = entity.IncorrectStartDate,
                IncorrectStartTime           = entity.IncorrectStartTime,
                IncorrectEndDate             = entity.IncorrectEndDate,
                IncorrectEndTime             = entity.IncorrectEndTime,
                IncorrectDeliveryMethod      = entity.IncorrectDeliveryMethod,
                IncorrectServiceLocation     = entity.IncorrectServiceLocation,
                IncorrectRecipientCode       = entity.IncorrectRecipientCode,
                IncorrectTrackingField       = entity.IncorrectTrackingField,
                Comments           = entity.Comments,
                IsCreateCopyToEdit = entity.IsCreateCopyToEdit,
                ModifiedOn         = entity.ModifiedOn,
                ModifiedBy         = entity.ModifiedBy,
                ContactID          = entity.ContactID,
                NoteHeaderID       = entity.NoteHeaderID
            };

            return(model);
        }
コード例 #6
0
        public void VoidRecordedService_Success()
        {
            Mock <IVoidServiceDataProvider> mock = new Mock <IVoidServiceDataProvider>();

            voidServiceDataProvider = mock.Object;
            VoidServiceController voidServiceController = new VoidServiceController(voidServiceDataProvider);
            var voidServiceModel = new VoidServiceModel
            {
                ServiceRecordingID           = 1,
                ServiceRecordingVoidReasonID = 1,
                IncorrectOrganization        = true,
                IncorrectServiceType         = true,
                IncorrectServiceItem         = true,
                IncorrectServiceStatus       = true,
                IncorrectSupervisor          = true,
                IncorrectAdditionalUser      = true,
                IncorrectAttendanceStatus    = true,
                IncorrectStartDate           = true,
                IncorrectStartTime           = true,
                IncorrectEndDate             = true,
                IncorrectEndTime             = true,
                IncorrectDeliveryMethod      = true,
                IncorrectServiceLocation     = true,
                IncorrectRecipientCode       = true,
                IncorrectTrackingField       = true,
                Comments   = "",
                ModifiedOn = DateTime.Now
            };
            //Act
            var saveResult = voidServiceController.VoidRecordedService(voidServiceModel);
            var response   = saveResult as HttpResult <Response <VoidServiceModel> >;
            var count      = response.Value.DataItems.Count();

            //Assert
            Assert.IsNotNull(voidServiceModel);
            Assert.IsTrue(count > 0);
        }
コード例 #7
0
 public Response <VoidServiceModel> VoidServiceCallCenter(VoidServiceModel voidService)
 {
     return(voidRecordedService.VoidServiceCallCenter(voidService));
 }
コード例 #8
0
 public Response <VoidServiceModel> VoidService(VoidServiceModel voidService)
 {
     return(voidRecordedService.VoidService(voidService));
 }
コード例 #9
0
        public IHttpActionResult VoidServiceCallCenter(VoidServiceModel voidService)
        {
            var voidServiceResult = voidServiceDataProvider.VoidServiceCallCenter(voidService);

            return(new HttpResult <Response <VoidServiceModel> >(voidServiceResult, Request));
        }
コード例 #10
0
        public Response <VoidServiceModel> VoidServiceCallCenter(VoidServiceModel voidService)
        {
            var apiUrl = baseRoute + "/VoidServiceCallCenter";

            return(communicationManager.Post <VoidServiceModel, Response <VoidServiceModel> >(voidService, apiUrl));
        }
コード例 #11
0
 public IHttpActionResult VoidServiceCallCenter(VoidServiceModel voidService)
 {
     return(new HttpResult <Response <VoidServiceModel> >(voidServiceRuleEngine.VoidServiceCallCenter(voidService), Request));
 }
コード例 #12
0
 public IHttpActionResult VoidRecordedService(VoidServiceModel voidService)
 {
     return(new HttpResult <Response <VoidServiceModel> >(voidServiceRuleEngine.VoidService(voidService), Request));
 }