public bool GuardarDB(fa_liquidacion_gastos_producto_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos_producto contact = new fa_liquidacion_gastos_producto(); contact.IdEmpresa = Info.IdEmpresa; if (Info.IdProducto_Liqui == 0) { contact.IdProducto_Liqui = getId(Info.IdEmpresa); } else { contact.IdProducto_Liqui = Info.IdProducto_Liqui; } contact.nom_producto_Liqui = Info.nom_producto_Liqui; contact.estado = Info.estado; contact.IdProducto = Info.IdProducto; Context.fa_liquidacion_gastos_producto.Add(contact); Context.SaveChanges(); } return(true); } catch (Exception ex) { 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 AnularDB(fa_liquidacion_gastos_producto_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_liquidacion_gastos_producto contact = Context.fa_liquidacion_gastos_producto.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdProducto_Liqui == Info.IdProducto_Liqui); if (contact != null) { contact.estado = "I"; Context.SaveChanges(); } } return(true); } catch (Exception ex) { 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()); } }