示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AgregarCliente aCliente = new AgregarCliente();

            if (btnAltoContraste.Background == Brushes.Gray)
            {
                aCliente.btnAltoContraste_Click(null, null);
            }
            aCliente.Show();
            this.Close();
        }
        private void tablaListarCliente_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var grid     = sender as DataGrid;
            var selected = grid.SelectedItems;

            // ... Add all Names to a List.
            string rut = "";

            foreach (var item in selected)
            {
                var cliente = item as ModeloCliente;
                if (cliente != null)
                {
                    try
                    {
                        rut = cliente.RutCliente;
                        ControladorCliente.CargarDatosAsociados(rut);
                        AgregarCliente aCliente = new AgregarCliente();
                        aCliente.txtRut.Text                  = rut;
                        aCliente.txtRazonSocial.Text          = ModeloCliente.baseCliente[0];
                        aCliente.txtNombreContacto.Text       = ModeloCliente.baseCliente[1];
                        aCliente.txtMailContacto.Text         = ModeloCliente.baseCliente[2];
                        aCliente.txtDireccion.Text            = ModeloCliente.baseCliente[3];
                        aCliente.txtTelefono.Text             = ModeloCliente.baseCliente[4];
                        aCliente.comboActividad.SelectedIndex = int.Parse(ModeloCliente.baseCliente[5]);
                        string empresa = ModeloCliente.baseCliente[6];
                        aCliente.comboEmpresa.SelectedIndex = int.Parse(empresa[0].ToString());

                        ModeloCliente.baseCliente.Clear();
                        aCliente.Show();
                        this.Close();
                        break;
                    }
                    catch
                    {
                        dialogSeleccionErronea.IsEnabled = true;
                        dialogSeleccionErronea.IsOpen    = true;
                    }
                }
                else
                {
                    break;
                }
            }
        }