Exemplo n.º 1
0
        public IHttpActionResult FirstCase(string computerName)
        {
            using (var dbContext = new DataContext())
            {
                var ticketCount          = 0;
                var rejectReasons        = new List <AdjudicateRepository.sRejectReasons>();
                var caseInfo             = new AdjudicateRepository.sCaseInfo();
                var remoteCaseInfo       = new AdjudicateRepository.sCaseInfo();
                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.caseFirst(ref rejectReasons, out ticketCount, out caseInfo, out remoteCaseInfo, computerName))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok(
                           new FirstCaseModel
                {
                    Case = new CaseModel
                    {
                        TicketNo = caseInfo.mTicketNo,
                        Notification = caseInfo.mNotification,
                        VehicleRegNo = caseInfo.mVehicleRegNo,
                        VehicleRegNoConfirmed = caseInfo.mVehicleRegNoConfirmed,
                        VehicleMake = caseInfo.mVehicleMake,
                        VehicleModel = caseInfo.mVehicleModel,
                        VehicleColour = caseInfo.mVehicleColour,
                        VehicleType = caseInfo.mVehicleType,
                        VehicleLicenseExpire = caseInfo.mVehicleLicenseExpire,
                        OffenceSet = caseInfo.mOffenceSet,
                        OffenceDate = caseInfo.mOffenceDate,
                        OffenceSpeed = caseInfo.mOffenceSpeed,
                        OffenceZone = caseInfo.mOffenceZone,
                        OffenceDirectionLane = caseInfo.mOffenceDirectionLane,
                        OffenceCode = caseInfo.mOffenceCode,
                        OffenceNotes = caseInfo.mOffenceNotes,
                        OffenceAdditionalsXml = caseInfo.mOffenceAdditionalsXml,
                        Image1 = caseInfo.mImage1,
                        Image2 = caseInfo.mImage2,
                        ImageNP = caseInfo.mImageNP,
                        RemoteImage1 = remoteCaseInfo.mImage1,
                        RemoteImage2 = remoteCaseInfo.mImage2,
                        RemoteImageNP = remoteCaseInfo.mImageNP
                    },
                    TicketCount = ticketCount,
                    RejectReasons = rejectReasons.Select(f => new RejectReasonModel {
                        ID = f.mID, Description = f.mDescription
                    }).ToList()
                }));
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult UnlockFishpondCase(string ticketNumber)
        {
            using (var dbContext = new DataContext())
            {
                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.fishpondUnlock(ticketNumber))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok());
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult RejectFishpondCase(string ticketNumber, int reasonID, string notes, string computerName)
        {
            using (var dbContext = new DataContext())
            {
                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.fishpondCaseReject(ticketNumber, reasonID, notes, computerName))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok());
            }
        }
Exemplo n.º 4
0
        public IHttpActionResult FishpondCase(string ticketNumber, string computerName)
        {
            using (var dbContext = new DataContext())
            {
                var caseInfo       = new AdjudicateRepository.sCaseInfo();
                var remoteCaseInfo = new AdjudicateRepository.sCaseInfo();

                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.fishpondGetCase(ticketNumber, ref caseInfo, ref remoteCaseInfo, computerName))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok(
                           new CaseModel
                {
                    TicketNo = caseInfo.mTicketNo,
                    Notification = caseInfo.mNotification,
                    VehicleRegNo = caseInfo.mVehicleRegNo,
                    VehicleRegNoConfirmed = caseInfo.mVehicleRegNoConfirmed,
                    VehicleMake = caseInfo.mVehicleMake,
                    VehicleModel = caseInfo.mVehicleModel,
                    VehicleColour = caseInfo.mVehicleColour,
                    VehicleType = caseInfo.mVehicleType,
                    VehicleLicenseExpire = caseInfo.mVehicleLicenseExpire,
                    OffenceSet = caseInfo.mOffenceSet,
                    OffenceDate = caseInfo.mOffenceDate,
                    OffenceSpeed = caseInfo.mOffenceSpeed,
                    OffenceZone = caseInfo.mOffenceZone,
                    OffenceDirectionLane = caseInfo.mOffenceDirectionLane,
                    OffenceCode = caseInfo.mOffenceCode,
                    OffenceNotes = caseInfo.mOffenceNotes,
                    OffenceAdditionalsXml = caseInfo.mOffenceAdditionalsXml,
                    Image1 = caseInfo.mImage1,
                    Image2 = caseInfo.mImage2,
                    ImageNP = caseInfo.mImageNP,
                    RemoteImage1 = remoteCaseInfo.mImage1,
                    RemoteImage2 = remoteCaseInfo.mImage2,
                    RemoteImageNP = remoteCaseInfo.mImageNP
                }));
            }
        }
Exemplo n.º 5
0
        public IHttpActionResult AcceptFishpondCase([FromBody] CaseModel model, string computerName)
        {
            using (var dbContext = new DataContext())
            {
                var caseInfo = new AdjudicateRepository.sCaseInfo();
                caseInfo.mTicketNo = model.TicketNo;
                caseInfo.mOffenceAdditionalsXml = model.OffenceAdditionalsXml;
                caseInfo.mOffenceSet            = model.OffenceSet;
                caseInfo.mOffenceNotes          = model.OffenceNotes;

                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.fishpondCaseAccept(caseInfo, computerName))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok());
            }
        }
Exemplo n.º 6
0
        public IHttpActionResult FishpondCases()
        {
            using (var dbContext = new DataContext())
            {
                var rejectReasons     = new List <AdjudicateRepository.sRejectReasons>();
                var fishpondInfoCases = new List <AdjudicateRepository.cFishpondInfo>();

                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.fishpondGetCases(ref rejectReasons, ref fishpondInfoCases))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }
                //
                return(Ok(
                           new FirstFishpondCaseModel
                {
                    Cases = fishpondInfoCases.Select(f =>
                                                     new FishpondCaseModel
                    {
                        LockedBy = f.pLockedBy,
                        RejectBy = f.pRejectBy,
                        RejectReason = f.pRejectReason,
                        TicketDate = f.pTicketDate,
                        TicketNo = f.pTicketNo,
                        TimesRejected = f.pTimesRejected,
                        VehicleMake = f.pVehicleMake,
                        VehicleModel = f.pVehicleModel,
                        VehicleRegistration = f.pVehicleRegistration,
                        VerifyDate = f.pVerifyDate
                    })
                            .ToList(),
                    RejectReasons = rejectReasons.Select(f => new RejectReasonModel {
                        ID = f.mID, Description = f.mDescription
                    }).ToList()
                }));
            }
        }
Exemplo n.º 7
0
        public IHttpActionResult CaseAdditionals(int offenceSet)
        {
            using (var dbContext = new DataContext())
            {
                var offenceCodes = new List <AdjudicateRepository.sOffenseCode>();

                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);

                if (!adjudicateRepository.caseAdditionals(offenceSet, out offenceCodes))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                return(Ok(
                           offenceCodes.Select(f =>
                                               new OffenceCodeModel
                {
                    Amount = f.mAmount,
                    Code = f.mCode,
                    Description = f.mDescription
                })
                           .ToList()));
            }
        }
Exemplo n.º 8
0
        public IHttpActionResult AcceptCase([FromBody] CaseModel model, string computerName)
        {
            using (var dbContext = new DataContext())
            {
                var ticketCount = 0;
                var caseInfo    = new AdjudicateRepository.sCaseInfo();
                caseInfo.mTicketNo = model.TicketNo;
                caseInfo.mOffenceAdditionalsXml = model.OffenceAdditionalsXml;
                caseInfo.mOffenceSet            = model.OffenceSet;
                caseInfo.mOffenceNotes          = model.OffenceNotes;

                var remoteCaseInfo       = new AdjudicateRepository.sCaseInfo();
                var adjudicateRepository = new AdjudicateRepository(dbContext, SessionModel.CredentialID, SessionModel.UserName);
                if (!adjudicateRepository.caseAdjudicate(ref caseInfo, ref remoteCaseInfo, out ticketCount, computerName))
                {
                    return(this.BadRequestEx(Error.PopulateMethodFailed(adjudicateRepository.Error)));
                }

                var register = dbContext.Registers.SingleOrDefault(f => f.ReferenceNumber == caseInfo.mTicketNo);
                if (register == null)
                {
                    return(this.BadRequestEx(
                               Error.PopulateUnexpectedException(
                                   new Exception(string.Format("Case ({0}) not added to Registers table.", caseInfo.mTicketNo)))));
                }
                var referenceNumber = dbContext.GeneratedReferenceNumbers.SingleOrDefault(f => f.ReferenceNumber == caseInfo.mTicketNo);
                if (referenceNumber == null)
                {
                    return(this.BadRequestEx(
                               Error.PopulateUnexpectedException(
                                   new Exception(string.Format("Case ({0}) not added to GeneratedReferenceNumbers table.", caseInfo.mTicketNo)))));
                }

                var paymentProvider    = ProviderFactory.Get();
                var transactionIDModel =
                    paymentProvider.RegisterTransaction(
                        new ThirdParty.Payment.Models.TransactionModel
                {
                    CompanyRef         = referenceNumber.ReferenceNumber,
                    CompanyAccRef      = string.Empty,
                    Amount             = register.OutstandingAmount.HasValue ? register.OutstandingAmount.Value : 0,
                    UserID             = SessionModel.UserName,
                    ServiceDescription = "Reserved Payment Token",
                    ServiceType        = 6067
                });


                referenceNumber.ExternalToken     = transactionIDModel.TransactionToken;
                referenceNumber.ExternalReference = transactionIDModel.TransactionReference;

                dbContext.SaveChanges();

                return(Ok(
                           new FirstCaseModel
                {
                    Case = new CaseModel
                    {
                        TicketNo = caseInfo.mTicketNo,
                        Notification = caseInfo.mNotification,
                        VehicleRegNo = caseInfo.mVehicleRegNo,
                        VehicleRegNoConfirmed = caseInfo.mVehicleRegNoConfirmed,
                        VehicleMake = caseInfo.mVehicleMake,
                        VehicleModel = caseInfo.mVehicleModel,
                        VehicleColour = caseInfo.mVehicleColour,
                        VehicleType = caseInfo.mVehicleType,
                        VehicleLicenseExpire = caseInfo.mVehicleLicenseExpire,
                        OffenceSet = caseInfo.mOffenceSet,
                        OffenceDate = caseInfo.mOffenceDate,
                        OffenceSpeed = caseInfo.mOffenceSpeed,
                        OffenceZone = caseInfo.mOffenceZone,
                        OffenceDirectionLane = caseInfo.mOffenceDirectionLane,
                        OffenceCode = caseInfo.mOffenceCode,
                        OffenceNotes = caseInfo.mOffenceNotes,
                        OffenceAdditionalsXml = caseInfo.mOffenceAdditionalsXml,
                        Image1 = caseInfo.mImage1,
                        Image2 = caseInfo.mImage2,
                        ImageNP = caseInfo.mImageNP,
                        RemoteImage1 = remoteCaseInfo.mImage1,
                        RemoteImage2 = remoteCaseInfo.mImage2,
                        RemoteImageNP = remoteCaseInfo.mImageNP
                    },
                    TicketCount = ticketCount
                }));
            }
        }