public bool CanScheduleSeriesDelete(out string reason) { if (IsLocked) { reason = SR.ActionNotAllowed_StudyIsLocked; return(false); } if (IsReconcileRequired) { reason = SR.ActionNotAllowed_NeedReconcile; return(false); } if (IsNearline) { reason = SR.ActionNotAllowed_StudyIsNearline; return(false); } if (StudyStatusEnum.Equals(StudyStatusEnum.OnlineLossy) && IsArchivedLossless) { reason = SR.ActionNotAllowed_StudyIsLossyOnline; return(false); } reason = String.Empty; return(true); }
public void Insert(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new StudyStatusEnum(); item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }
public bool CanScheduleEdit(out string reason) { if (IsLocked) { reason = SR.ActionNotAllowed_StudyIsLocked; return(false); } if (IsProcessing) { reason = SR.ActionNotAllowed_StudyIsBeingProcessing; return(false); } if (IsNearline) { reason = SR.ActionNotAllowed_StudyIsNearline; return(false); } if (HasPendingWorkQueueItems) { reason = SR.ActionNotAllowed_StudyHasPendingWorkQueue; return(false); } if (IsReconcileRequired) { reason = SR.ActionNotAllowed_NeedReconcile; return(false); } if (StudyStatusEnum.Equals(StudyStatusEnum.OnlineLossy) && IsArchivedLossless) { reason = SR.ActionNotAllowed_StudyIsLossyOnline; return(false); } reason = String.Empty; return(true); }
private StudySelectCriteria GetSelectCriteria() { var criteria = new StudySelectCriteria(); // only query for device in this partition criteria.ServerPartitionKey.EqualTo(Partition.Key); QueryHelper.SetGuiStringCondition(criteria.PatientId, PatientId); QueryHelper.SetGuiStringCondition(criteria.PatientsName, PatientName); criteria.PatientsName.SortAsc(0); QueryHelper.SetGuiStringCondition(criteria.AccessionNumber, AccessionNumber); if (!String.IsNullOrEmpty(ToStudyDate) && !String.IsNullOrEmpty(FromStudyDate)) { string toKey = DateTime.ParseExact(ToStudyDate, DateFormats, null).ToString(STUDYDATE_DATEFORMAT, CultureInfo.InvariantCulture) + " 23:59:59.997"; string fromKey = DateTime.ParseExact(FromStudyDate, DateFormats, null).ToString(STUDYDATE_DATEFORMAT, CultureInfo.InvariantCulture); criteria.StudyDate.Between(fromKey, toKey); } else if (!String.IsNullOrEmpty(ToStudyDate)) { string toKey = DateTime.ParseExact(ToStudyDate, DateFormats, null).ToString(STUDYDATE_DATEFORMAT, CultureInfo.InvariantCulture); criteria.StudyDate.LessThanOrEqualTo(toKey); } else if (!String.IsNullOrEmpty(FromStudyDate)) { string fromKey = DateTime.ParseExact(FromStudyDate, DateFormats, null).ToString(STUDYDATE_DATEFORMAT, CultureInfo.InvariantCulture); criteria.StudyDate.MoreThanOrEqualTo(fromKey); } QueryHelper.SetGuiStringCondition(criteria.StudyDescription, StudyDescription); QueryHelper.SetGuiStringCondition(criteria.ReferringPhysiciansName, ReferringPhysiciansName); QueryHelper.SetGuiStringCondition(criteria.ResponsiblePerson, ResponsiblePerson); QueryHelper.SetGuiStringCondition(criteria.ResponsibleOrganization, ResponsibleOrganization); if (Modalities != null && Modalities.Length > 0) { var seriesCriteria = new SeriesSelectCriteria(); QueryHelper.SetStringArrayCondition(seriesCriteria.Modality, Modalities); criteria.SeriesRelatedEntityCondition.Exists(seriesCriteria); } if (Statuses != null && Statuses.Length > 0) { var storageCriteria = new StudyStorageSelectCriteria(); if (Statuses.Length == 1) { storageCriteria.StudyStatusEnum.EqualTo(StudyStatusEnum.GetEnum(Statuses[0])); } else { var statusList = new List <StudyStatusEnum>(); foreach (string status in Statuses) { statusList.Add(StudyStatusEnum.GetEnum(status)); } storageCriteria.StudyStatusEnum.In(statusList); } criteria.StudyStorageRelatedEntityCondition.Exists(storageCriteria); } if (QCStatuses != null && QCStatuses.Length > 0) { criteria.QCStatusEnum.In(QCStatuses); } return(criteria); }
public UpdateStudyStateCommand(StudyStorageLocation location, StudyStatusEnum status, ServerTransferSyntax newSyntax) : base("Update the StudyState") { _location = location; _newStatus = status; _newSyntax = newSyntax; }
private void SetupChildControls() { foreach (StudyStatusEnum s in StudyStatusEnum.GetAll()) { StatusListBox.Items.Add(new ListItem { Text = ServerEnumDescription.GetLocalizedDescription(s), Value = s.Lookup }); } ClearToStudyDateButton.Attributes["onclick"] = ScriptHelper.ClearDate(ToStudyDate.ClientID, ToStudyDateCalendarExtender.ClientID); ClearFromStudyDateButton.Attributes["onclick"] = ScriptHelper.ClearDate(FromStudyDate.ClientID, FromStudyDateCalendarExtender.ClientID); ToStudyDate.Attributes["OnChange"] = ScriptHelper.CheckDateRange(FromStudyDate.ClientID, ToStudyDate.ClientID, ToStudyDate.ClientID, ToStudyDateCalendarExtender.ClientID, "To Date must be greater than From Date"); FromStudyDate.Attributes["OnChange"] = ScriptHelper.CheckDateRange(FromStudyDate.ClientID, ToStudyDate.ClientID, FromStudyDate.ClientID, FromStudyDateCalendarExtender.ClientID, "From Date must be less than To Date"); GridPagerTop.InitializeGridPager(SR.GridPagerStudySingleItem, SR.GridPagerStudyMultipleItems, StudyListGridView.TheGrid, () => StudyListGridView.ResultCount, ImageServerConstants.GridViewPagerPosition.Top); StudyListGridView.Pager = GridPagerTop; ConfirmStudySearchMessageBox.Confirmed += delegate { StudyListGridView.DataBindOnPreRender = true; StudyListGridView.Refresh(); if (SearchUpdatePanel.UpdateMode == UpdatePanelUpdateMode.Conditional) { SearchUpdatePanel.Update(); } }; ConfirmStudySearchMessageBox.Cancel += delegate { StudyListGridView.DataBindOnPreRender = false; }; RestoreMessageBox.Confirmed += delegate(object data) { if (data is IList <Study> ) { var studies = data as IList <Study>; foreach (Study study in studies) { _controller.RestoreStudy(study); } } else if (data is IList <StudySummary> ) { var studies = data as IList <StudySummary>; foreach (StudySummary study in studies) { _controller.RestoreStudy(study.TheStudy); } } else if (data is Study) { var study = data as Study; _controller.RestoreStudy(study); } DataBind(); SearchUpdatePanel.Update(); // force refresh }; StudyListGridView.DataSourceCreated += delegate(StudyDataSource source) { source.Partition = ServerPartition; source.DateFormats = ToStudyDateCalendarExtender.Format; if (!String.IsNullOrEmpty(PatientId.Text)) { source.PatientId = SearchHelper.TrailingWildCard(PatientId.Text); } if (!String.IsNullOrEmpty(PatientName.Text)) { source.PatientName = SearchHelper.NameWildCard(PatientName.Text); } if (!String.IsNullOrEmpty(AccessionNumber.Text)) { source.AccessionNumber = SearchHelper.TrailingWildCard(AccessionNumber.Text); } if (!String.IsNullOrEmpty(ToStudyDate.Text)) { source.ToStudyDate = ToStudyDate.Text; } if (!String.IsNullOrEmpty(FromStudyDate.Text)) { source.FromStudyDate = FromStudyDate.Text; } if (!String.IsNullOrEmpty(StudyDescription.Text)) { source.StudyDescription = SearchHelper.LeadingAndTrailingWildCard(StudyDescription.Text); } if (!String.IsNullOrEmpty(ReferringPhysiciansName.Text)) { source.ReferringPhysiciansName = SearchHelper.NameWildCard(ReferringPhysiciansName.Text); } if (!String.IsNullOrEmpty(ResponsiblePerson.Text)) { source.ResponsiblePerson = SearchHelper.NameWildCard(ResponsiblePerson.Text); } if (!String.IsNullOrEmpty(ResponsibleOrganization.Text)) { source.ResponsibleOrganization = SearchHelper.NameWildCard(ResponsibleOrganization.Text); } if (ModalityListBox.SelectedIndex > -1) { var modalities = new List <string>(); foreach (ListItem item in ModalityListBox.Items) { if (item.Selected) { modalities.Add(item.Value); } } source.Modalities = modalities.ToArray(); } if (StatusListBox.SelectedIndex > -1) { var statuses = new List <string>(); foreach (ListItem status in StatusListBox.Items) { if (status.Selected) { statuses.Add(status.Value); } } source.Statuses = statuses.ToArray(); } }; //Set Roles ViewImagesButton.Roles = AuthorityTokens.Study.ViewImages; ViewStudyDetailsButton.Roles = AuthorityTokens.Study.View; MoveStudyButton.Roles = AuthorityTokens.Study.Move; DeleteStudyButton.Roles = AuthorityTokens.Study.Delete; RestoreStudyButton.Roles = AuthorityTokens.Study.Restore; AssignAuthorityGroupsButton.Roles = ClearCanvas.ImageServer.Enterprise.Authentication.AuthorityTokens.Study.EditDataAccess; }
protected override void OnExecute(CommandProcessor theProcessor, IUpdateContext updateContext) { // Check if the File is the same syntax as the TransferSyntax fileSyntax = _file.TransferSyntax; TransferSyntax dbSyntax = TransferSyntax.GetTransferSyntax(_location.TransferSyntaxUid); // Check if the syntaxes match the location if ((!fileSyntax.Encapsulated && !dbSyntax.Encapsulated) || (fileSyntax.LosslessCompressed && dbSyntax.LosslessCompressed) || (fileSyntax.LossyCompressed && dbSyntax.LossyCompressed)) { // no changes necessary, just return; return; } // Select the Server Transfer Syntax var syntaxCriteria = new ServerTransferSyntaxSelectCriteria(); var syntaxBroker = updateContext.GetBroker <IServerTransferSyntaxEntityBroker>(); syntaxCriteria.Uid.EqualTo(fileSyntax.UidString); ServerTransferSyntax serverSyntax = syntaxBroker.FindOne(syntaxCriteria); if (serverSyntax == null) { Platform.Log(LogLevel.Error, "Unable to load ServerTransferSyntax for {0}. Unable to update study status.", fileSyntax.Name); return; } // Get the FilesystemStudyStorage update broker ready var filesystemStudyStorageEntityBroker = updateContext.GetBroker <IFilesystemStudyStorageEntityBroker>(); var filesystemStorageUpdate = new FilesystemStudyStorageUpdateColumns(); var filesystemStorageCritiera = new FilesystemStudyStorageSelectCriteria(); filesystemStorageUpdate.ServerTransferSyntaxKey = serverSyntax.Key; filesystemStorageCritiera.StudyStorageKey.EqualTo(_location.Key); // Get the StudyStorage update broker ready var studyStorageBroker = updateContext.GetBroker <IStudyStorageEntityBroker>(); var studyStorageUpdate = new StudyStorageUpdateColumns(); StudyStatusEnum statusEnum = _location.StudyStatusEnum; if (fileSyntax.LossyCompressed) { studyStorageUpdate.StudyStatusEnum = statusEnum = StudyStatusEnum.OnlineLossy; } else if (fileSyntax.LosslessCompressed) { studyStorageUpdate.StudyStatusEnum = statusEnum = StudyStatusEnum.OnlineLossless; } studyStorageUpdate.LastAccessedTime = Platform.Time; if (!filesystemStudyStorageEntityBroker.Update(filesystemStorageCritiera, filesystemStorageUpdate)) { Platform.Log(LogLevel.Error, "Unable to update FilesystemQueue row: Study {0}, Server Entity {1}", _location.StudyInstanceUid, _location.ServerPartitionKey); } else if (!studyStorageBroker.Update(_location.GetKey(), studyStorageUpdate)) { Platform.Log(LogLevel.Error, "Unable to update StudyStorage row: Study {0}, Server Entity {1}", _location.StudyInstanceUid, _location.ServerPartitionKey); } else { // Update the location, so the next time we come in here, we don't try and update the database // for another sop in the study. _location.StudyStatusEnum = statusEnum; _location.TransferSyntaxUid = fileSyntax.UidString; _location.ServerTransferSyntaxKey = serverSyntax.Key; } }
public void Update(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new StudyStatusEnum(); item.MarkOld(); item.IsLoaded = true; item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }