public EditStatus DetermineNewEditStatus(EditStatus currentEditStatus, CallerType caller, bool areAnyApprenticeshipsPendingAgreement, int apprenticeshipsInCommitment, LastAction lastAction)
        {
            if (lastAction == LastAction.None)
            {
                return(currentEditStatus);
            }

            if (areAnyApprenticeshipsPendingAgreement || apprenticeshipsInCommitment == 0)
            {
                return(caller == CallerType.Provider ? EditStatus.EmployerOnly : EditStatus.ProviderOnly);
            }

            return(EditStatus.Both);
        }
Exemplo n.º 2
0
        private bool CallerApproved(AgreementStatus currentAgreementStatus, CallerType caller)
        {
            switch (caller)
            {
            case CallerType.Employer:
                return(currentAgreementStatus == AgreementStatus.EmployerAgreed);

            case CallerType.Provider:
                return(currentAgreementStatus == AgreementStatus.ProviderAgreed);

            default:
                throw new ArgumentOutOfRangeException(nameof(caller), caller, null);
            }
        }
Exemplo n.º 3
0
        private static bool ApprenticeshipCanBeApproved(CallerType callerType, Apprenticeship apprenticeship)
        {
            switch (callerType)
            {
            case CallerType.Employer:
                return(apprenticeship.EmployerCanApproveApprenticeship);

            case CallerType.Provider:
                return(apprenticeship.ProviderCanApproveApprenticeship);

            case CallerType.TransferSender:
                return(true);    // This needs to reference a new field later
            }
            return(false);
        }
Exemplo n.º 4
0
        private static bool CommitmentCanBeApproved(CallerType callerType, Commitment commitment)
        {
            switch (callerType)
            {
            case CallerType.Employer:
                return(commitment.EmployerCanApproveCommitment);

            case CallerType.Provider:
                return(commitment.ProviderCanApproveCommitment);

            case CallerType.TransferSender:
                return(commitment.TransferApprovalStatus == TransferApprovalStatus.Pending);
            }
            return(false);
        }
Exemplo n.º 5
0
 public static string CallerTypeToString(CallerType callerType)
 {
     switch (callerType)
     {
         case CallerType.Any:
             return "A";
         case CallerType.Employee:
             return "E";
         case CallerType.Client:
             return "C";
         case CallerType.Operator:
             return "O";
         default:
             throw new ArgumentOutOfRangeException("callerType");
     }
 }
        public void AndTheCallerIsntProvidedThenNotValid(CallerType callerType)
        {
            var result = _validator.Validate(new GetCommitmentAgreementsRequest
            {
                Caller = new Caller
                {
                    CallerType = callerType,
                    Id         = 1
                }
            });

            result.IsValid.Should().BeFalse();
            result.Errors.Count.Should().Be(1);
            result.Errors.First().PropertyName.Should().Be("CallerType");
            result.Errors.First().ErrorMessage.Should().Be("CallerType must be Provider.");
        }
        public void AndTheCallerIsntProvidedAndIdIsZeroThenThenNotValid(CallerType callerType)
        {
            var result = _validator.Validate(new GetCommitmentAgreementsRequest
            {
                Caller = new Caller
                {
                    CallerType = callerType,
                    Id         = 0
                }
            });

            // stops validating after first failure & CallerType takes priority
            result.IsValid.Should().BeFalse();
            result.Errors.Count.Should().Be(1);
            result.Errors.First().PropertyName.Should().Be("CallerType");
            result.Errors.First().ErrorMessage.Should().Be("CallerType must be Provider.");
        }
 public Apprenticeship MapFromV2(Domain.Entities.Apprenticeship source, CallerType callerType)
 {
     return(new Apprenticeship
     {
         Id = source.Id,
         CommitmentId = source.CommitmentId,
         EmployerAccountId = source.EmployerAccountId,
         ProviderId = source.ProviderId,
         TransferSenderId = source.TransferSenderId,
         Reference = source.Reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         ULN = source.ULN,
         TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType,
         TrainingCode = source.TrainingCode,
         TrainingName = source.TrainingName,
         Cost = source.Cost,
         StartDate = source.StartDate,
         EndDate = source.EndDate,
         PauseDate = source.PauseDate,
         StopDate = source.StopDate,
         PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus,
         AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus,
         DateOfBirth = source.DateOfBirth,
         NINumber = source.NINumber,
         EmployerRef = source.EmployerRef,
         ProviderRef = source.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer
                 ? source.EmployerCanApproveApprenticeship
                 : source.ProviderCanApproveApprenticeship,
         PendingUpdateOriginator = (Api.Types.Apprenticeship.Types.Originator?)source.UpdateOriginator,
         ProviderName = source.ProviderName,
         LegalEntityId = source.LegalEntityId,
         LegalEntityName = source.LegalEntityName,
         AccountLegalEntityPublicHashedId = source.AccountLegalEntityPublicHashedId,
         DataLockCourse = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Unknown),
         DataLockPrice = source.DataLocks.Any(x => x.IsPriceOnly() && x.TriageStatus == TriageStatus.Unknown),
         DataLockCourseTriaged = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Restart),
         DataLockCourseChangeTriaged = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Change),
         DataLockPriceTriaged = source.DataLocks.Any(x => x.IsPriceOnly() && x.TriageStatus == TriageStatus.Change),
         HasHadDataLockSuccess = source.HasHadDataLockSuccess,
         EndpointAssessorName = source.EndpointAssessorName,
         ReservationId = source.ReservationId
     });
 }
        public void TheOriginatorAndTheCallerMustBeEquivalent(CallerType callerType, Originator originator, bool isValid)
        {
            //Arrange
            var command = new CreateApprenticeshipUpdateCommand
            {
                Caller = new Caller(1, callerType),
                ApprenticeshipUpdate = new ApprenticeshipUpdate()
                {
                    ApprenticeshipId = 1,
                    Originator       = originator,
                    FirstName        = "Test"
                }
            };

            //Act
            var result = _validator.Validate(command);

            //Assert
            Assert.AreEqual(isValid, result.IsValid);
        }
Exemplo n.º 10
0
 internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp)
 {
     this._trustNotGrantedEvent            = new ManualResetEvent(false);
     this._trustGrantedEvent               = new ManualResetEvent(false);
     this._platformRequirementsFailedEvent = new ManualResetEvent(false);
     this._isConfirmed           = true;
     this._state                 = DeploymentProgressState.DownloadingApplicationFiles;
     this._deploySource          = deploymentSource;
     this._isupdate              = isUpdate;
     this._isConfirmed           = isConfirmed;
     this._downloadOptions       = downloadOptions;
     this._events                = new EventHandlerList();
     this._syncGroupMap          = CollectionsUtil.CreateCaseInsensitiveHashtable();
     this._subStore              = SubscriptionStore.CurrentUser;
     this.bindWorker             = new ThreadStart(this.BindAsyncWorker);
     this.synchronizeWorker      = new ThreadStart(this.SynchronizeAsyncWorker);
     this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker);
     this.bindCompleted          = new SendOrPostCallback(this.BindAsyncCompleted);
     this.synchronizeCompleted   = new SendOrPostCallback(this.SynchronizeAsyncCompleted);
     this.progressReporter       = new SendOrPostCallback(this.ProgressReporter);
     if (optionalAsyncOp == null)
     {
         this.asyncOperation = AsyncOperationManager.CreateOperation(null);
     }
     else
     {
         this.asyncOperation = optionalAsyncOp;
     }
     this._log = Logger.StartLogging();
     if (deploymentSource != null)
     {
         Logger.SetSubscriptionUrl(this._log, deploymentSource);
     }
     this._assertApplicationReqEvents = new ManualResetEvent[] { this._trustNotGrantedEvent, this._platformRequirementsFailedEvent, this._trustGrantedEvent };
     this._callerType = CallerType.Other;
     PolicyKeys.SkipApplicationDependencyHashCheck();
     PolicyKeys.SkipDeploymentProvider();
     PolicyKeys.SkipSchemaValidation();
     PolicyKeys.SkipSemanticValidation();
     PolicyKeys.SkipSignatureValidation();
 }
Exemplo n.º 11
0
 public Apprenticeship MapFrom(Domain.Entities.Apprenticeship source, CallerType callerType)
 {
     return(new Apprenticeship
     {
         Id = source.Id,
         CommitmentId = source.CommitmentId,
         EmployerAccountId = source.EmployerAccountId,
         ProviderId = source.ProviderId,
         Reference = source.Reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         ULN = source.ULN,
         TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType,
         TrainingCode = source.TrainingCode,
         TrainingName = source.TrainingName,
         Cost = source.Cost,
         StartDate = source.StartDate,
         EndDate = source.EndDate,
         PauseDate = source.PauseDate,
         PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus,
         AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus,
         DateOfBirth = source.DateOfBirth,
         NINumber = source.NINumber,
         EmployerRef = source.EmployerRef,
         ProviderRef = source.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer
                 ? source.EmployerCanApproveApprenticeship
                 : source.ProviderCanApproveApprenticeship,
         PendingUpdateOriginator = (Api.Types.Apprenticeship.Types.Originator?)source.UpdateOriginator,
         ProviderName = source.ProviderName,
         LegalEntityId = source.LegalEntityId,
         LegalEntityName = source.LegalEntityName,
         DataLockCourse = source.DataLockCourse,
         DataLockPrice = source.DataLockPrice,
         DataLockCourseTriaged = source.DataLockCourseTriaged,
         DataLockCourseChangeTriaged = source.DataLockCourseChangeTriaged,
         DataLockPriceTriaged = source.DataLockPriceTriaged,
         HasHadDataLockSuccess = source.HasHadDataLockSuccess
     });
 }
Exemplo n.º 12
0
        public void ThenTransferSenderFieldsAreMappedCorrectly(CallerType callerType, bool canEmployerApprove, bool canProviderApprove, TransferApprovalStatus transferStatus)
        {
            var commitment = new Commitment
            {
                TransferSenderId                       = 1,
                TransferSenderName                     = "Transfer Sender Org",
                TransferApprovalStatus                 = transferStatus,
                TransferApprovalActionedOn             = new DateTime(2018, 09, 09),
                TransferApprovalActionedByEmployerName = "Name",
                ProviderCanApproveCommitment           = canProviderApprove,
                EmployerCanApproveCommitment           = canEmployerApprove,
            };

            var result = _mapper.MapFrom(commitment, callerType);

            Assert.AreEqual(1, result.TransferSender.Id);
            Assert.AreEqual("Transfer Sender Org", result.TransferSender.Name);
            Assert.AreEqual(transferStatus, (TransferApprovalStatus)result.TransferSender.TransferApprovalStatus);
            Assert.AreEqual(new DateTime(2018, 09, 09), result.TransferSender.TransferApprovalSetOn);
            Assert.AreEqual("Name", result.TransferSender.TransferApprovalSetBy);
            Assert.AreEqual(true, result.CanBeApproved);
        }
 public static bool IsProvider(this CallerType type)
 {
     return(type == CallerType.Provider);
 }
Exemplo n.º 14
0
 private void StartTrackingHistory(Commitment commitment, CallerType callerType, string userId, string userName)
 {
     _historyService = new HistoryService(_historyRepository);
     _historyService.TrackUpdate(commitment, CommitmentChangeType.DeletedApprenticeship.ToString(), commitment.Id, null, callerType, userId, commitment.ProviderId, commitment.EmployerAccountId, userName);
 }
 public static bool IsEmployer(this CallerType type)
 {
     return(type == CallerType.Employer);
 }
Exemplo n.º 16
0
 public Caller(long id, CallerType type)
 {
     Id         = id;
     CallerType = type;
 }
Exemplo n.º 17
0
        private async Task CreateHistory(Commitment commitment, Domain.Entities.Apprenticeship apprenticeship, CallerType callerType, string userId, string userName)
        {
            var historyService = new HistoryService(_historyRepository);

            historyService.TrackUpdate(commitment, CommitmentChangeType.CreatedApprenticeship.ToString(), commitment.Id, null, callerType, userId, apprenticeship.ProviderId, apprenticeship.EmployerAccountId, userName);
            historyService.TrackInsert(apprenticeship, ApprenticeshipChangeType.Created.ToString(), null, apprenticeship.Id, callerType, userId, apprenticeship.ProviderId, apprenticeship.EmployerAccountId, userName);
            await historyService.Save();
        }
Exemplo n.º 18
0
 public IEnumerable <CommitmentListItem> MapFrom(IEnumerable <CommitmentSummary> source, CallerType callerType)
 {
     return(source.Select(x => MapFrom(x, callerType)));
 }
Exemplo n.º 19
0
        public void ThenIfNoActionWasTakenThenTheAgreementStatusIsNotChanged(AgreementStatus currentAgreementStatus, CallerType callerType)
        {
            //Act
            var result = _rules.DetermineNewAgreementStatus(currentAgreementStatus, callerType, LastAction.None);

            //Assert
            Assert.AreEqual(currentAgreementStatus, result);
        }
        public void ThenWhenEditStatusIsIncorrectAnInvalidRequestExceptionIsThrown(EditStatus editStatus, CallerType callerType)
        {
            var c = new Commitment {
                EditStatus = editStatus, ProviderId = 5L, EmployerAccountId = 5L, CommitmentStatus = CommitmentStatus.Active
            };

            _exampleValidRequest.Caller = new Caller {
                Id = 5L, CallerType = callerType
            };
            _mockCommitmentRespository.Setup(m => m.GetCommitmentById(It.IsAny <long>())).Returns(Task.Run(() => c));
            Func <Task> act = async() => await _handler.Handle(_exampleValidRequest);

            act.ShouldThrow <UnauthorizedException>();
        }
 public IEnumerable <Apprenticeship> MapFromV2(IEnumerable <Domain.Entities.Apprenticeship> source, CallerType callerType)
 {
     return(source.Select(sourceItem => MapFromV2(sourceItem, callerType)));
 }
Exemplo n.º 22
0
        public bool perform_landline_detection(string std_code, out bool flag_found_landline)
        {
            try
            {
                string strQuery = "use dst;select dst_std_id,dst_circle_id, dst_std_service_area_name, dst_std_service_area, dst_std_lcda_name, dst_std_sdca_name, dst_std_sdca_code, dst_std_isactive " +
                                  "from dst.dst_std_code dsc where dst_std_sdca_code = " + std_code + ";";
                DataTable dt = DL.DL_ExecuteSimpleQuery(strQuery).Tables[0];

                if (dt != null && dt.Rows.Count > 0)
                {
                    long dST_std_id    = Convert.ToInt64(dt.Rows[0]["dst_std_id"]);
                    long dST_circle_id = Convert.ToInt64(dt.Rows[0]["dst_circle_id"]);

                    string dST_std_service_area_name = Convert.ToString(dt.Rows[0]["dst_std_service_area_name"]);
                    string dST_std_service_area      = Convert.ToString(dt.Rows[0]["dst_std_service_area"]);
                    string dts_std_lcda_name         = Convert.ToString(dt.Rows[0]["dst_std_lcda_name"]);
                    string dts_std_sdca_name         = Convert.ToString(dt.Rows[0]["dst_std_sdca_name"]);
                    int    dST_std_sdca_code         = Convert.ToInt32(dt.Rows[0]["dst_std_sdca_code"]);
                    string dst_landline_number       = "";
                    string dst_operator_name         = "UNKNOWN";

                    if (std_code.Length == 2)
                    {
                        dst_landline_number = this._dst_number.Substring(2, this._dst_number.Length - 2);
                        dst_operator_name   = get_landline_operator_name(dst_landline_number, dST_std_sdca_code);
                    }
                    else if (std_code.Length == 3)
                    {
                        dst_landline_number = this._dst_number.Substring(3, this._dst_number.Length - 3);
                        dst_operator_name   = get_landline_operator_name(dst_landline_number, dST_std_sdca_code);
                    }
                    else if (std_code.Length == 4)
                    {
                        dst_landline_number = this._dst_number.Substring(4, this._dst_number.Length - 4);
                        dst_operator_name   = get_landline_operator_name(dst_landline_number, dST_std_sdca_code);
                    }

                    this._mSC_Mobile_Info   = null;
                    this._mSC_LandLine_Info = new MSC_LandLine(dST_std_id, dST_circle_id, dST_std_service_area, dST_std_service_area_name, dts_std_lcda_name, dts_std_sdca_name, dst_operator_name, dST_std_sdca_code);
                    this._caller_origin     = CallerOrigin.DOMESTIC;
                    this._caller_type       = CallerType.LANDLINE;

                    flag_found_landline = true;
                    return(true);
                }
                else if (dt != null && dt.Rows.Count == 0)
                {
                    flag_found_landline = false;
                    return(false);
                }
                else
                {
                    flag_found_landline = false;
                    throw new MSCException("error:database returning null dataset");
                }
            }
            catch (Exception exc)
            {
                ____logconfig.Log_Write(____logconfig.LogLevel.EXC, 0, "::MSC.cs::MSC::get_msc_code_information():: --" + exc.ToString());
                flag_found_landline = false;
                return(false);
            }
        }
Exemplo n.º 23
0
        public void getMSC_Information(string destination)
        {
            try
            {
                long   destination_long;
                string destination_str;
                int    destination_length;
                this._dst_number = destination;
                if (long.TryParse(destination, out destination_long))
                {
                    destination_str    = destination_long.ToString();
                    destination_length = destination_str.Length;

                    if (destination.Length == 14 && destination.StartsWith("00") && destination.Substring(2, 2) != "91")
                    {
                        this._mSC_LandLine_Info = null;
                        this._mSC_Mobile_Info   = new MSC_Mobile(0, "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", 0, "UNKNOWN", 0, "UNKNOWN");
                        this._caller_origin     = CallerOrigin.INTERNATIONAL;
                        this._caller_type       = CallerType.MOBILE;
                    }
                    else if (destination.Length == 13 && destination.StartsWith("0") && destination.Substring(1, 2) != "91")
                    {
                        this._mSC_LandLine_Info = null;
                        this._mSC_Mobile_Info   = new MSC_Mobile(0, "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", 0, "UNKNOWN", 0, "UNKNOWN");
                        this._caller_origin     = CallerOrigin.INTERNATIONAL;
                        this._caller_type       = CallerType.MOBILE;
                    }
                    else if (destination.Length == 12 && destination.StartsWith("00"))
                    {
                        this._mSC_LandLine_Info = null;
                        this._mSC_Mobile_Info   = new MSC_Mobile(0, "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", 0, "UNKNOWN", 0, "UNKNOWN");
                        this._caller_origin     = CallerOrigin.INTERNATIONAL;
                        this._caller_type       = CallerType.MOBILE;
                    }
                    else if (destination_length <= 12)
                    {
                        if (destination_length == 10)
                        {
                            string msc_code = destination_str.Substring(0, 5);
                            get_msc_code_information(msc_code);
                        }
                        else if (destination_length == 12 && destination_str.StartsWith("91"))
                        {
                            string msc_code = destination_str.Substring(2, 5);
                            get_msc_code_information(msc_code);
                        }
                        else //for if (destination_length == 12 && destination_str.StartsWith("91"))
                        {
                            this._mSC_LandLine_Info = null;
                            this._mSC_Mobile_Info   = new MSC_Mobile(0, "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", 0, "UNKNOWN", 0, "UNKNOWN");
                            this._caller_origin     = CallerOrigin.INTERNATIONAL;
                            this._caller_type       = CallerType.MOBILE;
                        }
                    }
                    else
                    {
                        this._mSC_LandLine_Info = null;
                        this._mSC_Mobile_Info   = new MSC_Mobile(0, "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", 0, "UNKNOWN", 0, "UNKNOWN");
                        this._caller_origin     = CallerOrigin.INTERNATIONAL;
                        this._caller_type       = CallerType.MOBILE;
                    }
                }
                else
                {
                    throw new MSCException("error:number contains illeagal characters");
                }
            }
            catch (Exception exc)
            {
                ____logconfig.Log_Write(____logconfig.LogLevel.EXC, 0, "::MSC.cs::MSC::getMSC_Information():: --" + exc.ToString());
            }
        }
Exemplo n.º 24
0
 public void ThenSetToToNotAgreedIfOtherPartyIsApprovedAndAmending(AgreementStatus currentAgreementStatus, CallerType caller, LastAction action)
 {
     Assert.AreEqual(AgreementStatus.NotAgreed, _rules.DetermineNewAgreementStatus(currentAgreementStatus, caller, action));
 }
Exemplo n.º 25
0
 public void TrackUpdate(object trackedObject, string changeType, long?commitmentId, long?apprenticeshipId, CallerType updatedByRole, string userId, long?providerId, long employerAccountId, string updatedByName)
 {
     AddHistoryItem(HistoryChangeType.Update, trackedObject, changeType, commitmentId, apprenticeshipId, updatedByRole, userId, providerId, employerAccountId, updatedByName);
 }
Exemplo n.º 26
0
 public void ThenLeaveAsCurrentStatusIfIsApprovedByPartyAndAmending(AgreementStatus currentAgreementStatus, CallerType caller, LastAction action)
 {
     Assert.AreEqual(currentAgreementStatus, _rules.DetermineNewAgreementStatus(currentAgreementStatus, caller, action));
 }
Exemplo n.º 27
0
        public void ThenMappingToCanApproveFromCallTypeSetsModeCorrectlyforEachApprenticeship(CallerType callerType, bool employerCanApprove, bool providerCanApprove)
        {
            var from = new Commitment();

            from.Apprenticeships.Add(new Domain.Entities.Apprenticeship
            {
                EmployerCanApproveApprenticeship = employerCanApprove,
                ProviderCanApproveApprenticeship = providerCanApprove
            });

            var result = _mapper.MapFrom(from, callerType);

            result.Apprenticeships[0].CanBeApproved.Should().BeTrue();
        }
 internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp)
 {
     this._trustNotGrantedEvent = new ManualResetEvent(false);
     this._trustGrantedEvent = new ManualResetEvent(false);
     this._platformRequirementsFailedEvent = new ManualResetEvent(false);
     this._isConfirmed = true;
     this._state = DeploymentProgressState.DownloadingApplicationFiles;
     this._deploySource = deploymentSource;
     this._isupdate = isUpdate;
     this._isConfirmed = isConfirmed;
     this._downloadOptions = downloadOptions;
     this._events = new EventHandlerList();
     this._syncGroupMap = CollectionsUtil.CreateCaseInsensitiveHashtable();
     this._subStore = SubscriptionStore.CurrentUser;
     this.bindWorker = new ThreadStart(this.BindAsyncWorker);
     this.synchronizeWorker = new ThreadStart(this.SynchronizeAsyncWorker);
     this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker);
     this.bindCompleted = new SendOrPostCallback(this.BindAsyncCompleted);
     this.synchronizeCompleted = new SendOrPostCallback(this.SynchronizeAsyncCompleted);
     this.progressReporter = new SendOrPostCallback(this.ProgressReporter);
     if (optionalAsyncOp == null)
     {
         this.asyncOperation = AsyncOperationManager.CreateOperation(null);
     }
     else
     {
         this.asyncOperation = optionalAsyncOp;
     }
     this._log = Logger.StartLogging();
     if (deploymentSource != null)
     {
         Logger.SetSubscriptionUrl(this._log, deploymentSource);
     }
     this._assertApplicationReqEvents = new ManualResetEvent[] { this._trustNotGrantedEvent, this._platformRequirementsFailedEvent, this._trustGrantedEvent };
     this._callerType = CallerType.Other;
     PolicyKeys.SkipApplicationDependencyHashCheck();
     PolicyKeys.SkipDeploymentProvider();
     PolicyKeys.SkipSchemaValidation();
     PolicyKeys.SkipSemanticValidation();
     PolicyKeys.SkipSignatureValidation();
 }
Exemplo n.º 29
0
 //todo: could we reuse the apprenticeship mapper?
 private static List <Types.Apprenticeship.Apprenticeship> MapApprenticeshipsFrom(List <Apprenticeship> apprenticeships, CallerType callerType)
 {
     return(apprenticeships.Select(x => new Types.Apprenticeship.Apprenticeship
     {
         Id = x.Id,
         ULN = x.ULN,
         CommitmentId = x.CommitmentId,
         EmployerAccountId = x.EmployerAccountId,
         ProviderId = x.ProviderId,
         Reference = x.Reference,
         FirstName = x.FirstName,
         LastName = x.LastName,
         TrainingType = (Types.Apprenticeship.Types.TrainingType)x.TrainingType,
         TrainingCode = x.TrainingCode,
         TrainingName = x.TrainingName,
         Cost = x.Cost,
         StartDate = x.StartDate,
         EndDate = x.EndDate,
         AgreementStatus = (Types.AgreementStatus)x.AgreementStatus,
         PaymentStatus = (Types.Apprenticeship.Types.PaymentStatus)x.PaymentStatus,
         DateOfBirth = x.DateOfBirth,
         NINumber = x.NINumber,
         EmployerRef = x.EmployerRef,
         ProviderRef = x.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer ? x.EmployerCanApproveApprenticeship : x.ProviderCanApproveApprenticeship
     }).ToList());
 }
Exemplo n.º 30
0
        public override string GenerateCode()
        {
            try
            {   //if (SymbolTable.Classes[((IdentifierNode)Childs[0]).Name]!=null)
                //    CallerType = SymbolTable.Classes[((IdentifierNode)Childs[0]).Name];
                CallerType = SymbolTable.Symbols.Peek()[((IdentifierNode)Childs[0]).Name];
            }
            catch (Exception)
            {
                Type       = Childs[0].Type;
                CallerType = SymbolTable.Classes[Type];
            }
            var s      = "# Atsim cal\t\t\t" + CallerType.Name + "." + MethodID.GetText() + "\n";
            int offset = 0;



            foreach (var item in Childs)
            {
                s += item.GenerateCode();
                var reg1 = MIPS.LastReg();                                    //
                s      += MIPS.Emit(MIPS.Opcodes.sw, reg1, offset + "($sp)"); //push all your sons
                offset += 4;
                //s += MIPS.Emit(MIPS.Opcodes.push, reg1);//push all your sons
            }
            /*Parche*/

            try{
                var t = MIPS.LastReg();
                s     += MIPS.Emit(MIPS.Opcodes.lw, t, ((IdentifierNode)Childs[0]).Name);//load the caller
                offset = 8;
                var n = MIPS.GetReg();
                foreach (var item in CallerType.Attributes)// iterate the attributes
                {
                    s      += MIPS.Emit(MIPS.Opcodes.lw, n, offset + "(" + t + ")");
                    s      += MIPS.Emit(MIPS.Opcodes.sw, n, item.Key + "_" + item.ToString());
                    offset += 4;
                }
            }catch (Exception) {}
            /* end of Parche*/

            //s += MIPS.Emit(MIPS.Opcodes.sw, MIPS.LastReg().ToReg(), );


            var m = CallerType.GetMethod(MethodID.GetText());

            var callerTypeName = m.ClassName;

            if (callerTypeName != CallerType.Name)
            {
                //cast
                s += MIPS.Emit(MIPS.Opcodes.lw, MIPS.LastReg(), "($sp)");
                s += MIPS.Emit(MIPS.Opcodes.move, "$s2", MIPS.LastReg());
                var j = MIPS.LastReg();

                var y = MIPS.GetReg();

                s += MIPS.Emit(MIPS.Opcodes.lw, y, SymbolTable.Classes[CallerType.Name].Size - 4 + "(" + j + ")");

                s += MIPS.Emit(MIPS.Opcodes.sw, y, "($sp)");



                //s += MIPS.Emit(MIPS.Opcodes.sw, MIPS.LastReg(), "0($sp)");
            }
            //s += MIPS.Emit(MIPS.Opcodes.move, "$s0", "$ra");
            if (callerTypeName != "")
            {
                s += MIPS.Emit(MIPS.Opcodes.jal, callerTypeName + "." + MethodID);// this blows $ra
            }
            else
            {
                s += MIPS.Emit(MIPS.Opcodes.jal, " " + MethodID);// this blows $ra
            }
            //s += MIPS.Emit(MIPS.Opcodes.move, "$ra", "$s0");

            var reg2 = MIPS.GetReg();

            s += MIPS.Emit(MIPS.Opcodes.move, reg2, "$v0\t\t#Method return value");

            if (callerTypeName != CallerType.Name)
            {
                s += MIPS.Emit(MIPS.Opcodes.sw, "$s2", "($sp)");
            }
            //s += MIPS.Emit(MIPS.Opcodes.subu, "$sp","$sp", "4");

            //SymbolTable.Symbols.Pop();

            return(s);// base.GenerateCode();
        }
Exemplo n.º 31
0
 private void AddHistoryItem(HistoryChangeType historyChangeType, object trackedObject, string changeType, long?commitmentId, long?apprenticeshipId, CallerType updatedByRole, string userId, long?providerId, long employerAccountId, string updatedByName)
 {
     _historyItems.Add(new HistoryItem(historyChangeType, trackedObject, commitmentId, apprenticeshipId, userId, updatedByRole.ToString(), changeType, providerId, employerAccountId, updatedByName));
 }
Exemplo n.º 32
0
 public void ThenSetToNotAgreedIfBothPartiesNotAgreedAndAmending(CallerType caller)
 {
     Assert.AreEqual(AgreementStatus.NotAgreed, _rules.DetermineNewAgreementStatus(AgreementStatus.NotAgreed, caller, LastAction.Amend));
 }