Beispiel #1
0
        public bool guardarDB(fa_catalogo_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_catalogo Entity = new fa_catalogo
                    {
                        IdCatalogo_tipo = info.IdCatalogo_tipo,
                        IdCatalogo      = info.IdCatalogo,
                        Nombre          = info.Nombre,
                        Orden           = info.Orden,
                        Abrebiatura     = info.Abrebiatura,
                        Estado          = info.Estado = "A",

                        IdUsuario = info.IdUsuario
                    };
                    Context.fa_catalogo.Add(Entity);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
 public fa_catalogo_Info get_info(string IdCatalogo)
 {
     try
     {
         fa_catalogo_Info info;
         using (Entities_facturacion Context = new Entities_facturacion())
         {
             fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == IdCatalogo).FirstOrDefault();
             if (Entity == null)
             {
                 return(null);
             }
             info = new fa_catalogo_Info
             {
                 IdCatalogo_tipo = Entity.IdCatalogo_tipo,
                 IdCatalogo      = Entity.IdCatalogo,
                 Abrebiatura     = Entity.Abrebiatura,
                 Nombre          = Entity.Nombre,
                 Orden           = Entity.Orden,
                 Estado          = Entity.Estado
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #3
0
        public bool modificarDB(fa_catalogo_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == info.IdCatalogo).FirstOrDefault();
                    if (Entity == null)
                    {
                        return(false);
                    }

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

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.FechaUltMod     = DateTime.Now;

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public bool anularDB(fa_catalogo_Info info)
        {
            try
            {
                using (Entities_facturacion Context = new Entities_facturacion())
                {
                    fa_catalogo Entity = Context.fa_catalogo.Where(q => q.IdCatalogo == info.IdCatalogo).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;
            }
        }
Beispiel #5
0
        public Boolean GuardarDB(fa_catalogo_Info Info, ref string IdCatalogo, ref string msjError)
        {
            try
            {
                using (EntitiesFacturacion Context = new EntitiesFacturacion())
                {
                    var Address = new fa_catalogo();
                    Address.IdCatalogo      = IdCatalogo = GetId();
                    Address.IdCatalogo_tipo = Info.IdCatalogo_tipo;
                    Address.Nombre          = Info.Nombre;
                    Address.Estado          = Info.Estado;
                    Address.Orden           = Info.Orden;

                    Address.IdUsuario = Info.IdUsuario;
                    Address.nom_pc    = Info.nom_pc;
                    Address.ip        = Info.ip;

                    Context.fa_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);
                mensaje = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                msjError = mensaje;
                throw new Exception(ex.ToString());
            }
        }