Пример #1
0
        void LoadControls()
        {
            //Load offering type
            GivingTypesController gtc = new GivingTypesController();

            givingTypes = gtc.ShowAll();
            if (givingTypes.Count > 0)
            {
                Dictionary <int, string> givingTypesLibrary = new Dictionary <int, string>();
                givingTypesLibrary.Add(0, "<All>");
                foreach (GivingType givingType in givingTypes)
                {
                    givingTypesLibrary.Add(givingType.id, givingType.title);
                }
                givingTypesCmbBx.DataSource    = new BindingSource(givingTypesLibrary, null);
                givingTypesCmbBx.DisplayMember = "Value";
                givingTypesCmbBx.ValueMember   = "Key";

                givingTypesCmbBx.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("No offering types available! no registered offering type found.", "Offering Not Available", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
            }

            //initialize Controls
            periodCmbBx.SelectedIndex = 0;
        }
Пример #2
0
        public void LoadGivingTypes()
        {
            GivingTypesController givingTypesController = new GivingTypesController();

            givingTypes = givingTypesController.ShowAll();
            givingTypesDataGridView.Rows.Clear();
            givingTypesDataGridView.Columns.Clear();
            givingTypesDataGridView.Refresh();
            //setup
            //columns
            givingTypesDataGridView.Columns.Add("givingTypeId", "ID");
            givingTypesDataGridView.Columns.Add("title", "Title");
            givingTypesDataGridView.Columns.Add("isRegular", "Regular Offering Type");
            givingTypesDataGridView.Columns.Add("isActive", "Active");

            givingTypesDataGridView.Columns["givingTypeId"].Visible = false;
            //rows
            if (givingTypes.Count > 0)
            {
                foreach (GivingType givingType in givingTypes)
                {
                    givingTypesDataGridView.Rows.Add(
                        givingType.id,
                        givingType.title,
                        (givingType.isRegular ? "Yes" : "No"),
                        (givingType.isActive ? "Yes" : "No"));
                }
            }
            else
            {
                MessageBox.Show("No offering type are currently registered in the system. Please add an offering type!", "No Offering Type Found!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }