예제 #1
0
        private void TvZonesSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            HideAll();
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[0]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[1]))
            {
                cmbCategories.SelectedIndex = -1;
                cmbCategories.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[0]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[2]))
            {
                cmbNames.DisplayMemberPath = "Name";
                cmbNames.SelectedValuePath = "PropID";
                cmbNames.Tag           = SearchResources.PropName;
                cmbNames.ItemsSource   = PropsService.Instanse.GetAll();
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[0]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[3]))
            {
                dtpInDate.Value  = PropsService.GetMinCreatedOn();
                dtpOutDate.Value = PropsService.GetMaxCreatedOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[0]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[4]))
            {
                cmbInNo.ItemsSource    = cmbOutNo.ItemsSource = PropsService.GetAllPropNos();
                cmbInNo.SelectedIndex  = 0;
                cmbOutNo.SelectedIndex = cmbOutNo.Items.Count - 1;
                gNo.Visibility         = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[0]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[5]))
            {
                cmbStatus.SelectedIndex = -1;
                cmbStatus.Visibility    = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[6]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[7]))
            {
                cmbCategories.SelectedIndex = -1;
                cmbCategories.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[6]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[8]))
            {
                cmbNames.DisplayMemberPath = "Name";
                cmbNames.SelectedValuePath = "MaterialID";
                cmbNames.Tag           = SearchResources.MaterialName;
                cmbNames.ItemsSource   = MaterialsService.Instanse.GetAll();
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[6]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[9]))
            {
                dtpInDate.Value  = MaterialsService.GetMinCreatedOn();
                dtpOutDate.Value = MaterialsService.GetMaxCreatedOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[6]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[10]))
            {
                tbInAmount.Text    = MaterialsService.GetMinLowestAmount().ToString();
                tbOutAmount.Text   = MaterialsService.GetMaxLowestAmount().ToString();
                gAmount.Visibility = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[11]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[12]))
            {
                cmbNames.DisplayMemberPath = "UserName";
                cmbNames.SelectedValuePath = "UserID";
                cmbNames.Tag           = SearchResources.UserName;
                cmbNames.ItemsSource   = UsersService.Instanse.GetAll(false, false);
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[11]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[13]))
            {
                dtpInDate.Value  = RepositoryMaterialsService.GetMinRegisteredOn();
                dtpOutDate.Value = RepositoryMaterialsService.GetMaxRegisteredOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[11]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[14]))
            {
                cmbTargetApplicants.ItemsSource   = RepositoryMaterialsService.Instanse.GetAllTargetApplicants(false);
                cmbTargetApplicants.SelectedIndex = -1;
                cmbTargetApplicants.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[11]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[15]))
            {
                tbInAmount.Text    = RepositoryMaterialsService.GetMinAmount().ToString();
                tbOutAmount.Text   = RepositoryMaterialsService.GetMaxAmount().ToString();
                gAmount.Visibility = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[16]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[17]))
            {
                cmbCategories.SelectedIndex = -1;
                cmbCategories.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[16]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[18]))
            {
                cmbNames.DisplayMemberPath = "Name";
                cmbNames.SelectedValuePath = "ItemID";
                cmbNames.Tag           = SearchResources.InItemsByName;
                cmbNames.ItemsSource   = ItemsService.Instanse.GetAll();
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[16]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[19]))
            {
                dtpInDate.Value  = ItemsService.GetMinCreatedOn();
                dtpOutDate.Value = ItemsService.GetMaxCreatedOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[16]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[20]))
            {
                tbInAmount.Text    = ItemsService.GetMinLowestAmount().ToString();
                tbOutAmount.Text   = ItemsService.GetMaxLowestAmount().ToString();
                gAmount.Visibility = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[21]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[22]))
            {
                cmbNames.DisplayMemberPath = "UserName";
                cmbNames.SelectedValuePath = "UserID";
                cmbNames.Tag           = SearchResources.UserName;
                cmbNames.ItemsSource   = UsersService.Instanse.GetAll(false, false);
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[21]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[23]))
            {
                dtpInDate.Value  = RepositoryItemsService.GetMinRegisteredOn();
                dtpOutDate.Value = RepositoryItemsService.GetMaxRegisteredOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[21]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[24]))
            {
                cmbTargetApplicants.ItemsSource   = RepositoryItemsService.Instanse.GetAllTargetApplicants(false);
                cmbTargetApplicants.SelectedIndex = -1;
                cmbTargetApplicants.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[21]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[25]))
            {
                tbInAmount.Text    = RepositoryItemsService.GetMinAmount().ToString();
                tbOutAmount.Text   = RepositoryItemsService.GetMaxAmount().ToString();
                gAmount.Visibility = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[26]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[27]))
            {
                cmbNames.DisplayMemberPath = "Name";
                cmbNames.SelectedValuePath = "LabID";
                cmbNames.Tag           = SearchResources.InLabsByName;
                cmbNames.ItemsSource   = LabsService.Instanse.GetAll();
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[26]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[28]))
            {
                dtpInDate.Value  = LabsService.GetMinCreatedOn();
                dtpOutDate.Value = LabsService.GetMaxCreatedOn();
                gDate.Visibility = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[26]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[29]))
            {
                cmbInNo.ItemsSource    = cmbOutNo.ItemsSource = LabsService.Instanse.GetAllPlaqueNos();
                cmbInNo.SelectedIndex  = 0;
                cmbOutNo.SelectedIndex = cmbOutNo.Items.Count - 1;
                gNo.Visibility         = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[30]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[31]))
            {
                cmbNames.DisplayMemberPath = "Name";
                cmbNames.SelectedValuePath = "LabID";
                cmbNames.Tag           = SearchResources.InLabPropsByLabName;
                cmbNames.ItemsSource   = LabsService.Instanse.GetAll();
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[30]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[32]))
            {
                dtpInDate.Value  = LabPropsService.GetMinAssignedOn();
                dtpOutDate.Value = LabPropsService.GetMaxAssignedOn();
                gDate.Visibility = Visibility.Visible;
            }

            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[33]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[34]))
            {
                cmbNames.DisplayMemberPath = "UserName";
                cmbNames.SelectedValuePath = "UserID";
                cmbNames.Tag           = SearchResources.InLogsByUserName;
                cmbNames.ItemsSource   = UsersService.Instanse.GetAll(false, false);
                cmbNames.SelectedIndex = -1;
                cmbNames.Visibility    = Visibility.Visible;
            }
            if (ReferenceEquals(e.NewValue, tvZones.ActualItems()[33]) ||
                ReferenceEquals(e.NewValue, tvZones.ActualItems()[35]))
            {
                dtpInDate.Value  = LogsService.GetMinLoggedOn();
                dtpOutDate.Value = LogsService.GetMaxLoggedOn();
                gDate.Visibility = Visibility.Visible;
            }
        }