public bool AnularDB(fa_grupo_x_sub_centro_costo_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_grupo_x_sub_centro_costo contact = Context.fa_grupo_x_sub_centro_costo.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdGrupo == Info.IdGrupo); 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 ModificarDB(fa_grupo_x_sub_centro_costo_Info Info, ref string mensaje) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_grupo_x_sub_centro_costo contact = Context.fa_grupo_x_sub_centro_costo.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdGrupo == Info.IdGrupo); if (contact != null) { contact.IdEmpresa = Info.IdEmpresa; contact.IdGrupo = Info.IdGrupo; contact.IdCentroCosto = Info.IdCentroCosto; contact.nom_Grupo = Info.nom_Grupo; contact.Fecha = Info.Fecha; contact.Estado = Info.Estado; contact.IdUsuarioUltModi = Info.IdUsuarioUltMod; contact.Fecha_UltMod = DateTime.Now; contact.nom_pc = Info.nom_pc; contact.ip = Info.ip; contact.Observacion = Info.Observacion; contact.IdProducto = Info.IdProducto; Context.SaveChanges(); } } oData_Det.EliminarDB(Info, ref mensaje); foreach (var item in Info.List_Detalle) { item.IdEmpresa = Info.IdEmpresa; item.IdGrupo = Info.IdGrupo; item.IdCentroCosto = Info.IdCentroCosto; } oData_Det.GuardarDB(Info.List_Detalle, 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool GuardarDB(fa_grupo_x_sub_centro_costo_Info Info, ref decimal IdGrupo, ref string mensaje) { try { IdGrupo = Get_Id(Info.IdEmpresa, ref mensaje); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_grupo_x_sub_centro_costo contact = new fa_grupo_x_sub_centro_costo(); contact.IdEmpresa = Info.IdEmpresa; contact.IdGrupo = Info.IdGrupo = IdGrupo; contact.IdCentroCosto = Info.IdCentroCosto; contact.nom_Grupo = Info.nom_Grupo; contact.Fecha = Info.Fecha; contact.Estado = Info.Estado; contact.IdUsuario = Info.IdUsuario; contact.Fecha_Transaccion = Info.Fecha_Transaccion; contact.nom_pc = Info.nom_pc; contact.ip = Info.ip; contact.Observacion = Info.Observacion; contact.IdProducto = Info.IdProducto; Context.fa_grupo_x_sub_centro_costo.Add(contact); Context.SaveChanges(); } foreach (var item in Info.List_Detalle) { item.IdEmpresa = Info.IdEmpresa; item.IdGrupo = Info.IdGrupo; item.IdCentroCosto = Info.IdCentroCosto; } oData_Det.GuardarDB(Info.List_Detalle, 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }