Exemplo n.º 1
0
        public bool anularDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRetiroActivo == info.IdRetiroActivo);
                    if (Entity == null)
                    {
                        return(false);
                    }


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

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public bool guardarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = new Af_Retiro_Activo
                    {
                        IdEmpresa        = info.IdEmpresa,
                        Cod_Ret_Activo   = info.Cod_Ret_Activo,
                        Concepto_Retiro  = info.Concepto_Retiro,
                        Estado           = info.Estado = "A",
                        Fecha_Retiro     = info.Fecha_Retiro.Date,
                        IdActivoFijo     = info.IdActivoFijo,
                        IdCbteCble       = info.IdCbteCble,
                        IdEmpresa_ct     = info.IdEmpresa_ct,
                        IdTipoCbte       = info.IdTipoCbte,
                        IdRetiroActivo   = info.IdRetiroActivo = get_id(info.IdEmpresa),
                        NumComprobante   = info.NumComprobante,
                        ValorActivo      = info.ValorActivo,
                        Valor_Depre_Acu  = info.Valor_Depre_Acu,
                        Valor_Neto       = info.Valor_Neto,
                        Valor_Tot_Bajas  = info.Valor_Tot_Bajas,
                        Valor_Tot_Mejora = info.Valor_Tot_Mejora,

                        IdUsuario     = info.IdUsuario,
                        Fecha_Transac = DateTime.Now
                    };
                    Context.Af_Retiro_Activo.Add(Entity);

                    Af_Activo_fijo Entity_A = Context.Af_Activo_fijo.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdActivoFijo == info.IdActivoFijo).FirstOrDefault();
                    if (Entity_A == null)
                    {
                        return(false);
                    }
                    Entity_A.Estado_Proceso = "TIP_ESTADO_AF_RETIRO";

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                tb_LogError_Data LogData = new tb_LogError_Data();
                LogData.GuardarDB(new tb_LogError_Info {
                    Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Retiro_Activo_Data", Metodo = "guardarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
Exemplo n.º 3
0
        public Boolean GuardarDB(Af_Retiro_Activo_Info InfoAf, ref decimal IdRetiroActivo, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Retiro_Activo();

                    Address.IdEmpresa        = InfoAf.IdEmpresa;
                    Address.IdRetiroActivo   = InfoAf.IdRetiroActivo = IdRetiroActivo = getId(InfoAf.IdEmpresa);
                    Address.Cod_Ret_Activo   = (InfoAf.Cod_Ret_Activo == "" || InfoAf.Cod_Ret_Activo == null) ? "Retiro_" + InfoAf.IdRetiroActivo : InfoAf.Cod_Ret_Activo;
                    Address.IdActivoFijo     = InfoAf.IdActivoFijo;
                    Address.ValorActivo      = InfoAf.ValorActivo;
                    Address.Valor_Tot_Bajas  = InfoAf.Valor_Tot_Bajas;
                    Address.Valor_Tot_Mejora = InfoAf.Valor_Tot_Mejora;
                    Address.Valor_Depre_Acu  = InfoAf.Valor_Depre_Acu;
                    Address.Valor_Neto       = InfoAf.Valor_Neto;
                    Address.NumComprobante   = InfoAf.NumComprobante;
                    Address.Concepto_Retiro  = InfoAf.Concepto_Retiro;
                    Address.Fecha_Retiro     = InfoAf.Fecha_Retiro;
                    Address.IdUsuario        = InfoAf.IdUsuario;
                    Address.Fecha_Transac    = InfoAf.Fecha_Transac;
                    Address.nom_pc           = InfoAf.nom_pc;
                    Address.ip     = InfoAf.ip;
                    Address.Estado = InfoAf.Estado;

                    Context.Af_Retiro_Activo.Add(Address);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                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;
                msjError = mensaje;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Exemplo n.º 4
0
        public bool modificarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRetiroActivo == info.IdRetiroActivo);
                    if (Entity == null)
                    {
                        return(false);
                    }


                    Entity.Concepto_Retiro  = info.Concepto_Retiro;
                    Entity.Fecha_Retiro     = info.Fecha_Retiro.Date;
                    Entity.IdCbteCble       = info.IdCbteCble;
                    Entity.IdEmpresa_ct     = info.IdEmpresa_ct;
                    Entity.IdTipoCbte       = info.IdTipoCbte;
                    Entity.NumComprobante   = info.NumComprobante;
                    Entity.ValorActivo      = info.ValorActivo;
                    Entity.Valor_Depre_Acu  = info.Valor_Depre_Acu;
                    Entity.Valor_Neto       = info.Valor_Neto;
                    Entity.Valor_Tot_Bajas  = info.Valor_Tot_Bajas;
                    Entity.Valor_Tot_Mejora = info.Valor_Tot_Mejora;
                    Entity.Cod_Ret_Activo   = info.Cod_Ret_Activo;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                tb_LogError_Data LogData = new tb_LogError_Data();
                LogData.GuardarDB(new tb_LogError_Info {
                    Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "Af_Retiro_Activo_Data", Metodo = "modificarDB", IdUsuario = info.IdUsuario
                });
                return(false);
            }
        }
Exemplo n.º 5
0
 public Af_Retiro_Activo_Info get_info(int IdEmpresa, decimal IdRetiroActivo)
 {
     try
     {
         Af_Retiro_Activo_Info info = new Af_Retiro_Activo_Info();
         using (Entities_activo_fijo Context = new Entities_activo_fijo())
         {
             Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdRetiroActivo == IdRetiroActivo);
             if (Entity == null)
             {
                 return(null);
             }
             info = new Af_Retiro_Activo_Info
             {
                 IdEmpresa        = Entity.IdEmpresa,
                 Cod_Ret_Activo   = Entity.Cod_Ret_Activo,
                 Concepto_Retiro  = Entity.Concepto_Retiro,
                 Estado           = Entity.Estado,
                 Fecha_Retiro     = Entity.Fecha_Retiro.Date,
                 IdActivoFijo     = Entity.IdActivoFijo,
                 IdCbteCble       = Entity.IdCbteCble,
                 IdEmpresa_ct     = Entity.IdEmpresa_ct,
                 IdTipoCbte       = Entity.IdTipoCbte,
                 IdRetiroActivo   = Entity.IdRetiroActivo,
                 NumComprobante   = Entity.NumComprobante,
                 ValorActivo      = Entity.ValorActivo,
                 Valor_Depre_Acu  = Entity.Valor_Depre_Acu,
                 Valor_Neto       = Entity.Valor_Neto,
                 Valor_Tot_Bajas  = Entity.Valor_Tot_Bajas,
                 Valor_Tot_Mejora = Entity.Valor_Tot_Mejora
             };
         }
         return(info);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 6
0
        public bool modificarDB(Af_Retiro_Activo_Info info)
        {
            try
            {
                using (Entities_activo_fijo Context = new Entities_activo_fijo())
                {
                    Af_Retiro_Activo Entity = Context.Af_Retiro_Activo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRetiroActivo == info.IdRetiroActivo);
                    if (Entity == null)
                    {
                        return(false);
                    }


                    Entity.Concepto_Retiro  = info.Concepto_Retiro;
                    Entity.Fecha_Retiro     = info.Fecha_Retiro.Date;
                    Entity.IdCbteCble       = info.IdCbteCble;
                    Entity.IdEmpresa_ct     = info.IdEmpresa_ct;
                    Entity.IdTipoCbte       = info.IdTipoCbte;
                    Entity.NumComprobante   = info.NumComprobante;
                    Entity.ValorActivo      = info.ValorActivo;
                    Entity.Valor_Depre_Acu  = info.Valor_Depre_Acu;
                    Entity.Valor_Neto       = info.Valor_Neto;
                    Entity.Valor_Tot_Bajas  = info.Valor_Tot_Bajas;
                    Entity.Valor_Tot_Mejora = info.Valor_Tot_Mejora;
                    Entity.Cod_Ret_Activo   = info.Cod_Ret_Activo;

                    Entity.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    Entity.Fecha_UltMod    = DateTime.Now;
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }