public bool guardarDB(tb_sis_Impuesto_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_sis_Impuesto Entity = new tb_sis_Impuesto
             {
                 IdCod_Impuesto = info.IdCod_Impuesto,
                 IdTipoImpuesto = info.IdTipoImpuesto,
                 nom_impuesto   = info.nom_impuesto,
                 estado         = info.estado = true,
                 IdCodigo_SRI   = info.IdCodigo_SRI,
                 porcentaje     = info.porcentaje
             };
             Context.tb_sis_Impuesto.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
 public tb_sis_Impuesto_Info get_info(string IdCod_Impuesto = "")
 {
     try
     {
         tb_sis_Impuesto_Info info = new tb_sis_Impuesto_Info();
         using (Entities_general Context = new Entities_general())
         {
             tb_sis_Impuesto Entity = Context.tb_sis_Impuesto.FirstOrDefault(q => q.IdCod_Impuesto == IdCod_Impuesto);
             if (Entity == null)
             {
                 return(null);
             }
             info = new tb_sis_Impuesto_Info
             {
                 IdCod_Impuesto = Entity.IdCod_Impuesto,
                 IdTipoImpuesto = Entity.IdTipoImpuesto,
                 nom_impuesto   = Entity.nom_impuesto,
                 porcentaje     = Entity.porcentaje,
                 IdCodigo_SRI   = Entity.IdCodigo_SRI,
                 estado         = Entity.estado
             };
         } return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public bool modificarDB(tb_sis_Impuesto_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_sis_Impuesto Entity = Context.tb_sis_Impuesto.FirstOrDefault(q => q.IdCod_Impuesto == info.IdCod_Impuesto);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.IdTipoImpuesto = info.IdTipoImpuesto;
                    Entity.nom_impuesto   = info.nom_impuesto;
                    Entity.porcentaje     = info.porcentaje;
                    Entity.IdCodigo_SRI   = info.IdCodigo_SRI;

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public bool anularDB(tb_sis_Impuesto_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_sis_Impuesto Entity = Context.tb_sis_Impuesto.FirstOrDefault(q => q.IdCod_Impuesto == info.IdCod_Impuesto);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.estado = info.estado = false;
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #5
0
        public Boolean GrabarDB(tb_sis_impuesto_Info Info, ref string msg)
        {
            try
            {
                Boolean resultado = false;
                using (EntitiesGeneral context = new EntitiesGeneral())
                {
                    var address = new tb_sis_Impuesto();

                    address.IdCod_Impuesto   = Info.IdCod_Impuesto;
                    address.nom_impuesto     = Info.nom_impuesto;
                    address.Usado_en_Ventas  = Info.Usado_en_Ventas;
                    address.Usado_en_Compras = Info.Usado_en_Compras;
                    address.porcentaje       = Info.porcentaje;
                    address.IdCodigo_SRI     = Info.IdCodigo_SRI;
                    address.estado           = true;
                    address.IdTipoImpuesto   = Info.IdTipoImpuesto;


                    context.tb_sis_Impuesto.Add(address);
                    context.SaveChanges();
                    msg       = "Se ha procedido grabar el Banco #: " + address.IdCod_Impuesto.ToString() + " exitosamente.";
                    resultado = true;
                }
                return(resultado);
            }
            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() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }