Esempio n. 1
0
        private async void btnSubmit_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = null;
            var caller = sender as Button;

            empAddContext.name  = empNameTxtBox.Text;
            empAddContext.email = empEmailTxtBox.Text;
            if (!ValidationExtensions.IsValidEmailFormat(empAddContext.email))
            {
                MessageBox.Show("Provided email is not in valid formate, please retry!");
                return;
            }

            empAddContext.gender = comboBox1.Text;
            empAddContext.status = comboBox2.Text;
            await commandInvoker.InvokeAsync(caller.Tag.ToString(), caller.Name.ToString());

            dataGridView1.DataSource = employeeViewModel.Employees;
            if (employeeViewModel.Employees.Count > 0)
            {
                empNameTxtBox.Text  = string.Empty;
                empEmailTxtBox.Text = string.Empty;
            }
            else
            {
                ErrorLabel.Text = "There has been some issue in saving the data, please read the log";
            }
        }
Esempio n. 2
0
        public async Task Post(CommandDto commandDto)
        {
            _logger.LogInformation($"Started to execute command:{commandDto.CommandName}, for device:{commandDto.DeviceName}");

            await _commandInvoker.InvokeAsync(commandDto.CommandName, commandDto.DeviceName);

            _logger.LogInformation($"Command executed");
        }