Example #1
0
        private void UpdateLockedClasses()
        {
            // Get all OfficesAllIdentified rows for the state and make a dictionary of
            // only the true values
            var dictionary = OfficesAllIdentified.GetDataByStateCode(StateCode)
                             .Where(row => row.IsOfficesAllIdentified)
                             .ToDictionary(row => row.OfficeLevel.ToOfficeClass(),
                                           row => null as object);

            // now get any items that don't match the dictionary
            var items = ControlMasterOnlyClassesToLock.Items.OfType <ListItem>()
                        .Where(
                item =>
                dictionary.ContainsKey(Offices.GetValidatedOfficeClass(item.Value)) !=
                item.Selected);

            foreach (var item in items)
            {
                var officeClass = Offices.GetValidatedOfficeClass(item.Value);
                OfficesAllIdentified.UpdateIsOfficesAllIdentified(item.Selected, StateCode,
                                                                  officeClass.ToInt());
            }

            FeedbackMasterOnly.AddInfo("The locked office classes were updated");
        }
Example #2
0
        protected void CheckBoxListOfficeClassAllIdentified_SelectedIndexChanged(
            object sender, EventArgs e)
        {
            try
            {
                // Get all OfficesAllIdentified rows for the jurisdiction and make a
                // dictionary of only the true values
                var dictionary = OfficesAllIdentified.GetDataByStateCode(StateCode,
                                                                         CountyCode, LocalCode)
                                 .Where(row => row.IsOfficesAllIdentified)
                                 .ToDictionary(row => row.OfficeLevel.ToOfficeClass(),
                                               row => null as object);

                // now get any items that don't match the dictionary
                var items = CheckBoxListOfficeClassAllIdentified.Items.OfType <ListItem>()
                            .Where(
                    item =>
                    dictionary.ContainsKey(Offices.GetValidatedOfficeClass(item.Value)) !=
                    item.Selected);

                // should only be one item, but we'll loop just in case...
                Msg.Text = string.Empty;
                var regenerateReport = GetSelectedOfficeClass() == OfficeClass.All;
                foreach (var item in items)
                {
                    var officeClass = Offices.GetValidatedOfficeClass(item.Value);
                    if (OfficesAllIdentified.StateCodeOfficeLevelCountyCodeLocalCodeExists(
                            StateCode, officeClass.ToInt(), CountyCode, LocalCode))
                    {
                        OfficesAllIdentified.UpdateIsOfficesAllIdentified(item.Selected,
                                                                          StateCode, officeClass.ToInt(), CountyCode, LocalCode);
                    }
                    else if (item.Selected)
                    {
                        OfficesAllIdentified.Insert(StateCode, CountyCode, LocalCode,
                                                    officeClass.ToInt(), true);
                    }
                    var officeDesc = GetOfficeClassDescription(officeClass, true);
                    Msg.Text += item.Selected
            ? Ok(officeDesc +
                 " was changed to PROHIBIT the addition of offices.")
            : Ok(officeDesc + " was changed to ALLOW the addition of offices.");
                    if (officeClass == GetSelectedOfficeClass())
                    {
                        regenerateReport = true;
                    }
                }
                if (regenerateReport)
                {
                    GenerateReport();
                    UpdatePanel.Update();
                }
            }
            catch (Exception ex)
            {
                Msg.Text = Fail(ex.Message);
                LogException("CheckBoxListOfficeClassAllIdentified_SelectedIndexChanged",
                             ex);
            }
        }
Example #3
0
        public void GetData(OfficesAdminReportViewOptions options)
        {
            DataTable = OfficesAdminReportView.GetData(options);

            // Get the OfficesAllIdentified row(s) and make a dictionary of
            // only the true values
            var table = options.OfficeClass == OfficeClass.All
        ? OfficesAllIdentified.GetDataByStateCode(options.StateCode)
        : OfficesAllIdentified.GetData(options.StateCode, options.OfficeClass.ToInt());

            _AllIdentifiedDictionary = table.Where(row => row.IsOfficesAllIdentified)
                                       .ToDictionary(row => row.OfficeLevel.ToOfficeClass(), row => null as object);
        }