Exemplo n.º 1
0
        private object[] GetAllParametersFromInputControls()
        {
            List <object> parameters = new List <object>();

            foreach (Control control in InputControlsFlowLayoutPanel.Controls)
            {
                if (control is UCSelectInput)
                {
                    UCSelectInput uCSelect = control as UCSelectInput;
                    parameters.Add(uCSelect.ComboBox.SelectedItem);
                }
                else if (control is UCTextInput)
                {
                    UCTextInput uCTextInput = control as UCTextInput;
                    if (!uCTextInput.TextBox.ReadOnly)
                    {
                        parameters.Add(uCTextInput.TextBox.Text);
                    }
                }
                else if (control is UCDateSelect)
                {
                    UCDateSelect uCDatePicker = control as UCDateSelect;
                    parameters.Add(uCDatePicker.DateTimePicker.Value);
                }
            }

            return(parameters.ToArray());
        }
Exemplo n.º 2
0
 private void ClearInputControls()
 {
     foreach (Control control in InputControlsFlowLayoutPanel.Controls)
     {
         if (control is UCSelectInput)
         {
             UCSelectInput uCSelect = control as UCSelectInput;
             uCSelect.ComboBox.SelectedIndex = 0;
         }
         else if (control is UCTextInput)
         {
             UCTextInput uCTextInput = control as UCTextInput;
             uCTextInput.TextBox.Text = "";
         }
         else if (control is UCDateSelect)
         {
             UCDateSelect uCDatePicker = control as UCDateSelect;
             uCDatePicker.DateTimePicker.Value = DateTime.Now;
         }
     }
 }
Exemplo n.º 3
0
        public void UpdateInputControls()
        {
            List <string> values = new List <string>();

            if (DataGridView.Rows.Count > 0)
            {
                // MultipleSelect for DataGridView is disabled so there is only one selectedRow
                DataGridViewRow selectedRow = DataGridView.SelectedRows[0];

                // valueCounter starts from one because we don't have controls for 'Id' (values.ElementAt(0)) values
                int valueCounter = 1;

                foreach (DataGridViewCell cell in selectedRow.Cells)
                {
                    values.Add(cell.Value.ToString());
                }

                foreach (Control control in InputControlsFlowLayoutPanel.Controls)
                {
                    if (control is UCSelectInput)
                    {
                        UCSelectInput uCSelect = control as UCSelectInput;
                        uCSelect.ComboBox.SelectedItem = values.ElementAt(valueCounter++);
                    }
                    else if (control is UCTextInput)
                    {
                        UCTextInput uCTextInput = control as UCTextInput;
                        uCTextInput.TextBox.Text = values.ElementAt(valueCounter++);
                    }
                    else if (control is UCDateSelect)
                    {
                        UCDateSelect uCDatePicker = control as UCDateSelect;
                        uCDatePicker.DateTimePicker.Value = DateTime.Parse(values.ElementAt(valueCounter++), CultureInfo.InvariantCulture);
                    }
                }
            }
        }