Esempio n. 1
0
 public ba_tipo_nota_Info get_info(int IdEmpresa, int IdTipoNota)
 {
     try
     {
         ba_tipo_nota_Info info = new ba_tipo_nota_Info();
         using (Entities_banco Context = new Entities_banco())
         {
             ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdTipoNota == IdTipoNota);
             if (Entity == null)
             {
                 return(null);
             }
             info = new ba_tipo_nota_Info
             {
                 IdEmpresa     = Entity.IdEmpresa,
                 IdTipoNota    = Entity.IdTipoNota,
                 IdCentroCosto = Entity.IdCentroCosto,
                 IdCtaCble     = Entity.IdCtaCble,
                 Descripcion   = Entity.Descripcion,
                 Estado        = Entity.Estado,
                 Tipo          = Entity.Tipo
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
 public bool guardarDB(ba_tipo_nota_Info info)
 {
     try
     {
         using (Entities_banco Context = new Entities_banco())
         {
             ba_tipo_nota Entity = new ba_tipo_nota
             {
                 IdEmpresa     = info.IdEmpresa,
                 IdTipoNota    = info.IdTipoNota = get_id(info.IdEmpresa),
                 IdCentroCosto = info.IdCentroCosto,
                 IdCtaCble     = info.IdCtaCble,
                 Descripcion   = info.Descripcion,
                 Estado        = info.Estado = "A",
                 Tipo          = info.Tipo
             };
             Context.ba_tipo_nota.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        public bool modificarDB(ba_tipo_nota_Info info)
        {
            try
            {
                using (Entities_banco Context = new Entities_banco())
                {
                    ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoNota == info.IdTipoNota);
                    if (Entity == null)
                    {
                        return(false);
                    }

                    Entity.Descripcion = info.Descripcion;
                    Entity.Tipo        = info.Tipo;
                    Entity.IdCtaCble   = info.IdCtaCble;

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
 public Boolean GuardarDB(ba_tipo_nota_Info Info)
 {
     try
     {
         EntitiesBanco context = new EntitiesBanco();
         var           address = new ba_tipo_nota();
         address.IdEmpresa     = Info.IdEmpresa;
         address.IdTipoNota    = Info.IdTipoNota = GetId(Info.IdEmpresa);
         address.Tipo          = Info.Tipo;
         address.Descripcion   = Info.Descripcion;
         address.IdCtaCble     = Info.IdCtaCble;
         address.IdCentroCosto = Info.IdCentroCosto;
         address.Estado        = Info.Estado;
         context.ba_tipo_nota.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());
     }
 }
Esempio n. 5
0
        public bool anularDB(ba_tipo_nota_Info info)
        {
            try
            {
                using (Entities_banco Context = new Entities_banco())
                {
                    ba_tipo_nota Entity = Context.ba_tipo_nota.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoNota == info.IdTipoNota);
                    if (Entity == null)
                    {
                        return(false);
                    }

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

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }