public Boolean AnularDB(fa_registro_unidades_x_equipo_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_registro_unidades_x_equipo Entity = Context.fa_registro_unidades_x_equipo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRegistro == info.IdRegistro); if (Entity != null) { Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = info.Fecha_UltAnu; Entity.MotiAnula = info.MotiAnula; Entity.nom_pc = info.nom_pc; Entity.ip = info.ip; Entity.Estado = "I"; Entity.estado_cierre = true; 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(fa_registro_unidades_x_equipo_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_registro_unidades_x_equipo Entity = new fa_registro_unidades_x_equipo(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdRegistro = info.IdRegistro = Get_Id(info.IdEmpresa); Entity.IdPeriodo = info.IdPeriodo; Entity.Fecha = info.Fecha; Entity.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo; Entity.Observacion = info.Observacion; Entity.nom_pc = info.nom_pc; Entity.ip = info.ip; Entity.IdCentroCosto = info.IdCentroCosto; Entity.Estado = "A"; Entity.estado_cierre = info.estado_cierre; Context.fa_registro_unidades_x_equipo.Add(Entity); Context.SaveChanges(); if (info.Lst_det != null) { foreach (var item in info.Lst_det) { item.IdEmpresa = info.IdEmpresa; item.IdRegistro = info.IdRegistro; item.IdUnidad_Medida = " "; item.IdTipo_Reg_cat = " "; } oData_det.GuardarDB(info.Lst_det); } } 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public fa_registro_unidades_x_equipo_Info Get_Info(int idEmpresa, decimal IdRegistro) { try { fa_registro_unidades_x_equipo_Info info = new fa_registro_unidades_x_equipo_Info(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_registro_unidades_x_equipo Entity = Context.fa_registro_unidades_x_equipo.FirstOrDefault(q => idEmpresa == q.IdEmpresa && IdRegistro == q.IdRegistro); if (Entity != null) { info.IdEmpresa = Entity.IdEmpresa; info.IdRegistro = Entity.IdRegistro; info.IdPeriodo = Entity.IdPeriodo; info.Fecha = Entity.Fecha; info.IdCentroCosto = Entity.IdCentroCosto; info.IdCentroCosto_sub_centro_costo = Entity.IdCentroCosto_sub_centro_costo; info.IdPeriodo = Entity.IdPeriodo; info.Observacion = Entity.Observacion; info.IdUsuarioUltMod = Entity.IdUsuarioUltMod; info.Fecha_UltMod = Entity.Fecha_UltMod; info.IdUsuarioUltAnu = Entity.IdUsuarioUltAnu; info.Fecha_UltAnu = Entity.Fecha_UltAnu; info.MotiAnula = Entity.MotiAnula; info.nom_pc = Entity.nom_pc; info.ip = Entity.ip; info.Estado = Entity.Estado; info.estado_cierre = Entity.estado_cierre; info.Estado = Entity.Estado; info.Lst_det = oData_det.Get_List_det(info); } } return(info); } 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(fa_registro_unidades_x_equipo_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_registro_unidades_x_equipo Entity = Context.fa_registro_unidades_x_equipo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRegistro == info.IdRegistro); if (Entity != null) { Entity.Fecha = info.Fecha; Entity.Observacion = info.Observacion; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Entity.Fecha_UltMod = info.Fecha_UltMod; Entity.nom_pc = info.nom_pc; Entity.ip = info.ip; Entity.estado_cierre = info.estado_cierre; Context.SaveChanges(); foreach (var item in info.Lst_det) { item.IdEmpresa = info.IdEmpresa; item.IdRegistro = info.IdRegistro; item.IdUnidad_Medida = " "; item.IdTipo_Reg_cat = " "; item.IdPeriodo = info.IdPeriodo; } oData_det.EliminarDB(info); oData_det.GuardarDB(info.Lst_det); } } 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }