コード例 #1
0
        public Boolean GrabarDB(Af_Activo_fijo_Categoria_Info Info, int IdCategoria, ref string MensajeError)
        {
            try
            {
                using (EntitiesActivoFijo BaseDB = new EntitiesActivoFijo())
                {
                    var address = new Af_Activo_fijo_Categoria();

                    address.IdEmpresa        = Info.IdEmpresa;
                    address.IdCategoriaAF    = Info.IdCategoriaAF = GetId(Info.IdEmpresa, Info.IdActivoFijoTipo);
                    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();
                }
                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());
            }
        }
コード例 #2
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
        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());
            }
        }
コード例 #3
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
        public List <Af_Catalogo_Info> Get_List_Catalogo(string cod_Catalogo)
        {
            List <Af_Catalogo_Info> lista   = new List <Af_Catalogo_Info>();
            EntitiesActivoFijo      context = new EntitiesActivoFijo();

            try
            {
                var Existe = from q in context.Af_Catalogo
                             where q.IdTipoCatalogo == cod_Catalogo
                             select q;

                foreach (var item in Existe)
                {
                    Af_Catalogo_Info info = new Af_Catalogo_Info();

                    info.IdCatalogo     = item.IdCatalogo;
                    info.IdTipoCatalogo = item.IdTipoCatalogo;
                    info.Descripcion    = item.Descripcion;
                    info.Orden          = (int)item.Orden;
                    info.Estado         = item.Estado;
                    lista.Add(info);
                }
                return(lista);
            }
            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());
            }
        }
コード例 #4
0
        public Boolean ModificarDB(List <Af_Activo_fijo_CtasCbles_Info> lstInfoCbte, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    foreach (var item in lstInfoCbte)
                    {
                        var contact = Context.Af_Activo_fijo_CtasCbles.FirstOrDefault(af => af.IdEmpresa == item.IdEmpresa && af.IdActivoFijo == item.IdActivoFijo && af.IdTipoCuenta == item.IdTipoCuenta);
                        if (contact != null)
                        {
                            contact.IdCtaCble     = item.IdCtaCble;
                            contact.IdCentroCosto = item.IdCentroCosto;
                            contact.Observacion   = item.Observacion;

                            contact.Secuencia         = item.Secuencia;
                            contact.porc_distribucion = item.porc_distribucion;

                            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);
                msjError = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
コード例 #5
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
 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.Orden          = Info.Orden;
             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());
     }
 }
コード例 #6
0
 public Boolean AnularDB(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 && obj.IdActivoFijoTipo == info.IdActivoFijoTipo);
             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.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());
     }
 }
コード例 #7
0
        public int GetId(int IdEmpresa)
        {
            try
            {
                int Id;
                EntitiesActivoFijo OEPActivoFijo = new EntitiesActivoFijo();
                var select = from q in OEPActivoFijo.Af_Activo_fijo
                             where q.IdEmpresa == IdEmpresa
                             select q;

                if (select.ToList().Count == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_pv = (from q in OEPActivoFijo.Af_Activo_fijo
                                     where q.IdEmpresa == IdEmpresa
                                     select q.IdActivoFijo).Max();
                    Id = Convert.ToInt32(select_pv.ToString()) + 1;
                }
                return(Id);
            }
            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());
            }
        }
コード例 #8
0
        public Boolean VerificarPeriodoExistente(int IdEmpresa, int IdPeriodo, string Estado)
        {
            try
            {
                EntitiesActivoFijo ocxc = new EntitiesActivoFijo();
                var select = (from q in ocxc.Af_Depreciacion
                              where q.IdEmpresa == IdEmpresa && q.IdPeriodo == IdPeriodo &&
                              q.Estado == Estado
                              select q);

                if (select.Count() > 0)
                {
                    return(false);
                }
                else
                {
                    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());
            }
        }
コード例 #9
0
 public Boolean ModificarDB(Af_Depreciacion_Info Info, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdDepreciacion == Info.IdDepreciacion && q.IdTipoDepreciacion == Info.IdTipoDepreciacion);
             if (Context != null)
             {
                 //contact.IdUsuarioUltMod = Info.IdUsuarioUltAnu;
                 //contact.Fecha_UltMod = Info.Fecha_UltAnu;
                 contact.Descripcion        = Info.Descripcion;
                 contact.Fecha_Depreciacion = Info.Fecha_Depreciacion;
                 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());
     }
 }
コード例 #10
0
        public int Get_HistoricoId(int IdEmpresa)
        {
            try
            {
                int Id;
                EntitiesActivoFijo ocxc = new EntitiesActivoFijo();
                var select = (from q in ocxc.Af_Depreciacion_His_Anulacion
                              where q.IdEmpresa == IdEmpresa
                              select q.IdHisDepreciacion).Count();

                if (select == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_IdCXC = (from q in ocxc.Af_Depreciacion_His_Anulacion
                                        where q.IdEmpresa == IdEmpresa
                                        select q.IdHisDepreciacion).Max();
                    Id = Convert.ToInt32(select_IdCXC.ToString()) + 1;
                }
                return(Id);
            }
            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());
            }
        }
コード例 #11
0
        public Boolean VerificarUltDepre(int IdEmpresa, decimal IdDepreciacion, int IdTipoDepreciacion)
        {
            try
            {
                EntitiesActivoFijo ocxc = new EntitiesActivoFijo();
                var select = (from q in ocxc.Af_Depreciacion
                              where q.IdEmpresa == IdEmpresa && q.IdDepreciacion == IdDepreciacion &&
                              q.IdTipoDepreciacion == IdTipoDepreciacion && q.Estado == "A"
                              select q.IdDepreciacion).Max();

                if (Convert.ToInt32(select.ToString()) == IdDepreciacion)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            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());
            }
        }
コード例 #12
0
        public Boolean EliminarDB(Af_Depreciacion_Info Info, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    foreach (var item in Info.ListDetalle)
                    {
                        item.IdDepreciacion     = Info.IdDepreciacion;
                        item.IdTipoDepreciacion = Info.IdTipoDepreciacion;
                    }
                    dataDetalle.EliminarDB(Info.ListDetalle, ref msjError);

                    var contact = Context.Af_Depreciacion.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdDepreciacion == Info.IdDepreciacion && q.IdTipoDepreciacion == Info.IdTipoDepreciacion);
                    if (contact != null)
                    {
                        Context.Af_Depreciacion.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());
            }
        }
コード例 #13
0
 public Boolean AnularDB(Af_Activo_fijo_Categoria_Info Info, ref string MensajeError)
 {
     try
     {
         using (EntitiesActivoFijo BaseDB = new EntitiesActivoFijo())
         {
             var address = BaseDB.Af_Activo_fijo_Categoria.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdActivoFijoTipo == Info.IdActivoFijoTipo &&
                                                                          v.IdCategoriaAF == Info.IdCategoriaAF);
             if (address != null)
             {
                 address.Fecha_UltAnu    = DateTime.Now;
                 address.IdUsuarioUltAnu = Info.IdUsuarioUltAnu;
                 address.Estado          = "I";
                 BaseDB.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.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
コード例 #14
0
 public Boolean ModificarDB(Af_Venta_Activo_Info InfoAf, ref string msjError)
 {
     try
     {
         using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
         {
             var contact = Context.Af_Venta_Activo.FirstOrDefault(af => af.IdEmpresa == InfoAf.IdEmpresa && af.IdVtaActivo == InfoAf.IdVtaActivo);
             if (contact != null)
             {
                 contact.Valor_Venta      = InfoAf.Valor_Venta;
                 contact.Valor_Perdi_Gana = InfoAf.Valor_Perdi_Gana;
                 contact.NumComprobante   = InfoAf.NumComprobante;
                 contact.Concepto_Vta     = InfoAf.Concepto_Vta;
                 contact.Fecha_Venta      = InfoAf.Fecha_Venta;
                 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());
     }
 }
コード例 #15
0
        public List <Af_PeriodoDepreciacion_Info> Get_List_PeriodoDepreciacion()
        {
            List <Af_PeriodoDepreciacion_Info> lista = new List <Af_PeriodoDepreciacion_Info>();
            EntitiesActivoFijo oEnt = new EntitiesActivoFijo();

            try
            {
                var select = from q in oEnt.Af_PeriodoDepreciacion
                             select q;

                foreach (var item in select)
                {
                    Af_PeriodoDepreciacion_Info info = new Af_PeriodoDepreciacion_Info();
                    info.IdPeriodoDeprec   = item.IdPeriodoDeprec;
                    info.Descripcion       = item.Descripcion;
                    info.Valor_Ciclo_Anual = Convert.ToInt32(item.Valor_Ciclo_Anual);
                    lista.Add(info);
                }
                return(lista);
            }
            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());
            }
        }
コード例 #16
0
        public decimal GetId(int IdEmpresa, string Id_Tipo)
        {
            try
            {
                decimal            Id;
                EntitiesActivoFijo ocxc = new EntitiesActivoFijo();
                var select = (from q in ocxc.Af_Mej_Baj_Activo
                              where q.IdEmpresa == IdEmpresa && q.Id_Tipo == Id_Tipo
                              select q.Id_Mejora_Baja_Activo).Count();

                if (select == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_IdCXC = (from q in ocxc.Af_Mej_Baj_Activo
                                        where q.IdEmpresa == IdEmpresa && q.Id_Tipo == Id_Tipo
                                        select q.Id_Mejora_Baja_Activo).Max();
                    Id = Convert.ToInt32(select_IdCXC.ToString()) + 1;
                }
                return(Id);
            }
            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;
                throw new Exception(ex.ToString());
            }
        }
コード例 #17
0
 public Boolean ModificarUbicacion(Af_CambioUbicacion_Activo_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.IdSucursal = Info.IdSucursal_Actu == null ? contact.IdSucursal : (int)Info.IdSucursal_Actu;
                 contact.IdTipoCatalogo_Ubicacion = Info.IdTipoCatalogo_Ubicacion_Actu == null ? contact.IdTipoCatalogo_Ubicacion : Info.IdTipoCatalogo_Ubicacion_Actu;
                 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;
         msg     = "Se ha producido el siguiente error: " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
コード例 #18
0
 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.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());
     }
 }
コード例 #19
0
 public Boolean ModificarEstadoProceso(int IdEmpresa, int IdActivoFijo, string EstadoProceso)
 {
     try
     {
         using (EntitiesActivoFijo context = new EntitiesActivoFijo())
         {
             var contact = context.Af_Activo_fijo.FirstOrDefault(obj => obj.IdEmpresa == IdEmpresa && obj.IdActivoFijo == IdActivoFijo);
             if (contact != null)
             {
                 contact.Estado_Proceso = EstadoProceso;
                 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());
     }
 }
コード例 #20
0
        public bool anularDB(Af_ruta_Info info)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    Af_ruta Entity = Context.Af_ruta.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdRuta == info.IdRuta);
                    if (Entity != null)
                    {
                        Entity.estado = false;
                        Context.SaveChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
コード例 #21
0
        public Boolean GuardarDB(List <Af_Activo_fijo_CtasCbles_Info> lstInfoCbte, ref string msjError)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    foreach (var item in lstInfoCbte)
                    {
                        var Address = new Af_Activo_fijo_CtasCbles();
                        Address.IdEmpresa         = item.IdEmpresa;
                        Address.IdActivoFijo      = item.IdActivoFijo;
                        Address.IdTipoCuenta      = item.IdTipoCuenta;
                        Address.IdCtaCble         = item.IdCtaCble;
                        Address.IdCentroCosto     = item.IdCentroCosto;
                        Address.Observacion       = (item.Observacion == null) ? "" : item.Observacion;
                        Address.Secuencia         = item.Secuencia;
                        Address.porc_distribucion = item.porc_distribucion;

                        Context.Af_Activo_fijo_CtasCbles.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);
                msjError = ex.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #22
0
        public bool guardarDB(Af_ruta_Info info)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    Af_ruta Entity = new Af_ruta();
                    Entity.IdEmpresa      = info.IdEmpresa;
                    Entity.IdRuta         = info.IdRuta = get_id(info.IdEmpresa);
                    Entity.ru_descripcion = info.ru_descripcion;
                    Entity.ru_cantidad_km = info.ru_cantidad_km;
                    Entity.ru_observacion = info.ru_observacion;
                    Entity.estado         = info.estado = true;
                    Context.Af_ruta.Add(Entity);
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                string mensaje = "";
                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());
            }
        }
コード例 #23
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
        public string GetIdCatalogo(string IdTipoCatalogo)
        {
            try
            {
                String             Codigo        = "";
                EntitiesActivoFijo OEPActivoFijo = new EntitiesActivoFijo();
                var select = from q in OEPActivoFijo.Af_Catalogo
                             where q.IdTipoCatalogo == IdTipoCatalogo
                             select q;

                if (select.ToList().Count == 0)
                {
                    Codigo = "000001";
                }
                else
                {
                    var select_pv = (from q in OEPActivoFijo.Af_Catalogo
                                     where q.IdTipoCatalogo == IdTipoCatalogo
                                     select q.IdCatalogo.Substring(q.IdCatalogo.Length - 6, 6)).Count() + 1;

                    Codigo = "000001" + select_pv.ToString();
                }
                return(IdTipoCatalogo + "_" + Codigo);
            }
            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);
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #24
0
        public Boolean GrabarDB(Af_Encargado_Info info, ref int id, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var address = new Af_Encargado();

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

                    address.IdEmpresa     = info.IdEmpresa;
                    address.IdEncargado   = idpv;
                    address.estado        = info.estado;
                    address.nom_encargado = info.nom_encargado;

                    context.Af_Encargado.Add(address);
                    context.SaveChanges();
                    msg = "Se ha procedido a grabar el registro del Tipo de Af_Encargado_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());
            }
        }
コード例 #25
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
 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.Orden           = info.Orden;
             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());
     }
 }
コード例 #26
0
        public Boolean ModificarDB(Af_Encargado_Info info, ref string msg)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var contact = context.Af_Encargado.FirstOrDefault(obj => obj.IdEmpresa == info.IdEmpresa && obj.IdEncargado == info.IdEncargado);
                    if (contact != null)
                    {
                        contact.estado        = info.estado;
                        contact.nom_encargado = info.nom_encargado;
                        context.SaveChanges();
                        msg = "Se ha procedido actualizar el registro del Tipo de Activo Fijo #: " + info.IdEncargado.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());
            }
        }
コード例 #27
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
        public Boolean ValidarIdTipoCatalogo_Descripcion(string IdTipoCatalogo, string Descripcion)
        {
            try
            {
                using (EntitiesActivoFijo context = new EntitiesActivoFijo())
                {
                    var Existe = from q in context.Af_Catalogo
                                 where q.Descripcion == Descripcion && q.IdTipoCatalogo == IdTipoCatalogo
                                 select q;
                    if (Existe.ToList().Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        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.InnerException + " " + ex.Message;

                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #28
0
        public List <Af_Activo_fijo_CtasCbles_Tipo_Info> Get_List_Activo_fijo_CtasCbles_Tipo()
        {
            List <Af_Activo_fijo_CtasCbles_Tipo_Info> lM = new List <Af_Activo_fijo_CtasCbles_Tipo_Info>();
            EntitiesActivoFijo OEPActivoFijo             = new EntitiesActivoFijo();

            try
            {
                var select = (from A in OEPActivoFijo.Af_Activo_fijo_CtasCbles_Tipo
                              select A).ToList();
                foreach (Af_Activo_fijo_CtasCbles_Tipo item in select)
                {
                    Af_Activo_fijo_CtasCbles_Tipo_Info info = new Af_Activo_fijo_CtasCbles_Tipo_Info();
                    info.Descripcion  = item.Descripcion;
                    info.IdTipoCuenta = item.IdTipoCuenta;

                    lM.Add(info);
                }
                return(lM);
            }
            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());
            }
        }
コード例 #29
0
ファイル: Af_Catalogo_Data.cs プロジェクト: arocajorge/ERPFJ
        public Af_Catalogo_Info Get_Info_Catalogo(string IdCatalogo)
        {
            EntitiesActivoFijo context = new EntitiesActivoFijo();
            Af_Catalogo_Info   Info    = new Af_Catalogo_Info();

            try
            {
                var contenido = context.Af_Catalogo.First(var => var.IdCatalogo == IdCatalogo);

                Info.IdCatalogo     = contenido.IdCatalogo;
                Info.IdTipoCatalogo = contenido.IdTipoCatalogo;
                Info.Descripcion    = contenido.Descripcion;
                Info.Estado         = contenido.Estado;
                Info.Orden          = (int)contenido.Orden;
                return(Info);
            }
            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());
            }
        }
コード例 #30
0
 public Boolean AnularDB(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.IdUsuarioUltAnu = InfoAf.IdUsuarioUltAnu;
                 contact.Fecha_UltAnu    = InfoAf.Fecha_UltAnu;
                 contact.MotivoAnula     = InfoAf.MotivoAnula;
                 contact.Estado          = "I";
                 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());
     }
 }