public Ratings()
        {
            InitializeComponent();
            InitializeCustomComponents();
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Rating.GetDefaultValue());
            tableUtility.CreateTable(RatingAgency.GetDefaultValue());
            ratingAgenciesRowIndex = 0;
            LoadRatingAgencies();
        }
        private void DataGridRatingAgenciesMouseDown(object sender, MouseEventArgs e)
        {
            DataGridView dataGridView = sender as DataGridView;

            ratingAgenciesRowIndex = FormUtility.DataGridViewMouseDownContextMenu(dataGridView, e);
            if (ratingAgenciesRowIndex < 0)
            {
                return;
            }
            currentRatingAgency = FormUtility.GetBindingSource(dataGridViewRatingAgencies)[ratingAgenciesRowIndex] as RatingAgency;
        }
Exemplo n.º 3
0
        public void OnSubmit(List<string> passedValue, string reference)
        {
            TableUtility tableUtility = new TableUtility(Globals.WatchdogAddIn.Application.ActiveWorkbook);
            RatingAgency ratingAgency = new RatingAgency(passedValue[0]);
            tableUtility.CreateMissingTable(RatingAgency.GetDefaultValue());
            tableUtility.InsertTableRow(ratingAgency, new List<string>
            {
                passedValue[0]
            });
            ratingAgencyBindingSource.Add(ratingAgency);

        }
        public void OnSubmit(List <string> passedValue, string reference)
        {
            dataGridViewRatingAgencies.ClearSelection();
            TableUtility tableUtility = new TableUtility();
            RatingAgency ratingAgency = new RatingAgency(passedValue[0]);

            tableUtility.InsertTableRow(ratingAgency);
            int index = FormUtility.GetBindingSource(dataGridViewRatingAgencies).Add(ratingAgency);

            dataGridViewRatingAgencies.Rows[index].Selected = true;
            currentRatingAgency    = ratingAgency;
            ratingAgenciesRowIndex = index;
            LoadRatings(ratingAgenciesRowIndex);
        }
        private void DeleteRatingAgencyClick(object sender, EventArgs e)
        {
            TableUtility  tableUtility         = new TableUtility();
            RatingAgency  ratingAgencyToDelete = dataGridViewRatingAgencies.Rows[ratingAgenciesRowIndex].DataBoundItem as RatingAgency;
            List <Rating> ratingsToDelete      = tableUtility.ConvertRangesToObjects <Rating>(tableUtility.ReadTableRow(Rating.GetDefaultValue(), new Dictionary <string, string>
            {
                { "Agency", ratingAgencyToDelete.GetIndex().ToString() }
            }, QueryOperator.OR));

            foreach (Rating rating in ratingsToDelete)
            {
                tableUtility.DeleteTableRow(rating);
            }
            tableUtility.DeleteTableRow(ratingAgencyToDelete);
            FormUtility.GetBindingSource(dataGridViewRatingAgencies).RemoveAt(ratingAgenciesRowIndex);
            LoadRatings(ratingAgenciesRowIndex);
            if (FormUtility.GetBindingSource(dataGridViewRatingAgencies).Count == 0)
            {
                currentRatingAgency = null;
            }
        }
        private void LoadRatingAgencies()
        {
            TableUtility        tableUtility = new TableUtility();
            List <RatingAgency> agencyList   = tableUtility.ConvertRangesToObjects <RatingAgency>(tableUtility.ReadAllRows(RatingAgency.GetDefaultValue()));

            foreach (RatingAgency agency in agencyList)
            {
                FormUtility.GetBindingSource(dataGridViewRatingAgencies).Add(agency);
            }
        }
Exemplo n.º 7
0
 private void LoadRatingAgencies()
 {
     TableUtility tableUtility = new TableUtility(Globals.WatchdogAddIn.Application.ActiveWorkbook);
     List<RatingAgency> agencyList = tableUtility.ConvertRangesToObjects<RatingAgency>(tableUtility.ReadAllRows(RatingAgency.GetDefaultValue().GetTableName()));
     foreach (RatingAgency agency in agencyList)
     {
         ratingAgencyBindingSource.Add(agency);
     }
 }
Exemplo n.º 8
0
 private void AgencySelected(object sender, DataGridViewCellStateChangedEventArgs e)
 {
     currentRatingAgency = dataGridViewRatingAgencies.Rows[e.Cell.RowIndex].DataBoundItem as RatingAgency;
 }