Пример #1
0
        public AddEditSubAreaDialog(Area area)
        {
            InitializeComponent();
            mSubArea = new Cell {AreaId = area.Id, IsActive = true};
            mSubAreaViewModel = new SubAreaViewModel(mSubArea, this);

            DataContext = mSubAreaViewModel;
        }
Пример #2
0
        public AddEditSubAreaDialog(Cell subArea)
        {
            InitializeComponent();

            int subAreaId = subArea.Id;

            Title = "Edit SubArea";

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            cmsWebServiceClient.GetSubAreaCompleted +=
                (s, e) =>
                {
                    mSubArea = (from x in e.Result where x.Id == subAreaId select x).FirstOrDefault();
                    mSubAreaViewModel = new SubAreaViewModel(mSubArea, this);
                    DataContext = mSubAreaViewModel;
                };
            cmsWebServiceClient.GetSubAreaAsync(subArea.Id);
        }
Пример #3
0
        private void SetControlValuesFromSearchFilterList(SearchFilterList searchFilterList)
        {
            mSearchFilterControl.SetFilterIsOn(true);
            ClearControls();

            //1. Manufacturer
            SearchFilter manufactuerFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.PipeSearchFilterNames.Manufacturer.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (manufactuerFilter != null)
            {
                int result;
                if (int.TryParse(manufactuerFilter.Value, out result))
                {
                    Manufacturer match = (from x in Manufacturers where x.Id == result select x).FirstOrDefault();
                    mSelectedManufacturer = match;
                    RaisePropertyChanged("SelectedManufacturer");
                }
            }

            //2. Model
            SearchFilter modelFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.PipeSearchFilterNames.Model.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (modelFilter != null)
            {
                int result;
                if (int.TryParse(modelFilter.Value, out result))
                {
                    Model match = (from x in mModelsCache where x.Id == result select x).FirstOrDefault();
                    mSelectedModel = match;
                    RaisePropertyChanged("SelectedModel");
                }
            }

            //1. Area
            SearchFilter areaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.PipeSearchFilterNames.Area.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (areaFilter != null)
            {
                int result;
                if (int.TryParse(areaFilter.Value, out result))
                {
                    Area match = (from x in Areas where x.Id == result select x).FirstOrDefault();
                    mSelectedArea = match;
                    RaisePropertyChanged("SelectedArea");
                }
            }

            //2. SubArea
            SearchFilter subareaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.PipeSearchFilterNames.SubArea.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (subareaFilter != null)
            {
                int result;
                if (int.TryParse(subareaFilter.Value, out result))
                {
                    Cell match = (from x in SubAreas where x.Id == result select x).FirstOrDefault();
                    mSelectedSubArea = match;
                    RaisePropertyChanged("SelectedSubArea");
                }
            }

            foreach (SearchFilter filter in searchFilterList.SearchFilters)
            {
                if (!string.IsNullOrEmpty(filter.Value))
                {
                    //KeyWords
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.KeyWord.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mKeyword = filter.Value;
                        RaisePropertyChanged("Keyword");
                    }

                    //PipeClass
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.Class.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            var match = (from x in PipeClasses where x.Id == result select x).FirstOrDefault();
                            mSelectedPipeClass = match;
                            RaisePropertyChanged("SelectedPipeClass");
                        }
                    }

                    //PipeSize
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.Size.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            var match = (from x in PipeSizes where x.Id == result select x).FirstOrDefault();
                            mSelectedPipeSize = match;
                            RaisePropertyChanged("SelectedPipeSize");
                        }
                    }

                    //PipeFluidCode
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.FluidCode.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            var match = (from x in PipeFluidCodes where x.Id == result select x).FirstOrDefault();
                            mSelectedPipeFluidCode = match;
                            RaisePropertyChanged("SelectedPipeFluidCode");
                        }
                    }

                    //PipeSpecialFeature
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.SpecialFeature.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            var match = (from x in PipeSpecialFeatures where x.Id == result select x).FirstOrDefault();
                            mSelectedPipeSpecialFeature = match;
                            RaisePropertyChanged("SelectedPipeSpecialFeature");
                        }
                    }

                    //PidDocument
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.PidDocument.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            QuickDocument match = (from x in PandIDDocuments where x.Id == result select x).FirstOrDefault();
                            mSelectedPAndIdDocument = match;
                            RaisePropertyChanged("SelectedPAndIdDocument");
                        }
                    }

                    //ComponentType
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.ComponentType.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            PipeComponentType match = (from x in ComponentTypes where x.Id == result select x).FirstOrDefault();
                            mSelectedComponentType = match;
                            RaisePropertyChanged("SelectedComponentType");
                        }
                    }

                    //IsActive
                    if (filter.Name.Equals(CommonUtils.PipeSearchFilterNames.IsActive.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 = Yes;
                        if (filter.Value == "-3") filter.Value = No;

                        var match = (from x in IsActiveChoices where x == filter.Value select x).FirstOrDefault();
                        mSelectedIsActive = match;
                        RaisePropertyChanged("SelectedIsActive");

                    }

                }
            }

            ProcessSearchFilter();
        }
Пример #4
0
 private void LoadSubAreas()
 {
     List<Cell> list = new List<Cell>();
     list.AddRange(CMS.Cache.SubAreas);
     list.Insert(0, new Cell { Id = -1, Name = "All" });
     SubAreas = new List<Cell>(list);
     mSelectedSubArea = SubAreas[0];
     RaisePropertyChanged("SubAreas");
 }
Пример #5
0
        private void ClearControls()
        {
            mKeyword = string.Empty;
            RaisePropertyChanged("Keyword");

            mSelectedArea = Areas[0];
            RaisePropertyChanged("SelectedArea");

            mSelectedSubArea = SubAreas[0];
            RaisePropertyChanged("SelectedSubArea");

            mSelectedPipeClass = PipeClasses[0];
            RaisePropertyChanged("SelectedPipeClass");

            mSelectedPipeSize = PipeSizes[0];
            RaisePropertyChanged("SelectedPipeSize");

            mSelectedPipeFluidCode = PipeFluidCodes[0];
            RaisePropertyChanged("SelectedPipeFluidCode");

            mSelectedPipeSpecialFeature = PipeSpecialFeatures[0];
            RaisePropertyChanged("SelectedPipeSpecialFeature");

            mSelectedPAndIdDocument = PandIDDocuments[0];
            RaisePropertyChanged("SelectedPAndIdDocument");

            mSelectedComponentType = ComponentTypes[0];
            RaisePropertyChanged("SelectedComponentType");

            mSelectedManufacturer = Manufacturers[0];
            RaisePropertyChanged("SelectedManufacturer");

            mSelectedModel = Models[0];
            RaisePropertyChanged("SelectedModel");

            mSelectedIsActive = IsActiveChoices[0];
            RaisePropertyChanged("SelectedIsActive");
        }
Пример #6
0
        private void AreaChanged()
        {
            if (SelectedArea != null)
            {
                List<Cell> subAreas;

                if (SelectedArea.Id < 0)
                {
                    subAreas = SubAreas;
                }
                else
                {
                    subAreas = (from x in CMS.Cache.SubAreas where x.AreaId == SelectedArea.Id select x).ToList();
                }

                var newSubAreas = new List<Cell>();

                if (subAreas != null && subAreas.Any())
                {
                    newSubAreas.AddRange(subAreas);
                    newSubAreas.Insert(0, new Cell { Id = -1, Name = All });
                }
                else
                {
                    newSubAreas.Insert(0, new Cell { Id = -1, Name = All });
                }

                mSubAreas = newSubAreas;
                RaisePropertyChanged("SubAreas");

                mSelectedSubArea = newSubAreas[0];
                RaisePropertyChanged("SelectedSubArea");

                ProcessSearchFilter();
            }
        }
        private void ClearControls()
        {
            mKeyword = string.Empty;
            RaisePropertyChanged("Keyword");

            mSelectedArea = Areas[0];
            RaisePropertyChanged("SelectedArea");

            mMainSystId = string.Empty;
            RaisePropertyChanged("MainSystId");

            mSelectedEquipmentType = EquipmentTypes[0];
            RaisePropertyChanged("SelectedEquipmentType");

            mSelectedSubArea = SubAreas[0];
            RaisePropertyChanged("SelectedSubArea");

            mSelectedPAndIdDocument = PandIDDocuments[0];
            RaisePropertyChanged("SelectedPAndIdDocument");

            mSelectedComponentType = ComponentTypes[0];
            RaisePropertyChanged("SelectedComponentType");

            mSelectedSpecificationDocument = SpecificationDocuments[0];
            RaisePropertyChanged("SelectedSpecificationDocument");

            mSelectedClassified = Classifieds[0];
            RaisePropertyChanged("Classified");

            mSelectedIsActive = IsActiveChoices[0];
            RaisePropertyChanged("SelectedIsActive");

            mSelectedManufacturer = Manufacturers[0];
            RaisePropertyChanged("SelectedManufacturer");

            mSelectedModel = Models[0];
            RaisePropertyChanged("SelectedModel");

            mSelectedPAndIdDocument = PandIDDocuments[0];
            RaisePropertyChanged("SelectedPAndIDDocument");

            mSelectedClassified = Classifieds[0];
            RaisePropertyChanged("SelectedClassified");
        }
        private void SetControlValuesFromSearchFilterList(SearchFilterList searchFilterList)
        {
            mSearchFilterControl.SetFilterIsOn(true);
            ClearControls();

            //1. Manufacturer
            SearchFilter manufactuerFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Manufacturer.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (manufactuerFilter != null)
            {
                int result;
                if (int.TryParse(manufactuerFilter.Value, out result))
                {
                    Manufacturer match = (from x in Manufacturers where x.Id == result select x).FirstOrDefault();
                    mSelectedManufacturer = match;
                    RaisePropertyChanged("SelectedManufacturer");
                }
            }

            //2. Model
            SearchFilter modelFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Model.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (modelFilter != null)
            {
                int result;
                if (int.TryParse(modelFilter.Value, out result))
                {
                    Model match = (from x in mModelsCache where x.Id == result select x).FirstOrDefault();
                    mSelectedModel = match;
                    RaisePropertyChanged("SelectedModel");
                }
            }

            //1. Area
            SearchFilter areaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Area.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (areaFilter != null)
            {
                int result;
                if (int.TryParse(areaFilter.Value, out result))
                {
                    Area match = (from x in Areas where x.Id == result select x).FirstOrDefault();
                    mSelectedArea = match;
                    RaisePropertyChanged("SelectedArea");
                }
            }

            //2. SubArea
            SearchFilter subareaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.SubArea.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (subareaFilter != null)
            {
                int result;
                if (int.TryParse(subareaFilter.Value, out result))
                {
                    Cell match = (from x in SubAreas where x.Id == result select x).FirstOrDefault();
                    mSelectedSubArea = match;
                    RaisePropertyChanged("SelectedSubArea");
                }
            }

            foreach (SearchFilter filter in searchFilterList.SearchFilters)
            {
                if (!string.IsNullOrEmpty(filter.Value))
                {
                    //KeyWords
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.KeyWord.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mKeyword = filter.Value;
                        RaisePropertyChanged("Keyword");
                    }

                    //MainSystId
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.MaintSystemId.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mMainSystId = filter.Value;
                        RaisePropertyChanged("MainSystId");
                    }

                    //Owner
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Owner.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedMobileOwner = (from x in MobileOwners where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedMobileOwner");
                        }
                    }

                    //Hirer
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Hirer.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedMobileHirer = (from x in MobileHirers where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedMobileHirer");
                        }
                    }

                    //Classified
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.Classified.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 = Yes;
                        if (filter.Value == "-3") filter.Value = No;

                        var match = (from x in Classifieds where x == filter.Value select x).FirstOrDefault();
                        mSelectedClassified = match;
                        RaisePropertyChanged("Classified");
                    }

                    //Type
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.MobilePlantType.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            MobilePlantType match = (from x in EquipmentTypes where x.Id == result select x).FirstOrDefault();
                            mSelectedEquipmentType = match;
                            RaisePropertyChanged("SelectedEquipmentType");
                        }
                    }

                    //ComponentType
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.ComponentType.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            MobilePlantComponentType match = (from x in ComponentTypes where x.Id == result select x).FirstOrDefault();
                            mSelectedComponentType = match;
                            RaisePropertyChanged("SelectedComponentType");
                        }
                    }

                    //IsActive
                    if (filter.Name.Equals(CommonUtils.MobilePlantSearchFilterNames.IsActive.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 = Yes;
                        if (filter.Value == "-3") filter.Value = No;

                        var match = (from x in IsActiveChoices where x == filter.Value select x).FirstOrDefault();
                        mSelectedIsActive = match;
                        RaisePropertyChanged("SelectedIsActive");

                    }

                }
            }

            ProcessSearchFilter();
        }
Пример #9
0
        private void LoadSubAreasFromCache(bool setSelectedItem)
        {
            mSubAreas = new List<Cell>();
            mSubAreas.AddRange(CMS.Cache.SubAreas);
            mSubAreas.Insert(0, new Cell { Id = -1, Name = All });
            RaisePropertyChanged("SubAreas");

            if (setSelectedItem)
            {
                mSelectedSubArea = mSubAreas[0];
                RaisePropertyChanged("SelectedSubArea");
            }
        }
Пример #10
0
        private void FilterSubAreasByArea(bool setSelectedItem)
        {
            //mSubAreas.Clear();//do not new up a collection as it plays havoc with binding
            mSubAreas = new List<Cell>();
            if (mSelectedArea.Name != All)
            {
                var allSubArea = new Cell { Id = -1, Name = All };

                List<Cell> subAreas = (from x in CMS.Cache.SubAreas where x.AreaId == mSelectedArea.Id select x).ToList();

                if (subAreas.Any())
                {
                    mSubAreas.AddRange(subAreas);
                }
                mSubAreas.Insert(0, allSubArea);

                RaisePropertyChanged("SubAreas");

                if (setSelectedItem)
                {
                    mSelectedSubArea = allSubArea;
                    RaisePropertyChanged("SelectedSubArea");
                }
            }
            else
            {
                LoadSubAreasFromCache(setSelectedItem);
            }
            ProcessSearchFilter();
        }
        private void ClearControls()
        {
            mKeyword = "";
            RaisePropertyChanged("Keyword");

            mSelectedEquipmentType = EquipmentTypes[0];
            RaisePropertyChanged("SelectedEquipmentType");

            if (SelectedArea != null)
            {
                mSelectedArea = Areas[0];
                RaisePropertyChanged("SelectedArea");
            }

            if (SelectedSubArea != null)
            {
                mSelectedSubArea = SubAreas[0];
                RaisePropertyChanged("SelectedSubArea");
            }

            if (mSelectedUpperEquipment != null)
            {
                mUpperEquipments.AddRange(mMasterListUpperEquipments);
                mUpperEquipments.Insert(0, new UpperEquipment { Name = All, });
                mSelectedUpperEquipment = UpperEquipments[0];
                RaisePropertyChanged("SelectedUpperEquipment");
            }

            if (mSelectedGraphic != null)
            {
                mSelectedGraphic = Graphics[0];
                RaisePropertyChanged("SelectedGraphic");
            }

            if (mSelectedPAndIdDocument != null)
            {
                mSelectedPAndIdDocument = PandIDDocuments[0];
                RaisePropertyChanged("SelectedPAndIDDocument");
            }

            if (mSelectedComponentType != null)
            {
                mSelectedComponentType = ComponentTypes[0];
                RaisePropertyChanged("SelectedComponentType");
            }

            if (mSelectedSpecificationDocument != null)
            {
                mSelectedSpecificationDocument = SpecificationDocuments[0];
                RaisePropertyChanged("SelectedSpecificationDocument");
            }

            if (mSelectedClassified != null)
            {
                mSelectedClassified = Classifieds[0];
                RaisePropertyChanged("SelectedClassified");
            }
        }
        private void SetControlValuesFromSearchFilterList(SearchFilterList searchFilterList)
        {
            ClearControls();

            // BECAUSE ORDER OF SETTING THESE 3 ( Area & SubArea & UpperEquipment) IS IMPORTANT - we will no rely on a 'loop order' SearchFilters - too risky.
            var areaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.ControlSearchFilterNames.Area.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (areaFilter != null && !string.IsNullOrEmpty(areaFilter.Value))
            {
                int result;
                if (int.TryParse(areaFilter.Value, out result))
                {
                    var match = (from x in mAreas where x.Id == result select x).FirstOrDefault();
                    mSelectedArea = match;
                    RaisePropertyChanged("SelectedArea");

                    FilterSubAreasByArea(false); //might change the list of SubAreas ie 'mSubAreas'
                }
            }

            var subAreaFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.ControlSearchFilterNames.SubArea.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (subAreaFilter != null && !string.IsNullOrEmpty(subAreaFilter.Value))
            {
                int result;
                if (int.TryParse(subAreaFilter.Value, out result))
                {
                    var match = (from x in mSubAreas where x.Id == result select x).FirstOrDefault();
                    mSelectedSubArea = match;
                    RaisePropertyChanged("SelectedSubArea");

                }
            }

            RaisePropertyChanged("UpperEquipments");

            var upperEquipmentFilter = (from x in searchFilterList.SearchFilters where x.Name.Equals(CommonUtils.ControlSearchFilterNames.UpperEquipment.ToString(), StringComparison.CurrentCultureIgnoreCase) select x).FirstOrDefault();
            if (upperEquipmentFilter != null && !string.IsNullOrEmpty(upperEquipmentFilter.Value))
            {
                //the UpperEquipments_get does the filtering.
                mSelectedUpperEquipment = (from x in UpperEquipments where x.Name == upperEquipmentFilter.Value select x).FirstOrDefault();
                if (mSelectedUpperEquipment == null)
                {
                    mSelectedUpperEquipment = UpperEquipments[0];
                }
                RaisePropertyChanged("SelectedUpperEquipment");
            }

            foreach (SearchFilter filter in searchFilterList.SearchFilters)
            {
                if (!string.IsNullOrEmpty(filter.Value))
                {
                    //KeyWords
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.KeyWord.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mKeyword = filter.Value;
                        RaisePropertyChanged("Keyword");
                    }

                    //ControlSystemType
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.ControlSystemType.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedEquipmentType = (from x in EquipmentTypes where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedEquipmentType");
                        }
                    }

                    //Graphic
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.Graphic.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedGraphic = (from x in Graphics where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedGraphic");
                        }
                    }

                    //PidDocument
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.PidDocument.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedPAndIdDocument = (from x in PandIDDocuments where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedPAndIdDocument");
                        }
                    }

                    //ControlSystemComponentType
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.ComponentType.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedComponentType = (from x in ComponentTypes where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedComponentType");
                        }
                    }

                    //Specification
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.Specification.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        int result;
                        if (int.TryParse(filter.Value, out result))
                        {
                            mSelectedSpecificationDocument = (from x in SpecificationDocuments where x.Id == result select x).FirstOrDefault();
                            RaisePropertyChanged("SelectedSpecificationDocument");
                        }
                    }

                    //Classified
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.Classified.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mSelectedClassified = filter.Value; //Yes or No
                        RaisePropertyChanged("SelectedClassified");
                    }

                    //IsActive
                    if (filter.Name.Equals(CommonUtils.ControlSearchFilterNames.IsActive.ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        mSelectedIsActive = filter.Value; //Yes or No
                        RaisePropertyChanged("SelectedIsActive");
                    }
                }
            }
            ProcessSearchFilter();
        }
