public com_estado_cierre_Info get_info(string IdEstado_cierre) { try { com_estado_cierre_Info info = new com_estado_cierre_Info(); using (Entities_compras Context = new Entities_compras()) { com_estado_cierre Entity = Context.com_estado_cierre.Where(q => q.IdEstado_cierre == IdEstado_cierre).FirstOrDefault(); if (Entity == null) { return(null); } info = new com_estado_cierre_Info { IdEstado_cierre = Entity.IdEstado_cierre, Descripcion = Entity.Descripcion, estado = Entity.estado }; } return(info); } catch (Exception) { throw; } }
public bool modificarDB(com_estado_cierre_Info info) { try { using (Entities_compras Context = new Entities_compras()) { com_estado_cierre Entity = Context.com_estado_cierre.Where(q => q.IdEstado_cierre == info.IdEstado_cierre).FirstOrDefault(); if (Entity == null) { return(false); } Entity.Descripcion = info.Descripcion; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Entity.Fecha_UltMod = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GrabarDB(com_estado_cierre_Info Info, ref string msg) { try { using (EntitiesCompras DBCom = new EntitiesCompras()) { var que = from C in DBCom.com_estado_cierre where C.IdEstado_cierre == Info.IdEstado_cierre select C; if (que.Count() == 0) { var TablaDb = new com_estado_cierre(); TablaDb.IdEstado_cierre = Info.IdEstado_cierre; TablaDb.Descripcion = Info.Descripcion; TablaDb.estado = Info.estado; TablaDb.IdUsuarioUltMod = Info.IdUsuarioUltMod; TablaDb.Fecha_Transac = Info.Fecha_Transac; DBCom.com_estado_cierre.Add(TablaDb); DBCom.SaveChanges(); } else { msg = "Error en el ingreso; código Existente"; return(false); } } 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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool guardarDB(com_estado_cierre_Info info) { try { using (Entities_compras Context = new Entities_compras()) { com_estado_cierre Entity = new com_estado_cierre { IdEstado_cierre = info.IdEstado_cierre, Descripcion = info.Descripcion, estado = "A", Fecha_Transac = DateTime.Now }; Context.com_estado_cierre.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool anularDB(com_estado_cierre_Info info) { try { using (Entities_compras Context = new Entities_compras()) { com_estado_cierre Entity = Context.com_estado_cierre.Where(q => q.IdEstado_cierre == info.IdEstado_cierre).FirstOrDefault(); if (Entity == null) { return(false); } Entity.estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.FechaHoraAnul = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }