Exemplo n.º 1
0
        public Boolean GuardarDB(com_Catalogo_Info Info)
        {
            try
            {
                using (EntitiesCompras Context = new EntitiesCompras())
                {
                    var Address = new com_catalogo();
                    Address.IdCatalogocompra = Info.IdCatalogocompra;

                    Address.IdCatalogocompra_tipo = Info.IdCatalogocompra_tipo;
                    Address.Nombre    = Info.Nombre;
                    Address.Estado    = "A";
                    Address.Orden     = Info.orden;
                    Address.IdUsuario = Info.IdUsuario;
                    Address.nom_pc    = Info.nom_pc;
                    Address.ip        = Info.ip;
                    Context.com_catalogo.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);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Exemplo n.º 2
0
 public com_catalogo_Info get_info(string IdCatalogocompra_tipo, string IdCatalogocompra)
 {
     try
     {
         com_catalogo_Info info = new com_catalogo_Info();
         using (Entities_compras Context = new Entities_compras())
         {
             com_catalogo Entity = Context.com_catalogo.Where(q => q.IdCatalogocompra_tipo == IdCatalogocompra_tipo && q.IdCatalogocompra == IdCatalogocompra).FirstOrDefault();
             if (Entity == null)
             {
                 return(null);
             }
             info = new com_catalogo_Info
             {
                 IdCatalogocompra_tipo = Entity.IdCatalogocompra_tipo,
                 IdCatalogocompra      = Entity.IdCatalogocompra,
                 Nombre       = Entity.Nombre,
                 CodCatalogo  = Entity.CodCatalogo,
                 Estado       = Entity.Estado,
                 Abrebiatura  = Entity.Abrebiatura,
                 Orden        = Entity.Orden,
                 NombreIngles = Entity.NombreIngles
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public bool modificarDB(com_catalogo_Info info)
        {
            try
            {
                using (Entities_compras Context = new Entities_compras())
                {
                    com_catalogo Entity = Context.com_catalogo.Where(q => q.IdCatalogocompra_tipo == info.IdCatalogocompra_tipo && q.IdCatalogocompra == info.IdCatalogocompra).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.CodCatalogo = info.CodCatalogo;
                    Entity.Nombre      = info.Nombre;
                    Entity.Abrebiatura = info.Abrebiatura;
                    Entity.Orden       = info.Orden;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.FechaUltMod     = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public bool anularDB(com_catalogo_Info info)
        {
            try
            {
                using (Entities_compras Context = new Entities_compras())
                {
                    com_catalogo Entity = Context.com_catalogo.Where(q => q.IdCatalogocompra_tipo == info.IdCatalogocompra_tipo && q.IdCatalogocompra == info.IdCatalogocompra).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Estado = info.Estado = "I";

                    Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    Entity.Fecha_UltAnu    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 5
0
        public bool guardarDB(com_catalogo_Info info)
        {
            try
            {
                using (Entities_compras Context = new Entities_compras())
                {
                    com_catalogo Entity = new com_catalogo
                    {
                        IdCatalogocompra_tipo = info.IdCatalogocompra_tipo,
                        IdCatalogocompra      = info.IdCatalogocompra,
                        CodCatalogo           = info.CodCatalogo,
                        Nombre       = info.Nombre,
                        Abrebiatura  = info.Abrebiatura,
                        NombreIngles = info.NombreIngles,
                        Estado       = info.Estado = "A",

                        IdUsuario = info.IdUsuario
                    };
                    Context.com_catalogo.Add(Entity);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }