private void btnEditar_Click(object sender, RoutedEventArgs e) { DataRowView Rows = this.vsucursal.DgvPlantilla.SelectedItem as DataRowView; VISTA.VDialog_Sucursal vdialog = new VISTA.VDialog_Sucursal(); C_DialogSucursal cdialog = new C_DialogSucursal(vdialog); vdialog.txtIdSucursal.Text = Rows.Row[0].ToString(); vdialog.cmbEmpresa.SelectedValuePath = Rows.Row[1].ToString(); vdialog.txtNombreSucursal.Text = Rows.Row[2].ToString(); vdialog.txtCodigo.Text = Rows.Row[3].ToString(); vdialog.cmbDireccion.SelectedValuePath = Rows.Row[4].ToString(); //vdialog.txtCodigoPostal.Text = Rows.Row[4].ToString(); //vdialog.txtPais.Text = Rows.Row[5].ToString(); //vdialog.txtMunicipio.Text = Rows.Row[6].ToString(); //vdialog.txtColonia.Text = Rows.Row[7].ToString(); //vdialog.txtCalle.Text = Rows.Row[8].ToString(); //vdialog.txtNExterior.Text = Rows.Row[9].ToString(); //vdialog.txtNInterior.Text = Rows.Row[10].ToString(); cdialog.FormLoad(); if (vdialog.DialogResult == true) { getDatos(vdialog, true); if (daosucursal.Editar().Equals(1)) { MessageBox.Show(":)"); Reload(); } else { MessageBox.Show(":("); } } }
private void btnNuevo_Click(object sender, RoutedEventArgs e) { VISTA.VDialog_Sucursal vdialog = new VISTA.VDialog_Sucursal(); C_DialogSucursal cdialog = new C_DialogSucursal(vdialog); cdialog.FormLoad(); if (vdialog.DialogResult == true) { getDatos(vdialog, false); if (daosucursal.Insertar().Equals(1)) { MessageBox.Show(":)"); Reload(); } else { MessageBox.Show(":("); } } }