private void dgvList_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { if (e.StateChanged != DataGridViewElementStates.Selected) { return; } if (dgvList.SelectedRows.Count != 0) { try { DataGridViewRow row = this.dgvList.SelectedRows[0]; one = (InvCategoria)row.DataBoundItem; } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this.MdiParent, ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } btnEdit.Visible = true; } else { btnEdit.Visible = false; } }
private void btnAdd_Click(object sender, EventArgs e) { InvCategoria _one = new InvCategoria(); _one = srv.GetOne(Globals.logEmpresa.id, "0"); frmInvCategoriasDetail fDetalle = new frmInvCategoriasDetail(_one); if (ConfigUI.LaunchDialogForm(fDetalle) == DialogResult.OK) { GetList(); MetroFramework.MetroMessageBox.Show(this.MdiParent, "Registro agregado con éxito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public frmInvCategoriasDetail(InvCategoria obj) { InitializeComponent(); Console.WriteLine("Globals.logUser.nombre: ", Globals.logUser.nombre); Console.WriteLine(""); Console.WriteLine("Globals.logEmpresa.monedas: ", Globals.logEmpresa.monedas); _listaCategorias = srv.GetList(Globals.logEmpresa.id); _listaCategorias.Insert(0, new InvCategoria { nombre = "PRINCIPAL", id = "00000000000000000000000000000000" }); cmbCategoria.DataSource = _listaCategorias; cmbCategoria.DisplayMember = "nombre"; cmbCategoria.ValueMember = "id"; one = obj; lblTitle.Text = obj.nombre; cmbCategoria.DataBindings.Add("SelectedValue", one, "id_padre"); txtNombre.DataBindings.Add("Text", one, "nombre", true, DataSourceUpdateMode.OnPropertyChanged); txtDescripcion.DataBindings.Add("Text", one, "descrip", true, DataSourceUpdateMode.OnPropertyChanged); }
public string SetOne(InvCategoria one) { string _id = srv.SetOne(one); return(_id); }
public InvCategoria GetOne(string idEmpresa, string id) { InvCategoria _one = srv.GetOne(idEmpresa, id); return(_one); }