private void getDatos(VISTA.VDialog_Empresa vdialog, bool edit) { DataRowView Rows = vdialog.cmbDireccion.SelectedItem as DataRowView; var id = Rows.Row[0].ToString(); vdialog.cmbDireccion.SelectedValuePath = id; if (edit == false) { this.voempresa.ID = 0; } else { this.voempresa.ID = int.Parse(vdialog.txtId.Text); } //this.voempresa.NOMBRE = vdialog.txtNombre.Text; this.voempresa.RFC = vdialog.txtRFC.Text; this.voempresa.RAZONSOCIAL = vdialog.txtRazonSocial.Text; this.voempresa.NOMBRECOMERCIAL = vdialog.txtNombreComercial.Text; this.voempresa.CURP = vdialog.txtCURP.Text; this.voempresa.DIRECCIONFISCAL = int.Parse(vdialog.cmbDireccion.SelectedValuePath); //this.voempresa.PAIS = vdialog.txtPais.Text; //this.voempresa.ESTADO = vdialog.txtEstado.Text; //this.voempresa.MUNICIPIO = vdialog.txtMunicipio.Text; this.daoempresa = new MODELO.DAO_Empresa(voempresa); }
private void Editar_Click(object sender, RoutedEventArgs e) { DataRowView Rows = this.vempresa.DgvPlantilla.SelectedItem as DataRowView; VISTA.VDialog_Empresa vdialog = new VISTA.VDialog_Empresa(); C_DialogEmpresa cdialog = new C_DialogEmpresa(vdialog); vdialog.txtId.Text = Rows.Row[0].ToString(); /*vdialog.txtNombre.Text = Rows.Row[1].ToString();*/ vdialog.txtRFC.Text = Rows.Row[1].ToString(); vdialog.txtRazonSocial.Text = Rows.Row[2].ToString(); vdialog.txtNombreComercial.Text = Rows.Row[3].ToString(); vdialog.txtCURP.Text = Rows.Row[4].ToString(); vdialog.cmbDireccion.SelectedValuePath = Rows.Row[5].ToString(); //vdialog.txtPais.Text = Rows.Row[7].ToString(); //vdialog.txtEstado.Text = Rows.Row[8].ToString(); //vdialog.txtMunicipio.Text = Rows.Row[9].ToString(); cdialog.FormLoad(); if (vdialog.DialogResult == true) { getDatos(vdialog, true); if (daoempresa.Editar().Equals(1)) { MessageBox.Show(":)"); Reload(); } else { MessageBox.Show(":("); } } }
private void Nuevo_Click(object sender, RoutedEventArgs e) { VISTA.VDialog_Empresa vdialog = new VISTA.VDialog_Empresa(); C_DialogEmpresa cdialog = new C_DialogEmpresa(vdialog); cdialog.FormLoad(); if (vdialog.DialogResult == true) { getDatos(vdialog, false); if (daoempresa.Insertar().Equals(1)) { MessageBox.Show(":)"); Reload(); } else { MessageBox.Show(":("); } } }