private void LoadVersionFilters() { List<DocumentVersionFilter> versions = new List<DocumentVersionFilter>(); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.All, Name = "All"}); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.Latest, Name = "Latest"}); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.RequireDrafting, Name = "Requires Drafting"}); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.NoVersions, Name = "No Versions Exist"}); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.NoNativeExist, Name = "No Native Exist"}); versions.Add(new DocumentVersionFilter {Id = (int) CommonUtils.DocumentVersionFilter.NoPdfExist, Name = "No PDF Exist"}); DocumentVersionFilters = new ObservableCollection<DocumentVersionFilter>(versions); mSelectedDocumentVersionFilter = versions[0]; RaisePropertyChanged("DocumentVersionFilters"); }
private void SetControlValuesFromSearchFilterList(SearchFilterList searchFilterList) { mSearchFilterControl.SetFilterIsOn(true); ClearControls(); foreach (SearchFilter filter in searchFilterList.SearchFilters) { if (!string.IsNullOrEmpty(filter.Value)) { //KeyWords if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.KeyWord.ToString(), StringComparison.CurrentCultureIgnoreCase)) { mKeyword = filter.Value; RaisePropertyChanged("Keyword"); } //Area if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.Area.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { Area match = (from x in Areas where x.Id == result select x).FirstOrDefault(); mSelectedArea= match; RaisePropertyChanged("SelectedArea"); } } //Author if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.Author.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { DocumentAuthor match = (from x in Authors where x.Id == result select x).FirstOrDefault(); mSelectedDocumentAuthor = match; RaisePropertyChanged("SelectedDocumentAuthor"); } } //Discipline if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.Discipline.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { DocumentDiscipline match = (from x in DocumentDisciplines where x.Id == result select x).FirstOrDefault(); mSelectedDocumentDiscipline = match; RaisePropertyChanged("SelectedDocumentDiscipline"); } } //DocumentStatus if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.DocumentStatus.ToString(), StringComparison.CurrentCultureIgnoreCase)) { //For compatibility as previously it was saved as ID if (filter.Value == "-1") filter.Value = All; if (filter.Value == "-2") filter.Value = "Active"; if (filter.Value == "-3") filter.Value = "Disabled"; var match = (from x in DocumentStatuses where x == filter.Value select x).FirstOrDefault(); mSelectedDocumentStatus = match; RaisePropertyChanged("SelectedDocumentStatus"); } //DocumentType if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.DocumentType.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { DocumentType match = (from x in DocumentTypes where x.Id == result select x).FirstOrDefault(); mSelectedDocumentType = match; RaisePropertyChanged("SelectedDocumentType"); } } //Location if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.Location.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { DocumentLocation match = (from x in DocumentLocations where x.Id == result select x).FirstOrDefault(); mSelectedDocumentLocation = match; RaisePropertyChanged("SelectedDocumentLocation"); } } //PurchaseOrder if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.PurchaseOrder.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { DocumentPurchaseOrder match = (from x in PurchaseOrders where x.Id == result select x).FirstOrDefault(); mSelectedPurchaseOrder = match; RaisePropertyChanged("SelectedPurchaseOrder"); } } //CheckInOutStatus if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.CheckInOutStatus.ToString(), StringComparison.CurrentCultureIgnoreCase)) { //For compatibility as previously it was saved as Id if (filter.Value == "-1") filter.Value = All; if (filter.Value == "-2") filter.Value = "Checked Out"; if (filter.Value == "-3") filter.Value = "Checked In"; var match = (from x in InOutStatuses where x == filter.Value select x).FirstOrDefault(); mSelectedInOutStatus = match; RaisePropertyChanged("SelectedInOutStatus"); } //Version if (filter.Name.Equals(CommonUtils.DocumentSearchFilterNames.Version.ToString(), StringComparison.CurrentCultureIgnoreCase)) { int result; if (int.TryParse(filter.Value, out result)) { var match = (from x in DocumentVersionFilters where x.Id == result select x).FirstOrDefault(); mSelectedDocumentVersionFilter = match; RaisePropertyChanged("SelectedDocumentVersionFilter"); } } } } ProcessSearchFilter(); }
private void ClearControls() { mKeyword = string.Empty; RaisePropertyChanged("Keyword"); mSelectedArea = Areas[0]; RaisePropertyChanged("SelectedArea"); mSelectedDocumentDiscipline = DocumentDisciplines[0]; RaisePropertyChanged("SelectedDocumentDiscipline"); mSelectedDocumentType = DocumentTypes[0]; RaisePropertyChanged("SelectedDocumentType"); mSelectedPurchaseOrder = PurchaseOrders[0]; RaisePropertyChanged("SelectedPurchaseOrder"); mSelectedDocumentAuthor = Authors[0]; RaisePropertyChanged("SelectedDocumentAuthor"); mSelectedDocumentVersionFilter = DocumentVersionFilters[0]; RaisePropertyChanged("SelectedDocumentVersionFilter"); mSelectedInOutStatus = InOutStatuses[0]; RaisePropertyChanged("SelectedInOutStatus"); mSelectedDocumentStatus = DocumentStatuses[0]; RaisePropertyChanged("SelectedDocumentStatus"); mSelectedDocumentLocation = DocumentLocations[0]; RaisePropertyChanged("SelectedDocumentLocation"); }