Beispiel #1
0
        private void dataGrid_Selection(object sender, EventArgs e)
        {
            if (executedFirstTime)
            {
                executedFirstTime = false;
                return;
            }
            try
            {
                int selectedIndex = dataGridTimeSlots.SelectedRows[0].Index;
                if (selectedIndex != -1)
                {
                    if (dataGridTimeSlots.SelectedRows[0].Cells[0].Value != null)
                    {
                        int id = int.Parse(dataGridTimeSlots.SelectedRows[0].Cells[0].Value.ToString());
                        selectedTimeSlot = timeSlotService.getTimeSlot(id);

                        #region Set data to Fields
                        numericSThours.Value = selectedTimeSlot.StHours;

                        switch (selectedTimeSlot.StMinutes)
                        {
                        case 00:
                            comboBoxSTMinutes.SelectedIndex = 0;
                            break;

                        case 30:
                            comboBoxSTMinutes.SelectedIndex = 1;
                            break;
                        }

                        ETHours.Text   = selectedTimeSlot.EtHours.ToString();
                        ETMinutes.Text = selectedTimeSlot.EtMinutes.ToString();

                        switch (selectedTimeSlot.Duration)
                        {
                        case "30 Minutes":
                            comboBoxDuration.SelectedIndex = 0;
                            break;

                        case "1 Hour":
                            comboBoxDuration.SelectedIndex = 1;
                            break;

                        case "2 Hours":
                            comboBoxDuration.SelectedIndex = 2;
                            break;
                        }

                        #endregion
                    }
                }
            }
            catch (ArgumentOutOfRangeException es)
            {
                Console.WriteLine(es.Message);
            }
        }