public Boolean GuardarDB(Af_Depreciacion_x_cta_cbtecble_Info infoCbteCble)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Depreciacion_x_cta_cbtecble();
                    Address.IdEmpresa          = infoCbteCble.IdEmpresa;
                    Address.IdDepreciacion     = infoCbteCble.IdDepreciacion;
                    Address.IdTipoDepreciacion = infoCbteCble.IdTipoDepreciacion;
                    Address.ct_IdEmpresa       = infoCbteCble.ct_IdEmpresa;
                    Address.ct_IdTipoCbte      = infoCbteCble.ct_IdTipoCbte;
                    Address.ct_IdCbteCble      = infoCbteCble.ct_IdCbteCble;

                    Context.Af_Depreciacion_x_cta_cbtecble.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;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Example #2
0
        public Boolean ModificarDB(Af_Departamento_Info info, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Departamento.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdDepartamento == info.IdDepartamento);
                    if (contact != null)
                    {
                        contact.estado           = info.estado;
                        contact.nom_departamento = info.nom_departamento;
                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Tipo de Activo Fijo #: " + info.IdDepartamento.ToString() + " exitosamente";
                    }
                }
                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.ToString() + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #3
0
 public Boolean EliminarDB(List <Af_Depreciacion_Det_Info> lstInfo, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             foreach (var item in lstInfo)
             {
                 var contact = Context.Af_Depreciacion_Det.FirstOrDefault(q => q.IdEmpresa == item.IdEmpresa && q.IdDepreciacion == item.IdDepreciacion && q.IdTipoDepreciacion == item.IdTipoDepreciacion);
                 if (contact != null)
                 {
                     Context.Af_Depreciacion_Det.Remove(contact);
                     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.ToString() + " " + ex.Message;
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
Example #4
0
        public Boolean GuardarTran_x_CbteCble(Af_TipoTransac_x_Cta_CbteCble_Info InfoTran_x_Cta, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_TipoTransac_x_Cta_CbteCble();
                    Address.IdEmpresa            = InfoTran_x_Cta.IdEmpresa;
                    Address.IdTipTransActivoFijo = InfoTran_x_Cta.IdTipTransActivoFijo;
                    Address.IdCatalogo           = InfoTran_x_Cta.IdCatalogo;
                    Address.ct_IdEmpresa         = InfoTran_x_Cta.ct_IdEmpresa;
                    Address.ct_IdCbteCble        = InfoTran_x_Cta.ct_IdCbteCble;
                    Address.ct_IdTipoCbte        = InfoTran_x_Cta.ct_IdTipoCbte;

                    Context.Af_TipoTransac_x_Cta_CbteCble.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;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Example #5
0
        public Boolean Anular(Af_Catalogo_Info Info)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Catalogo.FirstOrDefault(var => var.IdCatalogo == Info.IdCatalogo && var.IdTipoCatalogo == Info.IdTipoCatalogo);
                    if (contact != null)
                    {
                        contact.Estado          = "I";
                        contact.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = Info.Fecha_UltAnu;
                        contact.MotiAnula       = Info.MotiAnula;
                        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.ToString() + " " + ex.Message;

                throw new Exception(ex.ToString());
            }
        }
Example #6
0
 public Boolean ModificarDB(Af_Retiro_Activo_Info InfoAf, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Retiro_Activo.FirstOrDefault(af => af.IdEmpresa == InfoAf.IdEmpresa && af.IdRetiroActivo == InfoAf.IdRetiroActivo);
             if (contact != null)
             {
                 contact.NumComprobante  = InfoAf.NumComprobante;
                 contact.Concepto_Retiro = InfoAf.Concepto_Retiro;
                 contact.Fecha_Retiro    = InfoAf.Fecha_Retiro;
                 contact.IdUsuarioUltMod = InfoAf.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = InfoAf.Fecha_UltMod;
                 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.ToString() + " " + ex.Message;
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
Example #7
0
 public Boolean GuardarDB(Af_Catalogo_Info Info)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var Address = new Af_Catalogo();
             Address.IdCatalogo     = Info.IdCatalogo;
             Address.IdTipoCatalogo = Info.IdTipoCatalogo;
             Address.Descripcion    = Info.Descripcion;
             Address.Estado         = "A";
             Address.IdUsuario      = Info.IdUsuario;
             Address.nom_pc         = Info.nom_pc;
             Address.ip             = Info.ip;
             Context.Af_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.InnerException.ToString());
     }
 }
 public Boolean ModificarDB(Af_Mej_Baj_Activo_Info InfoAf, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Mej_Baj_Activo.FirstOrDefault(af => af.IdEmpresa == InfoAf.IdEmpresa && af.Id_Mejora_Baja_Activo == InfoAf.Id_Mejora_Baja_Activo && af.Id_Tipo == InfoAf.Id_Tipo);
             if (contact != null)
             {
                 contact.IdProveedor          = InfoAf.IdProveedor;
                 contact.Valor_Mej_Baj_Activo = InfoAf.Valor_Mej_Baj_Activo;
                 contact.Compr_Mej_Baj        = InfoAf.Compr_Mej_Baj;
                 contact.DescripcionTecnica   = InfoAf.DescripcionTecnica;
                 contact.Motivo          = InfoAf.Motivo;
                 contact.IdUsuarioUltMod = InfoAf.IdUsuarioUltMod;
                 contact.Fecha_UltMod    = InfoAf.Fecha_UltMod;
                 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.ToString() + " " + ex.Message;
         msjError = mensaje;
         throw new Exception(ex.ToString());
     }
 }
Example #9
0
        public Boolean AnularDB(Af_Tipo_Depreciacion_Info info, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Tipo_Depreciacion.FirstOrDefault(obj => obj.IdTipoDepreciacion == info.IdTipoDepreciacion);
                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.MotiAnula       = info.MotiAnula;
                        contact.Fecha_UltAnu    = DateTime.Now;
                        contact.estado          = "I";
                        context.SaveChanges();
                        msg = "Se ha procedido anular el registro del Activo Fijo #: " + info.IdTipoDepreciacion.ToString() + " exitosamente";
                    }
                }
                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.ToString() + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #10
0
        public Boolean GrabarDB(Af_Departamento_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var address = new Af_Departamento();

                    int idpv = GetId(info.IdEmpresa);
                    id = idpv;

                    address.IdEmpresa        = info.IdEmpresa;
                    address.IdDepartamento   = idpv;
                    address.estado           = info.estado;
                    address.nom_departamento = info.nom_departamento;

                    context.Af_Departamento.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro del Tipo de Af_Departamento_Info #: " + id.ToString() + " exitosamente.";
                }
                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;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
Example #11
0
 public bool GuardarDB(List <Af_Activo_fijo_x_Af_Activo_fijo_Info> lista)
 {
     try
     {
         using (EntitiesActivoFijo DBase = new EntitiesActivoFijo())
         {
             foreach (var item in lista)
             {
                 Af_Activo_fijo_x_Af_Activo_fijo address = new Af_Activo_fijo_x_Af_Activo_fijo();
                 address.IdActivoFijo_padre = item.IdActivoFijo_padre;
                 address.IdActivoFijo_hijo  = item.IdActivoFijo_hijo;
                 address.IdEmpresa          = item.IdEmpresa;
                 DBase.Af_Activo_fijo_x_Af_Activo_fijo.Add(address);
                 DBase.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;
         //saca la excepción controlada a la proxima capa
         throw new Exception(ex.InnerException.ToString());
     }
 }
Example #12
0
 public bool Modificar(Af_Catalogo_Info info)
 {
     try
     {
         EntitiesActivoFijo context = new EntitiesActivoFijo();
         var contenido = context.Af_Catalogo.FirstOrDefault(var => var.IdCatalogo == info.IdCatalogo);
         if (contenido != null)
         {
             contenido.Descripcion     = info.Descripcion;
             contenido.Estado          = info.Estado;
             contenido.IdUsuarioUltMod = info.IdUsuarioUltMod;
             contenido.FechaUltMod     = info.FechaUltMod;
             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.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Example #13
0
        public Boolean Guardar_HistoricoDB(Af_Depreciacion_Info Info, ref string msjError)
        {
            try
            {
                int IdHisDepreciacion = 0;
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Depreciacion_His_Anulacion();
                    Address.IdEmpresa           = Info.IdEmpresa;
                    Address.IdHisDepreciacion   = IdHisDepreciacion = Get_HistoricoId(Info.IdEmpresa);
                    Address.IdDepreciacion      = Info.IdDepreciacion;
                    Address.IdTipoDepreciacion  = Info.IdTipoDepreciacion;
                    Address.Cod_Depreciacion    = Info.Cod_Depreciacion;
                    Address.IdPeriodo           = Info.IdPeriodo;
                    Address.Descripcion         = Info.Descripcion;
                    Address.Fecha_Depreciacion  = Info.Fecha_Depreciacion;
                    Address.Num_Act_Depre       = Info.Num_Act_Depre;
                    Address.Valor_Tot_Act       = Info.Valor_Tot_Act;
                    Address.Valor_Tot_Depre     = Info.Valor_Tot_Depre;
                    Address.Valor_Tot_DepreAcum = Info.Valor_Tot_DepreAcum;
                    Address.Valot_Tot_Importe   = Info.Valot_Tot_Importe;
                    Address.IdUsuario           = Info.IdUsuario;
                    Address.Fecha_Transac       = Info.Fecha_Transac;
                    Address.nom_pc          = Info.nom_pc;
                    Address.ip              = Info.ip;
                    Address.Estado          = Info.Estado;
                    Address.IdUsuarioUltMod = Info.IdUsuarioUltAnu;
                    Address.Fecha_UltMod    = Info.Fecha_UltAnu;
                    Address.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                    Address.Fecha_UltAnu    = Info.Fecha_UltAnu;
                    Address.MotivoAnula     = Info.MotivoAnula;

                    Context.Af_Depreciacion_His_Anulacion.Add(Address);
                    Context.SaveChanges();

                    dataDetalle.Guardar_HistoricoDB(Info.ListDetalle, IdHisDepreciacion, Info.IdDepreciacion, Info.IdTipoDepreciacion, ref msjError);
                }
                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());
            }
        }
Example #14
0
        public Boolean GrabarDB(Af_Activo_fijo_tipo_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var address = new Af_Activo_fijo_tipo();
                    int idpv    = getId(info.IdEmpresa);
                    id = idpv;
                    address.IdEmpresa              = info.IdEmpresa;
                    address.IdActijoFijoTipo       = idpv;
                    address.IdCtaCble_Activo       = info.IdCtaCble_Activo;
                    address.IdCtaCble_Gastos_Depre = info.IdCtaCble_Gastos_Depre;
                    address.IdCtaCble_Dep_Acum     = info.IdCtaCble_Dep_Acum;
                    address.CodActivoFijo          = (info.CodActivoFijo == "" || info.CodActivoFijo == null) ? "TAF" + idpv : info.CodActivoFijo;
                    address.Af_Descripcion         = info.Af_Descripcion;
                    address.Af_Porcentaje_depre    = info.Af_Porcentaje_depre;
                    address.Af_anio_depreciacion   = info.Af_anio_depreciacion;
                    address.IdUsuario              = info.IdUsuario;
                    address.Fecha_Transac          = info.Fecha_Transac;
                    address.nom_pc = info.nom_pc;
                    address.ip     = info.ip;
                    address.Estado = "A";
                    address.IdCentroCosto_Activo      = info.IdCentroCosto_Activo;
                    address.IdCentroCosto_Dep_Acum    = info.IdCentroCosto_Dep_Acum;
                    address.IdCentroCosto_Gasto_Depre = info.IdCentroCosto_Gasto_Depre;
                    address.Se_Deprecia = info.Se_Deprecia;
                    //contact = address;
                    context.Af_Activo_fijo_tipo.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro del Tipo de Activo Fijo #: " + id.ToString() + " exitosamente.";
                }
                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.ToString() + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        public Boolean AnularDB(Af_Activo_fijo_tipo_Info info, ref string msg)
        {
            try
            {
                EntitiesActivoFijo OEPActivoFijo = new EntitiesActivoFijo();
                var select = from q in OEPActivoFijo.Af_Activo_fijo_tipo
                             where q.IdEmpresa == info.IdEmpresa && q.IdActivoFijoTipo == info.IdActivoFijoTipo
                             select q;

                if (select.ToList().Count > 0)
                {
                    using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                    {
                        var contact = context.Af_Activo_fijo_tipo.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdActivoFijoTipo == info.IdActivoFijoTipo);//e && obj.IdActivoFijo == info.IdActivoFijoTipo);
                        if (contact != null)
                        {
                            contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                            contact.Fecha_UltAnu    = DateTime.Now;
                            contact.MotiAnula       = info.MotiAnula;
                            //contact.nom_pc = info.nom_pc;
                            //contact.ip = info.ip;
                            contact.Estado = "I";
                            context.SaveChanges();
                            msg = "Se ha procedido anular el registro del Tipo de Activo Fijo #: " + info.IdActivoFijoTipo.ToString() + " exitosamente";
                        }
                    }
                    return(true);
                }
                else
                {
                    msg = "No es posible anular el registro del Tipo de Activo Fijo #: " + info.IdActivoFijoTipo.ToString() + " debido a que ya se encuentra anulado.";
                    return(false);
                }
            }
            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;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #16
0
        public Boolean GuardarDB(Af_Venta_Activo_Info InfoAf, ref decimal IdVtaActivo, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    //var contact = Af_Venta_Activo.CreateAf_Venta_Activo(0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0, DateTime.Now);

                    var Address = new Af_Venta_Activo();
                    Address.IdEmpresa        = InfoAf.IdEmpresa;
                    Address.IdVtaActivo      = InfoAf.IdVtaActivo = IdVtaActivo = GetId(InfoAf.IdEmpresa);
                    Address.Cod_VtaActivo    = (InfoAf.Cod_VtaActivo == "" || InfoAf.Cod_VtaActivo == null) ? "Vta_" + InfoAf.IdVtaActivo : InfoAf.Cod_VtaActivo;
                    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.Valor_Venta      = InfoAf.Valor_Venta;
                    Address.Valor_Perdi_Gana = InfoAf.Valor_Perdi_Gana;
                    Address.NumComprobante   = InfoAf.NumComprobante;
                    Address.Concepto_Vta     = InfoAf.Concepto_Vta;
                    Address.Fecha_Venta      = InfoAf.Fecha_Venta;
                    Address.IdUsuario        = InfoAf.IdUsuario;
                    Address.Fecha_Transac    = InfoAf.Fecha_Transac;
                    Address.nom_pc           = InfoAf.nom_pc;
                    Address.ip     = InfoAf.ip;
                    Address.Estado = InfoAf.Estado;
                    //contact = Address;
                    Context.Af_Venta_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());
            }
        }
Example #17
0
        public Boolean Guardar_HistoricoDB(List <Af_Depreciacion_Det_Info> lstInfo, int IdHisDepreciacion, decimal IdDepreciacion, int IdTipoDepreciacion, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    int secuencia = 0;
                    foreach (var item in lstInfo)
                    {
                        secuencia = secuencia + 1;
                        var Address = new Af_Depreciacion_Det_His_Anulacion();
                        Address.IdEmpresa          = item.IdEmpresa;
                        Address.IdHisDepreciacion  = IdHisDepreciacion;
                        Address.IdDepreciacion     = IdDepreciacion;
                        Address.IdTipoDepreciacion = IdTipoDepreciacion;
                        Address.Secuencia          = secuencia;
                        Address.IdActivoFijo       = item.IdActivoFijo;
                        Address.Ciclo              = item.Ciclo;
                        Address.Concepto           = item.Concepto;
                        Address.Valor_Compra       = item.Valor_Compra;
                        Address.Valor_Salvamento   = item.Valor_Salvamento;
                        Address.Vida_Util          = item.Vida_Util;
                        Address.Porc_Depreciacion  = item.Porc_Depreciacion;
                        Address.Valor_Depreciacion = item.Valor_Depreciacion;
                        Address.Valor_Depre_Acum   = item.Valor_Depre_Acum;
                        Address.Valor_Importe      = item.Valor_Importe;
                        Address.Es_Activo_x_Mejora = item.Es_Activo_x_Mejora;

                        Context.Af_Depreciacion_Det_His_Anulacion.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());
            }
        }
Example #18
0
        public Boolean ModificarDB(Af_Activo_fijo_tipo_Info info, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Activo_fijo_tipo.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdActijoFijoTipo == info.IdActivoFijoTipo);
                    if (contact != null)
                    {
                        contact.CodActivoFijo          = info.CodActivoFijo;
                        contact.Af_Descripcion         = info.Af_Descripcion;
                        contact.IdCtaCble_Activo       = info.IdCtaCble_Activo;
                        contact.IdCtaCble_Gastos_Depre = info.IdCtaCble_Gastos_Depre;
                        contact.IdCtaCble_Dep_Acum     = info.IdCtaCble_Dep_Acum;
                        contact.Af_Porcentaje_depre    = info.Af_Porcentaje_depre;
                        contact.Af_anio_depreciacion   = info.Af_anio_depreciacion;
                        contact.IdUsuarioUltMod        = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod           = info.Fecha_UltMod;
                        contact.ip          = info.ip;
                        contact.Estado      = info.Estado;
                        contact.Se_Deprecia = info.Se_Deprecia;

                        contact.IdCentroCosto_Activo      = info.IdCentroCosto_Activo;
                        contact.IdCentroCosto_Dep_Acum    = info.IdCentroCosto_Dep_Acum;
                        contact.IdCentroCosto_Gasto_Depre = info.IdCentroCosto_Gasto_Depre;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Tipo de Activo Fijo #: " + info.IdActivoFijoTipo.ToString() + " exitosamente";
                    }
                }
                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.ToString() + " " + ex.Message;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #19
0
 public Boolean GuardarDB(Af_CambioUbicacion_Activo_Info Info, ref int IdCambioUbicacion, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo context = new EntitiesActivoFijo())
         {
             Af_CambioUbicacion_Activo address = new Af_CambioUbicacion_Activo();
             address.IdEmpresa                     = Info.IdEmpresa;
             address.IdCambioUbicacion             = IdCambioUbicacion = GetId(Info.IdEmpresa);
             address.IdActivoFijo                  = Info.IdActivoFijo;
             address.IdSucursal_Actu               = Info.IdSucursal_Actu;
             address.IdDepartamento_Actu           = Info.IdDepartamento_Actu;
             address.IdTipoCatalogo_Ubicacion_Actu = Info.IdTipoCatalogo_Ubicacion_Actu;
             address.IdCentroCosto_Actu            = Info.IdCentroCosto_Actu;
             address.IdSucursal_Ant                = Info.IdSucursal_Ant;
             address.IdDepartamento_Ant            = Info.IdDepartamento_Ant;
             address.IdTipoCatalogo_Ubicacion_Ant  = Info.IdTipoCatalogo_Ubicacion_Ant;
             address.IdCentroCosto_Ant             = Info.IdCentroCosto_Ant == "" ? null : Info.IdCentroCosto_Ant;
             address.FechaCambio                   = Info.FechaCambio;
             address.MotivoCambio                  = Info.MotivoCambio;
             address.IdUsuario                     = Info.IdUsuario;
             address.nom_pc              = Info.nom_pc;
             address.ip                  = Info.ip;
             address.IdUnidadFact_cat    = Info.IdUnidadFact_cat;
             address.Af_ValorUnidad_Actu = Info.Af_ValorUnidad_Actu;
             address.IdEncargado_Actu    = Info.IdEncargado_Actu;
             address.IdEncargado_Ant     = Info.IdEncargado_Ant;
             address.IdCentroCosto_sub_centro_costo_Actu = Info.IdCentroCosto_sub_centro_costo_Actu;
             address.IdCentroCosto_sub_centro_costo_Ant  = Info.IdCentroCosto_sub_centro_costo_Ant;
             context.Af_CambioUbicacion_Activo.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.InnerException.ToString());
     }
 }
Example #20
0
        public Boolean GrabarDB(Af_Tipo_Depreciacion_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    Af_Tipo_Depreciacion address = new Af_Tipo_Depreciacion();
                    int idpv = GetId();
                    id = idpv;
                    address.IdTipoDepreciacion    = idpv;
                    address.cod_tipo_depreciacion = info.cod_tipo_depreciacion;
                    address.nom_tipo_depreciacion = info.nom_tipo_depreciacion;
                    address.estado          = info.estado;
                    address.IdUsuario       = info.IdUsuario;
                    address.Fecha_Transac   = info.Fecha_Transac;
                    address.IdUsuarioUltMod = info.IdUsuarioUltMod;
                    address.Fecha_UltMod    = info.Fecha_UltMod;
                    address.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                    address.Fecha_UltAnu    = info.Fecha_UltAnu;
                    address.nom_pc          = info.nom_pc;
                    address.ip            = info.ip;
                    address.Fecha_Transac = DateTime.Now;
                    address.estado        = "A";

                    context.Af_Tipo_Depreciacion.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro del Activo Fijo #: " + id.ToString() + " exitosamente.";
                }
                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;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public Boolean GuardarDB(Af_Mej_Baj_Activo_Info InfoAf, ref decimal Id_Mejora_Baja_Activo, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Mej_Baj_Activo();
                    Address.IdEmpresa             = InfoAf.IdEmpresa;
                    Address.Id_Mejora_Baja_Activo = InfoAf.Id_Mejora_Baja_Activo = Id_Mejora_Baja_Activo = GetId(InfoAf.IdEmpresa, InfoAf.Id_Tipo);
                    Address.Id_Tipo              = InfoAf.Id_Tipo;
                    Address.IdActivoFijo         = InfoAf.IdActivoFijo;
                    Address.IdProveedor          = InfoAf.IdProveedor;
                    Address.Cod_Mej_Baj_Activo   = (InfoAf.Cod_Mej_Baj_Activo == "" || InfoAf.Cod_Mej_Baj_Activo == null) ? "Mej_Baj_" + InfoAf.Id_Mejora_Baja_Activo : InfoAf.Cod_Mej_Baj_Activo;
                    Address.ValorActivo          = InfoAf.ValorActivo;
                    Address.Valor_Mej_Baj_Activo = InfoAf.Valor_Mej_Baj_Activo;
                    Address.Compr_Mej_Baj        = InfoAf.Compr_Mej_Baj;
                    Address.DescripcionTecnica   = InfoAf.DescripcionTecnica;
                    Address.Motivo        = InfoAf.Motivo;
                    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_Mej_Baj_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());
            }
        }
Example #22
0
        public Boolean GrabarDB(Af_Activo_fijo_Categoria_Info Info, int IdTipoAF, ref int IdCategoria, ref string MensajeError)
        {
            try
            {
                using (EntitiesActivoFijo BaseDB = new EntitiesActivoFijo())
                {
                    var address = new Af_Activo_fijo_Categoria();

                    address.IdEmpresa        = Info.IdEmpresa;
                    address.IdCategoriaAF    = GetId(Info.IdEmpresa, IdTipoAF);
                    address.IdActivoFijoTipo = Info.IdActivoFijoTipo;
                    address.CodCategoriaAF   = Info.CodCategoriaAF;
                    address.Descripcion      = Info.Descripcion;
                    address.IdUsuario        = Info.IdUsuario;
                    address.Fecha_Transac    = DateTime.Now;
                    address.IdUsuarioUltMod  = Info.IdUsuarioUltMod;
                    address.Fecha_UltMod     = DateTime.Now;
                    address.nom_pc           = Info.nom_pc;
                    address.ip     = Info.ip;
                    address.Estado = Info.Estado;
                    BaseDB.Af_Activo_fijo_Categoria.Add(address);
                    BaseDB.SaveChanges();
                    IdCategoria = address.IdCategoriaAF;
                }
                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.InnerException.ToString());
            }
        }
        public Boolean GrabarDB(Af_Activo_fijo_Info info, ref int IdActivoFijo, ref string CodActivo, ref string msg)
        {
            try
            {
                try
                {
                    using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                    {
                        Af_Activo_fijo address = new Af_Activo_fijo();
                        int            idpv    = GetId(info.IdEmpresa);
                        IdActivoFijo             = idpv;
                        address.IdEmpresa        = info.IdEmpresa;
                        address.IdActivoFijo     = info.IdActivoFijo = idpv;
                        address.IdActivoFijoTipo = info.IdActivoFijoTipo;
                        address.IdSucursal       = info.IdSucursal;
                        address.CodActivoFijo    = CodActivo = info.CodActivoFijo == "" || info.CodActivoFijo == null?info.IdActivoFijo.ToString() : info.CodActivoFijo.Trim();

                        address.Af_Nombre                = info.Af_Nombre;
                        address.IdCatalogo_Marca         = info.IdCatalogo_Marca;
                        address.IdCatalogo_Modelo        = info.IdCatalogo_Modelo;
                        address.Af_NumSerie              = info.Af_NumSerie;
                        address.IdCatalogo_Color         = info.IdCatalogo_Color;
                        address.IdTipoCatalogo_Ubicacion = info.IdTipoCatalogo_Ubicacion;
                        address.Af_fecha_compra          = info.Af_fecha_compra.Date;
                        address.Af_fecha_ini_depre       = info.Af_fecha_ini_depre.Date;
                        address.Af_fecha_fin_depre       = info.Af_fecha_fin_depre.Date;
                        address.Af_Costo_historico       = info.Af_Costo_historico;
                        address.Af_costo_compra          = info.Af_costo_compra;
                        address.Af_Vida_Util             = info.Af_Vida_Util;
                        address.Af_Meses_depreciar       = info.Af_Meses_depreciar;
                        address.Af_porcentaje_deprec     = info.Af_porcentaje_deprec;
                        address.Af_observacion           = (info.Af_observacion == null) ? "" : info.Af_observacion;

                        address.Af_NumPlaca         = info.Af_NumPlaca;
                        address.Af_Anio_fabrica     = info.Af_Anio_fabrica;
                        address.IdUsuario           = info.IdUsuario;
                        address.Fecha_Transac       = DateTime.Now;
                        address.Estado              = "A";
                        address.Af_foto             = info.Af_foto;
                        address.Af_DescripcionCorta = info.Af_DescripcionCorta;
                        address.Af_Codigo_Barra     = (info.Af_Codigo_Barra == "" || info.Af_Codigo_Barra == null) ? CodActivo : info.Af_Codigo_Barra;

                        address.Af_DescripcionTecnica = info.Af_DescripcionTecnica;
                        address.Estado_Proceso        = info.Estado_Proceso;
                        address.Af_ValorSalvamento    = info.Af_ValorSalvamento;
                        address.Af_ValorResidual      = info.Af_ValorResidual;
                        address.Af_NumSerie_Motor     = info.Af_NumSerie_Motor;
                        address.Af_NumSerie_Chasis    = info.Af_NumSerie_Chasis;
                        address.IdCategoriaAF         = info.IdCategoriaAF;

                        //address.IdCtaCble_Activo = info.IdCtaCble_Activo;
                        //address.IdCtaCble_Dep_Acum = info.IdCtaCble_Dep_Acum;
                        //address.IdCtaCble_Gastos_Depre = info.IdCtaCble_Gastos_Depre;


                        context.Af_Activo_fijo.Add(address);

                        context.SaveChanges();
                        msg = "Se ha procedido a grabar el registro del Activo Fijo #: " + IdActivoFijo.ToString() + " Exitosamente.";
                    }
                    return(true);
                }
                catch (DbEntityValidationException ex)
                {
                    foreach (var item in ex.EntityValidationErrors)
                    {
                        foreach (var item_validaciones in item.ValidationErrors)
                        {
                            mensaje = mensaje + " Propiedad: " + item_validaciones.PropertyName + " Mensaje: " + item_validaciones.ErrorMessage + "\n";
                        }
                    }


                    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(mensaje, "", "Af_Activo_fijo_Data", "", "", "", "", "", DateTime.Now);
                    oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                    throw new Exception(mensaje);
                }
            }
            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;

                msg = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public Boolean ModificarDB(Af_Activo_fijo_Info info, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Activo_fijo.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdActivoFijo == info.IdActivoFijo);
                    if (contact != null)
                    {
                        contact.CodActivoFijo        = info.CodActivoFijo;
                        contact.Af_Nombre            = info.Af_Nombre;
                        contact.IdActivoFijoTipo     = info.IdActivoFijoTipo;
                        contact.IdCatalogo_Marca     = info.IdCatalogo_Marca;
                        contact.IdCatalogo_Modelo    = info.IdCatalogo_Modelo;
                        contact.Af_NumSerie          = info.Af_NumSerie;
                        contact.IdCatalogo_Color     = info.IdCatalogo_Color;
                        contact.Af_fecha_compra      = info.Af_fecha_compra;
                        contact.Af_fecha_ini_depre   = info.Af_fecha_ini_depre;
                        contact.Af_fecha_fin_depre   = info.Af_fecha_fin_depre;
                        contact.Af_Costo_historico   = info.Af_Costo_historico;
                        contact.Af_costo_compra      = info.Af_costo_compra;
                        contact.Af_Vida_Util         = info.Af_Vida_Util;
                        contact.Af_Meses_depreciar   = info.Af_Meses_depreciar;
                        contact.Af_porcentaje_deprec = info.Af_porcentaje_deprec;
                        contact.Af_observacion       = info.Af_observacion;
                        contact.Af_NumPlaca          = info.Af_NumPlaca;
                        contact.Af_Anio_fabrica      = info.Af_Anio_fabrica;
                        contact.Estado                   = info.Estado;
                        contact.IdUsuarioUltMod          = info.IdUsuarioUltMod;
                        contact.Fecha_UltMod             = info.Fecha_UltMod;
                        contact.Af_foto                  = info.Af_foto;
                        contact.Af_DescripcionCorta      = info.Af_DescripcionCorta;
                        contact.Af_Codigo_Barra          = info.Af_Codigo_Barra;
                        contact.Af_DescripcionTecnica    = info.Af_DescripcionTecnica;
                        contact.Estado_Proceso           = info.Estado_Proceso;
                        contact.Af_ValorSalvamento       = info.Af_ValorSalvamento;
                        contact.Af_ValorResidual         = info.Af_ValorResidual;
                        contact.Af_NumSerie_Motor        = info.Af_NumSerie_Motor;
                        contact.Af_NumSerie_Chasis       = info.Af_NumSerie_Chasis;
                        contact.IdCategoriaAF            = info.IdCategoriaAF;
                        contact.IdSucursal               = info.IdSucursal;
                        contact.IdTipoCatalogo_Ubicacion = info.IdTipoCatalogo_Ubicacion;


                        //contact.IdCtaCble_Activo = info.IdCtaCble_Activo;
                        //contact.IdCtaCble_Dep_Acum = info.IdCtaCble_Dep_Acum;
                        //contact.IdCtaCble_Gastos_Depre = info.IdCtaCble_Gastos_Depre;


                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Activo Fijo #: " + info.IdActivoFijo.ToString() + " exitosamente";
                    }
                }
                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.ToString() + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
Example #25
0
        public Boolean ModificarDB(Af_Parametros_Info info)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    EntitiesActivoFijo param = new EntitiesActivoFijo();
                    var selectBaParam        = (from C in param.Af_Parametros
                                                where C.IdEmpresa == info.IdEmpresa
                                                select C).Count();

                    if (selectBaParam == 0)
                    {
                        Af_Parametros addressG = new Af_Parametros();
                        addressG.IdEmpresa                    = info.IdEmpresa;
                        addressG.IdCtaCble_Activo             = info.IdCtaCble_Activo;
                        addressG.IdCtaCble_Dep_Acum           = info.IdCtaCble_Dep_Acum;
                        addressG.IdCtaCble_Gastos_Depre       = info.IdCtaCble_Gastos_Depre;
                        addressG.IdTipoCbte                   = info.IdTipoCbte;
                        addressG.IdTipoCbteBaja               = info.IdTipoCbteBaja;
                        addressG.IdTipoCbteMejora             = info.IdTipoCbteMejora;
                        addressG.IdTipoCbteRetiro             = info.IdTipoCbteRetiro;
                        addressG.IdTipoCbteVenta              = info.IdTipoCbteVenta;
                        addressG.FormaContabiliza             = info.FormaContabiliza;
                        addressG.IdTipoCbteMejora_Anulacion   = info.IdTipoCbteMejora_Anulacion;
                        addressG.IdTipoCbteBaja_Anulacion     = info.IdTipoCbteBaja_Anulacion;
                        addressG.IdTipoCbteVenta_Anulacion    = info.IdTipoCbteVenta_Anulacion;
                        addressG.IdTipoCbteRetiro_Anulacion   = info.IdTipoCbteRetiro_Anulacion;
                        addressG.IdTipoCbteDep_Acum_Anulacion = info.IdTipoCbteDep_Acum_Anulacion;
                        context.Af_Parametros.Add(addressG);
                        context.SaveChanges();
                    }
                    else
                    {
                        var contact = context.Af_Parametros.FirstOrDefault(para => para.IdEmpresa == info.IdEmpresa);
                        if (contact != null)
                        {
                            contact.IdEmpresa                    = info.IdEmpresa;
                            contact.IdCtaCble_Activo             = info.IdCtaCble_Activo;
                            contact.IdCtaCble_Dep_Acum           = info.IdCtaCble_Dep_Acum;
                            contact.IdCtaCble_Gastos_Depre       = info.IdCtaCble_Gastos_Depre;
                            contact.IdTipoCbte                   = info.IdTipoCbte;
                            contact.IdTipoCbteBaja               = info.IdTipoCbteBaja;
                            contact.IdTipoCbteMejora             = info.IdTipoCbteMejora;
                            contact.IdTipoCbteRetiro             = info.IdTipoCbteRetiro;
                            contact.IdTipoCbteVenta              = info.IdTipoCbteVenta;
                            contact.FormaContabiliza             = info.FormaContabiliza;
                            contact.IdTipoCbteMejora_Anulacion   = info.IdTipoCbteMejora_Anulacion;
                            contact.IdTipoCbteBaja_Anulacion     = info.IdTipoCbteBaja_Anulacion;
                            contact.IdTipoCbteVenta_Anulacion    = info.IdTipoCbteVenta_Anulacion;
                            contact.IdTipoCbteRetiro_Anulacion   = info.IdTipoCbteRetiro_Anulacion;
                            contact.IdTipoCbteDep_Acum_Anulacion = info.IdTipoCbteDep_Acum_Anulacion;
                            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.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }