简体   繁体   中英

Error message Error 5 Ambiguity

here i am getting this error message:

Error 5 Ambiguity between 'OPTFDashboard.Common.Modules.CNAAll.ViewModels.CNAAllViewModel.Shift' and 'OPTFDashboard.Common.Modules.CNAAll.ViewModels.CNAAllViewModel.Shift' C:\\OPTFDashboard\\Common\\Modules\\CNAAll\\ViewModels\\CNAAllViewModel.cs 34 117 Common

I am trying to bind the selected nurses shift (day,eve, all) to refresh the data displayed per this choice.

using System;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Windows.Data;
using OPTFDashboard.Common.Modules.CNABathing.DataAccess;
using OPTFDashboard.Common.Ribbon;
using OPTFDashboard.Common.Utility;
using OPTFDashboard.DataModel;
using OPTFDashboard.ViewModel;
using OPTFDashboard.Common.Modules.CNAAll.DataAccess;

namespace OPTFDashboard.Common.Modules.CNAAll.ViewModels
{
    [Export]
    class CNAAllViewModel : TabViewModel, ISelectedContentTab
    {
        private readonly String[] _shift = new String[] { "ALL", "DAY", "EVE", "NIGHT" };
        public CNAAllViewModel()
            : base()
        {
            DisplayName = "All CNA";

            StartDate = DateTime.Now.AddMonths(-3);
            EndDate = DateTime.Now.AddDays(19);

            GroupDataCollection = new ObservableCollection<GroupData>()

            {
                RibbonControlHelper.CreateFacilitySelection()
                , new GroupData("Criterria"
                , RibbonControlHelper.CreateDateSelection(StartDate,EndDate,(s, e) => { StartDate = s; EndDate = e; RefreshData(); })
                , RibbonControlHelper.CreateUnitSelection(UnitChanged)

                , RibbonControlHelper.CreateComboBox("Shift", "Shift", "Select Shift to show.", _shift, (type) => { Shift = type; })




                )
            };
        }


        private string Shift;
        private DateTime startDate;
        public DateTime StartDate
        {
            get { return startDate; }
            set { startDate = value; }
        }

        private DateTime endDate;
        public DateTime EndDate
        {
            get { return endDate; }
            set { endDate = value; }
        }

        public ObservableCollection<GroupData> GroupDataCollection { get; private set; }

        private String UnitCode { get; set; }
        private void UnitChanged(Unit unit)
        {
            UnitCode = unit == null ? "" : unit.Description;
            RefreshData();

        }


        protected override void RefreshData()
        {
            if (FacilitiesAreChanging) { return; }

            Loading = true;
            // this is the details section. 

            // Load CNABathing
            CNAAllRepository.DetailedCNABathing(FacilitySelectionService.SelectedFacilities, StartDate, EndDate, UnitCode,
            (cnabathingdetails) =>
            {
                var data = new ListCollectionView(cnabathingdetails);
                data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
                data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
                DataCNABathing = data;
            });

            CNAAllRepository.DetailedCNABowel(FacilitySelectionService.SelectedFacilities, startDate, endDate, UnitCode,
                    (cna) =>
                    {
                        var data = new ListCollectionView(cna);
                        data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
                        data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
                        DataCNABowel = data;
                    });

            CNAAllRepository.DetailedCNAIntakeVSOutput(FacilitySelectionService.SelectedFacilities, StartDate, EndDate, UnitCode, 
               (CNAIntakeVSOutputDetails) =>
               {
                   var data = new ListCollectionView(CNAIntakeVSOutputDetails);
                   data.GroupDescriptions.Add(new PropertyGroupDescription("FACILITY_KEY"));
                   data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
                   DataCNAIntakeVSOutput = data;
               });

            CNAAllRepository.DetailedCNAPoorEating((FacilitySelectionService.SelectedFacilities), startDate, endDate, UnitCode, "0",
                (cnaPoorEatingDetail) =>
                {
                    var data = new ListCollectionView(cnaPoorEatingDetail);
                    data.GroupDescriptions.Add(new PropertyGroupDescription("UNIT"));
                    DataCNAPoorEating = data;
                });

            Loading = false;
        }


        private ListCollectionView _DataCNABathing;
        public ListCollectionView DataCNABathing
        {
            get { return _DataCNABathing; }
            set { this.SetReferenceProperty("DataCNABathing", ref _DataCNABathing, value); }
        }

        private ListCollectionView _DataCNABowel;
        public ListCollectionView DataCNABowel
        {
            get { return _DataCNABowel; }
            set { this.SetReferenceProperty("DataCNABowel", ref _DataCNABowel, value); }
        }

        private ListCollectionView _DataCNAIntakeVSOutput;
        public ListCollectionView DataCNAIntakeVSOutput
        {
            get { return _DataCNAIntakeVSOutput; }
            set { this.SetReferenceProperty("DataCNAIntakeVSOutput", ref _DataCNAIntakeVSOutput, value); }
        }

        private ListCollectionView _DataCNAPoorEating;
        public ListCollectionView DataCNAPoorEating
        {
            get { return _DataCNAPoorEating; }
            set { this.SetReferenceProperty("DataCNAPoorEating", ref _DataCNAPoorEating, value); }
        }


        // here we will put the shift pulldown :

       private String _Type;
        private String Shift
     {
         get { return _Type; }
         set { if (this.SetReferenceProperty("Shift", ref _Type, value)) { RefreshData(); } }

     }
    }
}

You have a private property called Shift , and a private field called Shift . Remove one of them.

private string Shift;

...

private String Shift
{
   get { return _Type; }
   set { if (this.SetReferenceProperty("Shift", ref _Type, value)) { RefreshData(); } }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM