private void Decide(object item)
 {
     ProviderOrganisation providerForDecision = item as ProviderOrganisation;
     //Store value in session and navigate.
     App.Session.Add(SessionKey.UploadProviderKey, providerForDecision.KeyValue);
     NavigationService.Navigate("/ParticipantMI/UploadDecision");
 }
Example #2
0
        /// <summary>
        /// Locks or unlocks the file
        /// </summary>
        /// <param name="isLock"></param>
        private void FileLock(bool isLock)
        {
            providerRepository = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <ProviderOrganisation> >();
            ProviderOrganisation providerEntry = providerRepository.First(x => x.KeyValue == ProviderKey && x.FileType == _fileType);

            providerEntry.Status = (isLock ? "Locked" : "Unlocked");
            providerRepository.Update(providerEntry);
            providerRepository.SaveChanges();
        }
 private void ViewHistory(object item)
 {
     ProviderOrganisation providerForView = item as ProviderOrganisation;
     if (providerForView != null)
     {
         App.Session[SessionKey.UploadFileType] = providerForView.FileType;
         App.Session[SessionKey.UploadProviderKey] = providerForView.KeyValue;
         NavigationService.Navigate("/ParticipantMI/UploadHistory");
     }
 }
 private void UploadFile(object item)
 {
     ProviderOrganisation providerForUpload = item as ProviderOrganisation;
     if (providerForUpload != null)
     {
         App.Session[SessionKey.UploadFileType] = providerForUpload.FileType;
         App.Session[SessionKey.UploadProviderKey] = providerForUpload.KeyValue;
         NavigationService.Navigate("/ParticipantMI/UploadFile");
     }
 }
        private bool CanUnlock(object item)
        {
            ProviderOrganisation providerForUnlock = item as ProviderOrganisation;
            if (providerForUnlock != null)
            {
                return providerForUnlock.Status == "Locked";
            }

            else
            {
                return false;
            }
        }
        private bool CanDecide(object item)
        {
            ProviderOrganisation providerForDecision = item as ProviderOrganisation;
            if (providerForDecision != null)
            {
                return providerForDecision.Status == "Locked";
            }

            else
            {
                return false;
            }
        }
        public FileUploadJob(Guid code, string fileName, string providerKey, string userID, string webPath, DateTime?added, DateTime?started, DateTime?ended, string description)
        {
            Code           = code;
            ProviderKey    = providerKey;
            UniqueFileName = fileName;
            AddedTime      = added;
            StartTime      = started;
            EndTime        = ended;
            Description    = description;
            //GET Schema file paths from configuration
            _schema        = webPath + ConfigurationManager.AppSettings["ParticipantSchema"];
            _mappingSchema = webPath + ConfigurationManager.AppSettings["ParticipantMappingSchema"];

            //Get Connection string from configuration
            _connectionString = ConfigurationManager.ConnectionStrings["MIStagingConnectionString"].ConnectionString;

            //set private variables
            IUcbManagementInformationRepository <ProviderOrganisation> providerOrganisationRepository = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <ProviderOrganisation> >();
            ProviderOrganisation providerOrganisationItem =
                providerOrganisationRepository.First(x => x.KeyValue == ProviderKey);

            _providingOrganistaionCode = providerOrganisationItem.Code;
            _fileType = "Participant";
            FileInfo DataFileInfoItem = new FileInfo(UniqueFileName);

            _fileLength = DataFileInfoItem.Length;

            _userID  = userID;
            UserId   = userID;
            JobSteps = new List <JobStep>()
            {
                new JobStep("SchemaValidation", "Schema Validation", this, 1),
                new JobStep("DeleteFromLoadingArea", "DeleteFromLoadingArea", this, 2),
                new JobStep("BulkUpload", "Bulk Load", this, 3),
                new JobStep("CopyBulkLoadedData", "CopyBulkLoadedData", this, 4),
                new JobStep("ValidateParticipantDuplicates", "Validate Participant", this, 5),
                new JobStep("ValidateAgreementRegion", "Validate Participant", this, 6),
                new JobStep("ValidateParticipantPostCode", "Validate Participant", this, 7),
                new JobStep("ValidateLeaver", "Validate Participant", this, 8),
                new JobStep("ValidateLeavingDate", "Validate Participant", this, 9),
                new JobStep("ValidateStartDate", "Validate Participant", this, 10),
                new JobStep("LoadParticipantMessages", "Validate Participant", this, 11),
                new JobStep("ValidatePreviousLoad", "Validate Participant", this, 12),
                new JobStep("UpdateParticipantCounts", "Validate Participant", this, 13)
            };
        }
        public CopyToValidJob(Guid code, string providerKey, Guid inputFileHistoryCode, int decisionLevel, string userID, string webPath, DateTime?added, DateTime?started, DateTime?ended, string description)
        {
            Code                  = code;
            ProviderKey           = providerKey;
            AddedTime             = added;
            StartTime             = started;
            EndTime               = ended;
            Description           = description;
            _inputFileHistoryCode = inputFileHistoryCode;
            _decisionLevel        = decisionLevel;
            //Get Connection string from configuration
            _connectionString = ConfigurationManager.ConnectionStrings["MIStagingConnectionString"].ConnectionString;

            uow = SimpleServiceLocator.Instance.Get <IUnitOfWork>("UcbManagementInformation");

            providerRepository         = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <ProviderOrganisation> >(uow.ObjectContext);
            inputFileHistoryRepository = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <InputFileHistory> >(uow.ObjectContext);
            inputFileErrorsRepository  = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <InputFileError> >(uow.ObjectContext);
            uploadMonitorRepository    = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <UploadMonitor> >(uow.ObjectContext);


            //set private variables
            ProviderOrganisation providerOrganisationItem =
                providerRepository.First(x => x.KeyValue == ProviderKey);

            _providingOrganistaionCode = providerOrganisationItem.Code;
            _fileType = "Participant";

            _userID = userID;
            UserId  = userID;


            JobSteps = new List <JobStep>()
            {
                new JobStep("DeleteValidatedParticipantData", "Copy Valid Participant", this, 1),
                new JobStep("CopyValidatedParticipants", "Copy Valid Participant", this, 2),
                new JobStep("DeleteParticipantData", "Copy Valid Participant", this, 3),
                //new JobStep("DeleteParticipantDataOver4HoursOld","Copy Valid Participant",this,4),
                new JobStep("DeleteInputFileErrorsOver1YearOld", "Copy Valid Participant", this, 4)
            };
        }
        /// <summary>
        /// Copys the uploaded data to a validated area
        /// </summary>
        /// <param name="uploadDecision">The type of data to copy: 'ValidOnly','ValidAndInfo' or 'ValidInfoAndWarning'</param>
        /// <returns></returns>
        public int ValidatedUpload(int maximumErrorLevel)
        {
            using (spRunner.Cn)
            {
                spRunner.Cn.Open();
                spRunner.IsOpen = true;
                using (SqlTransaction transact = spRunner.Cn.BeginTransaction())
                {
                    DeleteValidatedParticipantData(transact);
                    CopyValidatedParticipants(transact);
                    transact.Commit();
                }
                spRunner.Cn.Close();
                spRunner.IsOpen = false;
            }
            //Stamp number of records uploaded and remove lock of database
            using (uow = SimpleServiceLocator.Instance.Get <IUnitOfWork>("UcbManagementInformation"))
            {
                inputFileHistoryRepository = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <InputFileHistory> >(uow.ObjectContext);
                providerRepository         = DataAccessUtilities.RepositoryLocator <IUcbManagementInformationRepository <ProviderOrganisation> >(uow.ObjectContext);
                InputFileHistory ifh = inputFileHistoryRepository.Find(x => x.Code == _inputFileHistoryCode).First();
                ifh.Status         = "Validated Loaded " + maximumErrorLevel.ToString();
                ifh.UploadDecision = maximumErrorLevel;
                //_inputFileHistoryRow.ValidatedLoadDate = DateTime.Now;
                inputFileHistoryRepository.Update(ifh);

                ProviderOrganisation po = providerRepository.First(x => x.KeyValue == ProviderKey && x.FileType == "Participant");
                po.CurrentValidatedFileCode = _inputFileHistoryCode;
                providerRepository.Update(po);

                uow.Commit();
            }

            DeleteParticipantData();
            //DeleteParticipantDataOver4HoursOld();
            DeleteInputFileErrorsOver1YearOld();
            return(0);
        }
Example #10
0
 public void DeleteProviderOrganisation(ProviderOrganisation providerOrganisationItem)
 {
     providerOrganisationRepository.Delete(providerOrganisationItem);
 }
 public static ProviderOrganisation WithInputFileHistory(this ProviderOrganisation providerOrganisation, InputFileHistory inputFileHistory)
 {
     providerOrganisation.InputFileHistory = inputFileHistory;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithCurrentValidatedFileCode(this ProviderOrganisation providerOrganisation, Guid currentValidatedFileCode)
 {
     providerOrganisation.CurrentValidatedFileCode = currentValidatedFileCode;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithStatus(this ProviderOrganisation providerOrganisation, String status)
 {
     providerOrganisation.Status = status;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithName(this ProviderOrganisation providerOrganisation, String name)
 {
     providerOrganisation.Name = name;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithFileType(this ProviderOrganisation providerOrganisation, String fileType)
 {
     providerOrganisation.FileType = fileType;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithKeyValue(this ProviderOrganisation providerOrganisation, String keyValue)
 {
     providerOrganisation.KeyValue = keyValue;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithRegionID(this ProviderOrganisation providerOrganisation, String regionID)
 {
     providerOrganisation.RegionID = regionID;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithID(this ProviderOrganisation providerOrganisation, Int32 iD)
 {
     providerOrganisation.ID = iD;
     return(providerOrganisation);
 }
 public static ProviderOrganisation WithCode(this ProviderOrganisation providerOrganisation, Guid code)
 {
     providerOrganisation.Code = code;
     return(providerOrganisation);
 }
 private bool CanUploadFile(object item)
 {
     ProviderOrganisation providerForUpload = item as ProviderOrganisation;
     return providerForUpload != null && providerForUpload.Status !="Locked";
 }
Example #21
0
 public void UpdateProviderOrganisation(ProviderOrganisation providerOrganisationItem)
 {
     providerOrganisationRepository.Update(providerOrganisationItem);
 }
Example #22
0
 public void InsertProviderOrganisation(ProviderOrganisation providerOrganisationItem)
 {
     providerOrganisationRepository.Add(providerOrganisationItem);
 }
 private bool CanViewHistory(object item)
 {
     ProviderOrganisation providerForView = item as ProviderOrganisation;
     return providerForView != null;
 }