Пример #1
0
        //********************Non Event Methods********************

        //Used to populate all the class times for each day
        private void PopulateClassTimes()
        {
            Class_Database.PopulateTimeDataGridView("Monday", MondayDGV);
            Class_Database.PopulateTimeDataGridView("Tuesday", TuesdayDGV);
            Class_Database.PopulateTimeDataGridView("Wednesday", WednesdayDGV);
            Class_Database.PopulateTimeDataGridView("Thursday", ThursdayDGV);
            Class_Database.PopulateTimeDataGridView("Friday", FridayDGV);
            Class_Database.PopulateTimeDataGridView("Saturday", SaturdayDGV);
        }
Пример #2
0
        public Add_New_Time()
        {
            InitializeComponent();
            UserLabel.Text = "Current User: "******" " + Global.userLastName;           //Sets the current user to label
            Class_Database.PopulateTimeDataGridView(Global.newTimeDay, Existing_Times);                     //Populates datagridview with existing times

            //Setting start times datasource found from GenerateStartTimes Method in Add_Edit_Class_Times
            Dropdown_1.DataSource    = Global.newTimedt;
            Dropdown_1.ValueMember   = "Time";
            Dropdown_1.DisplayMember = "Display Time";

            //Setting startvtime dropdown selected index to the same as the one currently editing if in edit session
            if (Global.editingExistingClassTime == true)
            {
                int selectedIndex = 0;      //Will hold the selected index
                int counter       = 0;      //Used as the counter for iteration

                //Loops through each of the start times found in dopdown1 and selects the edited start time
                foreach (DataRow row in Global.newTimedt.Rows)
                {
                    if (row[1].ToString() == Global.startTimeSelectedDateTime.ToShortTimeString())
                    {
                        selectedIndex = counter;
                        break;
                    }
                    counter++;
                }
                Dropdown_1.SelectedIndex = selectedIndex;

                //If edit session changes the button to an edit button
                Create_Time.Visible = false;
                Edit_Time.Visible   = true;
            }

            Class_Time_Groupbox.Text = Global.newTimeDay;                   //Sets label to which day is selected
            Dropdown_1_SelectionChangeCommitted(this, EventArgs.Empty);     //runs event for selectionchangecommitted which generates finish times
        }