public bool AnularDB(fa_Equipo_graf_Info Info, ref string mensaje) { try { using (EntitiesFacturacion_Grafinpren Context = new EntitiesFacturacion_Grafinpren()) { fa_Equipo_graf contact = Context.fa_Equipo_graf.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdEquipo == Info.IdEquipo); if (contact != null) { contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; contact.Fecha_UltAnu = Info.Fecha_UltAnu; contact.MotivoAnulacion = Info.MotivoAnulacion; contact.estado = false; 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 GuardarDB(fa_Equipo_graf_Info Info, ref int IdEquipo, ref string mensaje) { try { IdEquipo = Get_Id(Info.IdEmpresa, ref mensaje); using (EntitiesFacturacion_Grafinpren Context = new EntitiesFacturacion_Grafinpren()) { fa_Equipo_graf contact = new fa_Equipo_graf(); contact.IdEmpresa = Info.IdEmpresa; contact.IdEquipo = Info.IdEquipo = IdEquipo; contact.nom_Equipo = Info.nom_Equipo; contact.estado = Info.estado; contact.IdUsuario = Info.IdUsuario; contact.Fecha_Transaccion = Info.Fecha_Transaccion; contact.nom_pc = Info.nom_pc; contact.ip = Info.ip; Context.fa_Equipo_graf.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 Boolean GrabarDB(fa_factura_graf_Info info, decimal id, ref string msg) { try { using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren()) { fa_factura_graf address = new fa_factura_graf(); address.IdEmpresa = info.IdEmpresa; address.IdSucursal = info.IdSucursal; address.IdBodega = info.IdBodega; address.IdCbteVta = (info.IdCbteVta == 0) ? id : info.IdCbteVta; address.num_op = info.num_op; address.fecha_op = info.fecha_op; address.num_cotizacion = info.num_cotizacion; address.fecha_cotizacion = info.fecha_cotizacion; address.IdEquipo = info.IdEquipo; address.porc_comision = info.porc_comision; context.fa_factura_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()); } }
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_notaCreDeb_graf_Info info, ref string msg) { try { Boolean res = false; using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren()) { var contact = context.fa_notaCreDeb_graf.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdSucursal == info.IdSucursal && minfo.IdBodega == info.IdBodega && minfo.IdNota == info.IdNota); if (contact == null) //no hay datos en la base hay q grabar { fa_notaCreDeb_graf address = new fa_notaCreDeb_graf(); address.IdEmpresa = info.IdEmpresa; address.IdSucursal = info.IdSucursal; address.IdBodega = info.IdBodega; address.IdNota = info.IdNota; address.num_op = info.num_op; address.fecha_op = info.fecha_op; address.num_cotizacion = info.num_cotizacion; address.fecha_cotizacion = info.fecha_cotizacion; address.IdEquipo = info.IdEquipo; address.porc_comision = info.porc_comision; context.fa_notaCreDeb_graf.Add(address); context.SaveChanges(); res = true; } else { res = ModificarDB(info, ref msg); } } return(res); } 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 ModificarDB(fa_factura_graf_Info info, ref string msg) { try { using (EntitiesFacturacion_Grafinpren context = new EntitiesFacturacion_Grafinpren()) { var contact = context.fa_factura_graf.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdSucursal == info.IdSucursal && obj.IdBodega == info.IdBodega && obj.IdCbteVta == info.IdCbteVta); if (contact != null) { contact.num_op = info.num_op; contact.fecha_op = info.fecha_op; contact.num_cotizacion = info.num_cotizacion; contact.fecha_cotizacion = info.fecha_cotizacion; contact.IdEquipo = info.IdEquipo; contact.porc_comision = info.porc_comision; context.SaveChanges(); } else { decimal id = 0; GrabarDB(info, id, ref mensaje); } } 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()); } }