예제 #1
0
        private void absorbRecordTypePermissionsFrom(KeyChain chain)
        {
            if (chain.HasFullAccessToAllRecordTypes)
            {
                HasFullAccessToAllRecordTypes = true;
            }

            if (chain.RecordTypes == null)
            {
                return;
            }

            foreach (var foreginRecordLevel in chain.RecordTypes)
            {
                SecurityLockAccessLevel currentCommandLevel;

                if (!RecordTypes.TryGetValue(foreginRecordLevel.Key, out currentCommandLevel))
                {
                    RecordTypes.Add(foreginRecordLevel.Key, foreginRecordLevel.Value);
                    continue; // add it - it's not already there
                }

                if (foreginRecordLevel.Value > currentCommandLevel)                 // then this is a higher permission
                {
                    RecordTypes[foreginRecordLevel.Key] = foreginRecordLevel.Value; // use that permission
                }
            }
        }
예제 #2
0
        public MainViewModel()
        {
            UpdateDatePeriodFilters();

            XMLHandle.loadSchema(Properties.Settings.Default.SchemaFileLoc);
            LoadXMLFileData();
            try
            {
                XMLHandle.loadXMLDoc(Properties.Settings.Default.RecordFileLocation + "\\" + Properties.Settings.Default.XMLRecordName + ".xml");
            }
            catch (Exception e_File)
            {
                Console.WriteLine("Error Locating File, Creating New Record File. " + e_File.Message);
                XMLHandle.CreateXMLDoc(Properties.Settings.Default.RecordFileLocation + "\\" + Properties.Settings.Default.XMLRecordName + ".xml");
                XMLHandle.loadXMLDoc(Properties.Settings.Default.RecordFileLocation + "\\" + Properties.Settings.Default.XMLRecordName + ".xml");
            }
            XMLHandle.validateXML();

            XMLHandle.FileChange += XMLHandle_FileChange;

            AddNewRecordCommand = new RelayCommand(ToggleAddNewRecordFlyout);

            SelectedDatePeriodFilterChangedCommand = new RelayCommand(SelectedDatePeriodFilterChanged);

            NewRecordBalanceLostFocusCommand = new RelayCommand(NewRecordBalanceLostFocus);
            NewRecordTopUpLostFocusCommand   = new RelayCommand(NewRecordTopUpLostFocus);

            SubmitAddNewRecordCommand = new RelayCommand(AddNewRecord);

            RecordTypes.Add("Electricity", RecordType.e_Electricity);
            RecordTypes.Add("Gas", RecordType.e_Gas);
        }