private void BtnInsert_Click(object sender, EventArgs e) { DetalleReferencia detref = new DetalleReferencia(); if (TxtRoyoPeso.Value != 0 || TxtRoyoCant.Value != 0 || !String.IsNullOrWhiteSpace(TxtDescripcion.Text)) { detref.cantRoyo = Convert.ToInt32(TxtRoyoCant.Text); detref.pesoRoyo = Convert.ToInt32(TxtRoyoPeso.Text); detref.descripcionDis = TxtDescripcion.Text; //detref.fotoDesign = PBColor.ImageLocation; TxtRoyoPeso.Value = 0; TxtDescripcion.Clear(); TxtRoyoCant.Value = 0; stock.cantRoyo = detref.cantRoyo; stock.inStock = true; FrmChooseArea frmChoose = new FrmChooseArea(); frmChoose.FrmChooseArea_Load(sender, e, stock); frmChoose.ShowDialog(); bool IsCanceled = FrmChooseArea.IsCancelled; if (IsCanceled == false) { listDetalle.Add(detref); DGVStock.DataSource = listDetalle; } } else { MessageBox.Show("Por favor complete todos los campos"); } }
private void BtnEliminiar_Click(object sender, EventArgs e) { if (listDetalle.Count >= 1) { DGVStock.Rows[0].Selected = true; DetalleReferencia dstock = (DetalleReferencia)DGVStock.CurrentRow.DataBoundItem; listDetalle.Remove(dstock); DGVStock.DataSource = listDetalle; } }
public void Insert(DetalleReferencia detalleref) { context.DetalleReferencias.InsertOnSubmit(detalleref); context.SubmitChanges(); }