public bool modificarDB(fa_proforma_det_Info info) { try { using (Entities_facturacion Context = new Entities_facturacion()) { fa_proforma_det Entity = Context.fa_proforma_det.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdProforma == info.IdProforma).FirstOrDefault(); if (Entity == null) { return(false); } Entity.NumCotizacion = info.NumCotizacion; Entity.NumOPr = info.NumOPr; Entity.IdCentroCosto = info.IdCentroCosto; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool anular_detalle(List <fa_proforma_det_Info> lista) { try { using (EntitiesFacturacion Context = new EntitiesFacturacion()) { foreach (var item in lista) { fa_proforma_det Entity = Context.fa_proforma_det.Where(q => q.IdEmpresa == item.IdEmpresa && q.IdProforma == item.IdProforma && q.Secuencia == item.Secuencia).FirstOrDefault(); if (Entity != null) { Entity.anulado = true; Context.SaveChanges(); } } } return(false); } catch (Exception ex) { string mensaje = ""; string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool guardarDB(List <fa_proforma_det_Info> lista) { try { using (EntitiesFacturacion Context = new EntitiesFacturacion()) { int sec = 1; foreach (var item in lista) { fa_proforma_det Entity = new fa_proforma_det { IdEmpresa = item.IdEmpresa, IdSucursal = item.IdSucursal, IdProforma = item.IdProforma, Secuencia = item.Secuencia = sec++, IdProducto = item.IdProducto, pd_cantidad = item.pd_cantidad, pd_precio = item.pd_precio, pd_por_descuento_uni = item.pd_por_descuento_uni, pd_descuento_uni = item.pd_descuento_uni, pd_precio_final = item.pd_precio_final, pd_subtotal = item.pd_subtotal, IdCod_Impuesto = item.IdCod_Impuesto, pd_por_iva = item.pd_por_iva, pd_iva = item.pd_iva, pd_total = item.pd_total, anulado = item.anulado }; Context.fa_proforma_det.Add(Entity); } Context.SaveChanges(); } return(true); } catch (Exception ex) { string mensaje = ""; string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }