public Boolean ModificarDB(fa_guia_remision_graf_Info info, ref string msg) { try { using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren()) { var contact = context.fa_guia_remision_graf.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdGuiaRemision == info.IdGuiaRemision); if (contact != null) { contact.fecha_Cotizacion = info.fecha_Cotizacion; contact.Num_Cotizacion = info.Num_Cotizacion; contact.Num_OP = info.Num_OP; contact.IdEquipo = info.IdEquipo; 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); msg = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(fa_guia_remision_graf_Info info, ref decimal id, ref string msg) { try { using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren()) { var address = new fa_guia_remision_graf(); address.IdEmpresa = info.IdEmpresa; address.IdSucursal = info.IdSucursal; address.IdBodega = info.IdBodega; address.IdGuiaRemision = (info.IdGuiaRemision == 0) ? id : info.IdGuiaRemision; address.fecha_Cotizacion = info.fecha_Cotizacion; address.Num_Cotizacion = info.Num_Cotizacion; address.Num_OP = info.Num_OP; address.IdEquipo = info.IdEquipo; context.fa_guia_remision_graf.Add(address); 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); msg = ex.ToString(); oDataLog.Guardar_Log_Error(Log_Error_sis, ref msg); throw new Exception(ex.ToString()); } }