Пример #13
0
 public SubAreaViewModel(Cell subArea, AddEditSubAreaDialog view)
 {
     mSubArea = subArea;
     mView = view;
 }
Пример #14
0
        private void LoadData()
        {
            var getQuickControlSystemsTask = DatabaseLoader.GetQuickControlSystems(new EquipmentFilterObject());
            var getQuickControlSystemInterlocksTask = DatabaseLoader.GetQuickControlSystemInterlocks();
            var specificationDocumentsTask = DatabaseLoader.GetQuickDocuments(CommonUtils.DoctypeFuncspecCode);
            var getUpperEquipmentsTask = DatabaseLoader.GetUpperEquipments();
            var getQuickControlSystemTypesTask = DatabaseLoader.GetQuickControlSystemTypes();

            var tasks = new List<Task> {
                getQuickControlSystemsTask,
                getQuickControlSystemInterlocksTask,
                specificationDocumentsTask,
                getUpperEquipmentsTask,
                getQuickControlSystemTypesTask,
                getQuickControlSystemInterlocksTask
            };

            Task.Factory.ContinueWhenAll(tasks.ToArray(), x =>
            {
                CMS.UiFactory.StartNew(() =>
                {
                    SpecificationDocuments = specificationDocumentsTask.Result;

                    var alllDocs = new QuickDocument { Id = -1, Name = ALL };
                    SpecificationDocuments.Insert(0, alllDocs);
                    mSelectedFunctionalSpec = alllDocs;
                    RaisePropertyChanged("SpecificationDocuments");
                    RaisePropertyChanged("SelectedFunctionalSpecification");

                    ControlSystemTypes = getQuickControlSystemTypesTask.Result;

                    var allControlSys = new QuickControlSystemType { Id = -1, Name = ALL };
                    ControlSystemTypes.Insert(0, allControlSys);
                    mSelectedControlSystemType = allControlSys;
                    RaisePropertyChanged("ControlSystemTypes");
                    RaisePropertyChanged("SelectedControlSystemType");

                    var allUpper = new UpperEquipment { Name = ALL };
                    mUpperEquipments = new List<UpperEquipment>();
                    mMasterListUpperEquipments = new List<UpperEquipment>();
                    mUpperEquipments.AddRange(getUpperEquipmentsTask.Result);
                    mMasterListUpperEquipments.AddRange(getUpperEquipmentsTask.Result);

                    mUpperEquipments.Insert(0, allUpper);
                    //mMasterListUpperEquipments.Insert(0, allUpper);

                    mSelectedUpperEquipment = allUpper;
                    RaisePropertyChanged("UpperEquipments");
                    RaisePropertyChanged("SelectedUpperEquipment");

                    ControlSystems = getQuickControlSystemsTask.Result;
                    RaisePropertyChanged("ControlSystems");

                    mQuickInterlocks = getQuickControlSystemInterlocksTask.Result;

                    //Area
                    Areas = new List<Area>();
                    Areas.AddRange(CMS.Cache.Areas);
                    var allArea = new Area { Id = -1, Name = ALL };
                    Areas.Insert(0, allArea);

                    mSelectedArea = allArea;
                    RaisePropertyChanged("Areas");
                    RaisePropertyChanged("SelectedArea");

                    //Cells
                    var allCells = new Cell { Id = -1, Name = ALL };
                    mCells = new List<Cell>();
                    mMasterListCells = new List<Cell>();

                    mCells.AddRange(CMS.Cache.SubAreas);
                    mMasterListCells.AddRange(CMS.Cache.SubAreas);

                    mCells.Insert(0, allCells);
                    //mMasterListCells.Insert(0, allCells);

                    mSelectedCell = allCells;
                    RaisePropertyChanged("Cells");
                    RaisePropertyChanged("SelectedCell");

                    Utils.ResetOriginalValues(View);

                    IsGridBusy = false;
                    RaisePropertyChanged("IsGridBusy");
                });
            });
        }
Пример #15
0
        private void LoadCellsFilteredByArea()
        {
            if (mSelectedArea == null)
            {
                return;
            }

            //FILTERED
            mCells.Clear();
            var allCell = new Cell { Id = -1, Name = ALL };
            var filteredByAreaCells = (from x in mMasterListCells where x.AreaId == mSelectedArea.Id select x).ToList();
            if (filteredByAreaCells.Any())
            {
                mCells.AddRange(filteredByAreaCells);
            }
            filteredByAreaCells.Insert(0, allCell);
            RaisePropertyChanged("Cells");
            RaisePropertyChanged("SelectedCell");
        }
 private void LoadCellsFromCache()
 {
     //Cell
     Cells = new List<Cell>();
     Cells.AddRange(CMS.Cache.SubAreas);
     Cells.Insert(0, new Cell {Id = -1, Name = "All"});
     mSelectedCell = Cells[0];
     RaisePropertyChanged("Cells");
 }