public void guardar() { if (UIID.Text == "") { try { FAC_LISTA_PRECIO m = new FAC_LISTA_PRECIO { ID = 0, DS_LISTA = UIDS_LISTA.Text, ID_EMPRESA = _datasistema.empresa.ID }; _datasistema.ContextoVentas.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues); _datasistema.ContextoVentas.FAC_LISTA_PRECIO.InsertOnSubmit(m); _datasistema.ContextoVentas.SubmitChanges(); consultar(); MetodosForm.seleccionarFila(uigridview, "ID", m.ID); } catch (Exception e) { MetodosForm.mensajeErrorDefault(e.Message, _datasistema); } } else { try { FAC_LISTA_PRECIO m = (from u in _datasistema.ContextoVentas.FAC_LISTA_PRECIO where u.ID == int.Parse(UIID.Text) select u).First(); { m.DS_LISTA = UIDS_LISTA.Text; _datasistema.ContextoVentas.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues); _datasistema.ContextoVentas.SubmitChanges(); consultar(); MetodosForm.seleccionarFila(uigridview, "ID", m.ID); } } catch (Exception e) { MetodosForm.mensajeErrorDefault(e.Message, _datasistema); } } }
public void eliminar() { try { FAC_LISTA_PRECIO m = (from u in _datasistema.ContextoVentas.FAC_LISTA_PRECIO where u.ID == int.Parse(UIID.Text) select u).First(); _datasistema.ContextoVentas.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues); _datasistema.ContextoVentas.FAC_LISTA_PRECIO.DeleteOnSubmit(m); _datasistema.ContextoVentas.SubmitChanges(); consultar(); } catch (Exception e) { MetodosForm.mensajeErrorDefault(e.Message, _datasistema); } }