Beispiel #1
0
        public Boolean AnularDB(ct_Plancta_nivel_Info _PCninfo)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_plancta_nivel.FirstOrDefault(Pcta_info => Pcta_info.IdEmpresa == _PCninfo.IdEmpresa && Pcta_info.IdNivelCta == _PCninfo.IdNivelCta);

                    if (contact != null)
                    {
                        contact.IdUsuarioUltAnu = _PCninfo.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = DateTime.Now;
                        contact.MotivoAnulacion = _PCninfo.MotivoAnulacion;
                        contact.Estado          = "I";
                        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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #2
0
        public Boolean Mover_Subcentro_costo(ct_centro_costo_sub_centro_costo_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_centro_costo_sub_centro_costo.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdCentroCosto_sub_centro_costo == info.IdCentroCosto_sub_centro_costo);

                    if (contact != null)
                    {
                        contact.IdEmpresa     = info.IdEmpresa;
                        contact.IdCentroCosto = info.IdCentroCosto;
                        contact.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo;
                        contact.cod_subcentroCosto             = info.cod_subcentroCosto;
                        contact.Centro_costo = info.Centro_costo;
                        contact.pc_Estado    = info.pc_Estado;
                        contact.IdCtaCble    = info.IdCtaCble;
                        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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #3
0
        public String GetIdSubCentroCosto(int IdEmpresa)
        {
            int Id = 0;

            try
            {
                using (EntitiesDBConta oEnti = new EntitiesDBConta())
                {
                    var lst = from C in oEnti.ct_centro_costo_sub_centro_costo
                              where C.IdEmpresa == IdEmpresa
                              select C;

                    foreach (var item in lst)
                    {
                        if (Convert.ToInt32(item.IdCentroCosto_sub_centro_costo) > Id)
                        {
                            Id = Convert.ToInt32(item.IdCentroCosto_sub_centro_costo);
                        }
                    }
                    Id = Id + 1;
                }
                return(Convert.ToString((Convert.ToString(Id).Length == 1) ? "00" + Convert.ToString(Id) : (Convert.ToString(Id).Length == 2) ? "0" + Convert.ToString(Id) : Convert.ToString(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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #4
0
        public int Get_id(int IdEmpresa)
        {
            try
            {
                int ID = 0;

                using (EntitiesDBConta Context = new EntitiesDBConta())
                {
                    var lst = from q in Context.ct_grupo_x_Tipo_Gasto
                              where q.IdEmpresa == IdEmpresa
                              select q;

                    if (lst.Count() != 0)
                    {
                        ID = lst.Max(q => q.IdTipo_Gasto) + 1;
                    }
                    else
                    {
                        ID = 1;
                    }
                }
                return(ID);
            }
            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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #5
0
        public List <vwct_cbtecble_Con_Saldo_Info> Get_list_ObtenerCbtecble_OG_otrosPagos(int IdEmpresa, decimal IdCbteCble, int IdTipoCbte, ref string MensajeError)
        {
            List <vwct_cbtecble_Con_Saldo_Info> lM = new List <vwct_cbtecble_Con_Saldo_Info>();

            try
            {
                EntitiesDBConta OECbtecble_det = new EntitiesDBConta();
                var             select_        = from c in OECbtecble_det.vwct_cbtecble_Con_Saldo
                                                 join cc in OECbtecble_det.ct_cbtecble
                                                 on new { c.IdEmpresa, c.IdCbteCble, c.IdTipoCbte } equals new { cc.IdEmpresa, cc.IdCbteCble, cc.IdTipoCbte }
                join cte in OECbtecble_det.ct_cbtecble_tipo
                                on new { c.IdEmpresa, c.IdTipoCbte } equals new { cte.IdEmpresa, cte.IdTipoCbte }
                where c.IdEmpresa == IdEmpresa && c.IdTipoCbte == IdTipoCbte && c.IdCbteCble == IdCbteCble
                select new
                {
                    c.IdEmpresa,
                    c.IdTipoCbte,
                    c.IdCbteCble,
                    c.dc_Valor,
                    c.MontoOG,
                    c.SaldoDiario,
                    c.Detalle,
                    cc.cb_Observacion,
                    cte.tc_TipoCbte,
                    cc.cb_Fecha
                };

                foreach (var item in select_)
                {
                    vwct_cbtecble_Con_Saldo_Info dato = new vwct_cbtecble_Con_Saldo_Info();
                    dato.Detalle     = item.Detalle;
                    dato.IdCbteCble  = item.IdCbteCble;
                    dato.IdEmpresa   = item.IdEmpresa;
                    dato.IdTipoCbte  = item.IdTipoCbte;
                    dato.MontoOG     = item.MontoOG;
                    dato.Observacion = item.cb_Observacion;
                    dato.SaldoDiario = item.SaldoDiario;
                    dato.TipoCbte    = item.tc_TipoCbte;
                    dato.ValorDiario = item.dc_Valor;
                    dato.Fecha       = item.cb_Fecha;
                    dato.chek        = true;


                    lM.Add(dato);
                }

                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.ToString();
                lM      = new List <vwct_cbtecble_Con_Saldo_Info>();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #6
0
        public List <ct_Plancta_Info> Get_List_PlanctaUltNivel(int IdEmpresa, ref string MensajeError)
        {
            try
            {
                List <ct_Plancta_Info> lM = new List <ct_Plancta_Info>();

                EntitiesDBConta OEselectPlancta = new EntitiesDBConta();
                var             selectPlancta   = from C in OEselectPlancta.vwct_Plancta_UltimoNivel
                                                  select C;

                foreach (var item in selectPlancta)
                {
                    ct_Plancta_Info _PlantaCtaInfo = new ct_Plancta_Info();
                    _PlantaCtaInfo.pc_Cuenta = item.pc_Cuenta;
                    _PlantaCtaInfo.IdCtaCble = item.IdCtaCble;


                    lM.Add(_PlantaCtaInfo);
                }

                return(lM);
            }

            catch (Exception ex)
            {
                MensajeError = ex.Message;
                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(), "", MensajeError, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #7
0
        public bool GuardarDB(ct_grupo_x_Tipo_Gasto_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    ct_grupo_x_Tipo_Gasto Entity = new ct_grupo_x_Tipo_Gasto();
                    Entity.IdEmpresa          = info.IdEmpresa;
                    Entity.IdTipo_Gasto       = info.IdTipo_Gasto = Get_id(info.IdEmpresa);
                    Entity.IdTipo_Gasto_Padre = info.IdTipo_Gasto_Padre;
                    Entity.nom_tipo_Gasto     = info.nom_tipo_Gasto;
                    Entity.estado             = true;
                    Entity.nivel = info.nivel;
                    Entity.orden = info.orden;
                    context.ct_grupo_x_Tipo_Gasto.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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #8
0
        public bool AnularDB(ct_punto_cargo_grupo_Info Info, ref string mensaje)
        {
            try
            {
                using (EntitiesDBConta Context = new EntitiesDBConta())
                {
                    ct_punto_cargo_grupo contact = Context.ct_punto_cargo_grupo.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdPunto_cargo_grupo == Info.IdPunto_cargo_grupo);

                    if (contact != null)
                    {
                        contact.estado = false;
                        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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #9
0
        public int getId(int IdEmpresa)
        {
            int Id = 0;

            try
            {
                EntitiesDBConta Context = new EntitiesDBConta();
                int             select  = (from q in Context.ct_punto_cargo_grupo
                                           where q.IdEmpresa == IdEmpresa
                                           select q).Count();

                if (select == 0)
                {
                    Id = 1;
                }
                else
                {
                    var select_as = (from q in Context.ct_punto_cargo_grupo
                                     where q.IdEmpresa == IdEmpresa
                                     select q.IdPunto_cargo_grupo).Max();
                    Id = Convert.ToInt32(select_as.ToString()) + 1;
                }
                return(Id);
            }
            catch (Exception ex)
            {
                string arreglo      = ToString();
                string MensajeError = string.Empty;
                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);
                MensajeError = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Beispiel #10
0
        public string Get_Codigo_x_CbtCble_tipo(int IdEmpresa, int IdTipoCbte, ref string MensajeError)
        {
            try
            {
                string codigoCBTECBLE = "";

                EntitiesDBConta tabla = new EntitiesDBConta();
                var             q     = from reg in tabla.ct_cbtecble_tipo
                                        where reg.IdTipoCbte == IdTipoCbte &&
                                        reg.IdEmpresa == IdEmpresa
                                        select reg;
                if (q.ToList().Count > 0)
                {
                    foreach (var item in q)
                    {
                        codigoCBTECBLE = item.CodTipoCbte;
                    }
                }
                return(codigoCBTECBLE);
            }
            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 MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #11
0
        public Boolean EliminarDB(ct_Cbtecble_tipo_Info info, ref string MensajeError)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_cbtecble_tipo.FirstOrDefault(minfo => minfo.IdTipoCbte == info.IdTipoCbte && minfo.IdEmpresa == info.IdEmpresa);

                    if (contact != null)
                    {
                        contact.tc_Estado       = "I";
                        contact.IdUsuarioUltAnu = info.IdUsuarioUltAnu;
                        contact.Fecha_UltAnu    = DateTime.Now;
                        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 MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #12
0
 public Boolean Get_Existe_Cbte_x_Empresa(int IdEmpresa, int IdTipoCbte, ref string MensajeError) // verifica si el tipo de comprobante existe en la empresa solicitada
 {
     try
     {
         EntitiesDBConta tabla = new EntitiesDBConta();
         var             q     = from reg in tabla.ct_cbtecble_tipo
                                 where reg.IdTipoCbte == IdTipoCbte &&
                                 reg.IdEmpresa == IdEmpresa
                                 select reg;
         if (q.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 MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #13
0
        public Boolean ModificarDB(ct_Cbtecble_tipo_Info info, ref string MensajeError)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_cbtecble_tipo.FirstOrDefault(minfo => minfo.IdTipoCbte == info.IdTipoCbte && minfo.IdEmpresa == info.IdEmpresa);

                    if (contact != null)
                    {
                        contact.CodTipoCbte     = (info.CodTipoCbte == null || info.CodTipoCbte == "") ? info.CodTipoCbte.ToString() : info.CodTipoCbte;
                        contact.CodTipoCbte     = info.CodTipoCbte;
                        contact.tc_TipoCbte     = info.tc_TipoCbte;
                        contact.tc_Estado       = info.tc_Estado;
                        contact.tc_Interno      = info.tc_Interno;
                        contact.tc_Nemonico     = info.tc_Nemonico;
                        contact.IdTipoCbte_Anul = info.IdTipoCbte_Anul;
                        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 MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #14
0
 public Boolean EliminarDB(ct_rpt_MovxCta_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_rpt_MovxCta.FirstOrDefault(dinfo => dinfo.IdEmpresa == info.Idempresa);
             if (contact != null)
             {
                 context.ct_rpt_MovxCta.Remove(contact);
                 context.SaveChanges();
                 context.Dispose();
             }
         }
         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();
         throw new Exception(ex.ToString());
     }
 }
 public List <ct_GrupoEmpresarial_plancta_Info> Get_list_GrupoEmpresarial_plancta()
 {
     try
     {
         List <ct_GrupoEmpresarial_plancta_Info> Lst = new List <ct_GrupoEmpresarial_plancta_Info>();
         EntitiesDBConta oEnti = new EntitiesDBConta();
         var             Query = from q in oEnti.ct_GrupoEmpresarial_plancta
                                 select q;
         foreach (var item in Query)
         {
             ct_GrupoEmpresarial_plancta_Info Obj = new ct_GrupoEmpresarial_plancta_Info();
             Obj.IdCuenta_gr      = item.IdCuenta_gr;
             Obj.pc_Cuenta_gr     = item.pc_Cuenta_gr;
             Obj.IdCuentaPadre_gr = item.IdCuentaPadre_gr;
             Obj.pc_Naturaleza    = item.pc_Naturaleza;
             Obj.IdNivelCta_gr    = item.IdNivelCta_gr;
             Obj.IdGrupoCble_gr   = item.IdGrupoCble_gr;
             Obj.pc_EsMovimiento  = item.pc_EsMovimiento;
             Obj.pc_Estado        = item.pc_Estado;
             Lst.Add(Obj);
         }
         return(Lst);
     }
     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();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #16
0
        public Boolean GrabarDB(ct_GrupoEmpresarial_Info Info)
        {
            try
            {
                List <ct_GrupoEmpresarial_Info> Lst = new List <ct_GrupoEmpresarial_Info>();
                using (EntitiesDBConta Context = new EntitiesDBConta())
                {
                    var Address = new ct_GrupoEmpresarial();

                    Address.IdGrupoEmpresarial = Info.IdGrupoEmpresarial;
                    Address.GrupoEmpresarial   = Info.GrupoEmpresarial;
                    Address.Estado             = Info.Estado;


                    Context.ct_GrupoEmpresarial.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.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public ct_GrupoEmpresarial_plancta_Info Get_Info_GrupoEmpresarial_plancta(string IdCuenta_gr)
        {
            EntitiesDBConta oEnti = new EntitiesDBConta();

            try
            {
                ct_GrupoEmpresarial_plancta_Info Info = new ct_GrupoEmpresarial_plancta_Info();
                var Objeto = oEnti.ct_GrupoEmpresarial_plancta.First(var => var.IdCuenta_gr == IdCuenta_gr);
                Info.IdCuenta_gr      = Objeto.IdCuenta_gr;
                Info.pc_Cuenta_gr     = Objeto.pc_Cuenta_gr;
                Info.IdCuentaPadre_gr = Objeto.IdCuentaPadre_gr;
                Info.pc_Naturaleza    = Objeto.pc_Naturaleza;
                Info.IdNivelCta_gr    = Objeto.IdNivelCta_gr;
                Info.IdGrupoCble_gr   = Objeto.IdGrupoCble_gr;
                Info.pc_EsMovimiento  = Objeto.pc_EsMovimiento;
                Info.pc_Estado        = Objeto.pc_Estado;
                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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #18
0
 public List <ct_GrupoEmpresarial_Info> Get_list_GrupoEmpresarial()
 {
     try
     {
         List <ct_GrupoEmpresarial_Info> Lst = new List <ct_GrupoEmpresarial_Info>();
         EntitiesDBConta oEnti = new EntitiesDBConta();
         var             Query = from q in oEnti.ct_GrupoEmpresarial
                                 select q;
         foreach (var item in Query)
         {
             ct_GrupoEmpresarial_Info Obj = new ct_GrupoEmpresarial_Info();
             Obj.IdGrupoEmpresarial = item.IdGrupoEmpresarial;
             Obj.GrupoEmpresarial   = item.GrupoEmpresarial;
             Obj.Estado             = item.Estado;
             Lst.Add(Obj);
         }
         return(Lst);
     }
     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();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #19
0
 public Boolean ValidaIdCtaCble(int IdEmpresa, string IdCuenta, ref string MensajeError)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             EntitiesDBConta EDB = new EntitiesDBConta();
             var             Q   = from per in EDB.ct_plancta
                                   where per.IdEmpresa == IdEmpresa &&
                                   per.IdCtaCble.Trim() == IdCuenta.Trim()
                                   select per;
             return((Q.ToList().Count > 0) ? true : false);
         }
     }
     catch (Exception ex)
     {
         MensajeError = ex.Message;
         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(), "", MensajeError, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
         MensajeError = ex.ToString();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #20
0
 public Boolean ModificarDB(ct_GrupoEmpresarial_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_GrupoEmpresarial.FirstOrDefault(minfo => minfo.IdGrupoEmpresarial == info.IdGrupoEmpresarial);
             if (contact != null)
             {
                 contact.GrupoEmpresarial = info.GrupoEmpresarial;
                 contact.Estado           = info.Estado;
                 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();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #21
0
 public bool AnularDB(ct_grupo_x_Tipo_Gasto_Info info)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             ct_grupo_x_Tipo_Gasto Entity = context.ct_grupo_x_Tipo_Gasto.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipo_Gasto == info.IdTipo_Gasto);
             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.ToString();
         throw new Exception(ex.ToString());
     }
 }
Beispiel #22
0
        public ct_punto_cargo_Info Get_Info_Punto_cargo(int idEmpresa, int idPunto_cargo)
        {
            try
            {
                ct_punto_cargo_Info Obj = new ct_punto_cargo_Info();

                using (EntitiesDBConta oEnti = new EntitiesDBConta())
                {
                    var Query = from q in oEnti.ct_punto_cargo
                                where q.IdEmpresa == idEmpresa &&
                                q.IdPunto_cargo == idPunto_cargo
                                select q;
                    foreach (var item in Query)
                    {
                        Obj.IdEmpresa           = item.IdEmpresa;
                        Obj.IdPunto_cargo       = item.IdPunto_cargo;
                        Obj.codPunto_cargo      = item.codPunto_cargo;
                        Obj.nom_punto_cargo     = item.nom_punto_cargo;
                        Obj.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo;
                        Obj.Estado = item.Estado.TrimEnd();
                    }
                }
                return(Obj);
            }
            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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #23
0
        public void Get_SaldoContableMesAnterior(int idempresa, string IdCtaCble, DateTime Fecha, ref decimal Saldo, ref string MensajeError)
        {
            try
            {
                EntitiesDBConta db      = new EntitiesDBConta();
                var             select_ = from A in db.ct_cbtecble
                                          join B in db.ct_cbtecble_det on new { A.IdEmpresa, A.IdCbteCble, A.IdTipoCbte } equals new { B.IdEmpresa, B.IdCbteCble, B.IdTipoCbte }
                where
                A.IdEmpresa == idempresa &&
                B.IdCtaCble == IdCtaCble &&
                A.cb_Fecha < Fecha
                group B by new  { B.IdEmpresa }
                into grupvalor
                                select new { grupvalor.Key, total = grupvalor.Sum(p => p.dc_Valor) };


                foreach (var item in select_)
                {
                    Saldo = Convert.ToDecimal(item.total);
                }
            }
            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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #24
0
        public Boolean AnularDB(ct_punto_cargo_Info Info)
        {
            try
            {
                using (EntitiesDBConta oEnti = new EntitiesDBConta())
                {
                    var registro = oEnti.ct_punto_cargo.FirstOrDefault(A => A.IdEmpresa == Info.IdEmpresa && A.IdPunto_cargo == Info.IdPunto_cargo);

                    if (registro != null)
                    {
                        registro.Estado = "I";
                        oEnti.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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #25
0
        public Boolean GrabarDB(ct_centro_costo_sub_centro_costo_Info info)
        {
            try
            {
                using (EntitiesDBConta OECentroCost = new EntitiesDBConta())
                {
                    ct_centro_costo_sub_centro_costo subCentro = new ct_centro_costo_sub_centro_costo();

                    subCentro.IdEmpresa     = info.IdEmpresa;
                    subCentro.IdCentroCosto = info.IdCentroCosto;
                    subCentro.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo = GetIdSubCentroCosto(info.IdEmpresa);
                    subCentro.cod_subcentroCosto             = info.cod_subcentroCosto;
                    subCentro.Centro_costo = info.Centro_costo;
                    subCentro.pc_Estado    = info.pc_Estado;
                    subCentro.IdCtaCble    = info.IdCtaCble;

                    OECentroCost.ct_centro_costo_sub_centro_costo.Add(subCentro);
                    OECentroCost.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();
                throw new Exception(ex.ToString());
            }
        }
        public Boolean ModificarDB(ct_GrupoEmpresarial_plancta_Info info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    var contact = context.ct_GrupoEmpresarial_plancta.FirstOrDefault(minfo => minfo.IdCuenta_gr == info.IdCuenta_gr);

                    if (contact != null)
                    {
                        contact.pc_Cuenta_gr     = info.pc_Cuenta_gr.Trim();
                        contact.IdCuentaPadre_gr = (info.IdCuentaPadre_gr.Trim() == "") ? null : info.IdCuentaPadre_gr;
                        contact.pc_Naturaleza    = info.pc_Naturaleza;
                        contact.IdNivelCta_gr    = Convert.ToByte(info.IdNivelCta_gr);
                        contact.IdGrupoCble_gr   = info.IdGrupoCble_gr;
                        contact.pc_Estado        = info.pc_Estado;
                        contact.pc_EsMovimiento  = info.pc_EsMovimiento;

                        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();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #27
0
        public Boolean AnularDB(ct_centro_costo_sub_centro_costo_Info _Info)
        {
            try
            {
                using (EntitiesDBConta context = new EntitiesDBConta())
                {
                    ct_centro_costo_sub_centro_costo subCentro = context.ct_centro_costo_sub_centro_costo.FirstOrDefault(v => v.IdCentroCosto == _Info.IdCentroCosto && v.IdEmpresa == _Info.IdEmpresa && v.IdCentroCosto_sub_centro_costo == _Info.IdCentroCosto_sub_centro_costo);
                    if (subCentro != null)
                    {
                        subCentro.pc_Estado = "I";
                        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();
                throw new Exception(ex.ToString());
            }
        }
        public Boolean GrabarDB(ct_GrupoEmpresarial_plancta_Info Info)
        {
            try
            {
                List <ct_GrupoEmpresarial_plancta_Info> Lst = new List <ct_GrupoEmpresarial_plancta_Info>();
                using (EntitiesDBConta Context = new EntitiesDBConta())
                {
                    var Address = new ct_GrupoEmpresarial_plancta();

                    Address.IdCuenta_gr      = Info.IdCuenta_gr;
                    Address.pc_Cuenta_gr     = Info.pc_Cuenta_gr;
                    Address.IdCuentaPadre_gr = Info.IdCuentaPadre_gr;
                    Address.pc_Naturaleza    = Info.pc_Naturaleza;
                    Address.IdNivelCta_gr    = Info.IdNivelCta_gr;
                    Address.IdGrupoCble_gr   = Info.IdGrupoCble_gr;
                    Address.pc_EsMovimiento  = Info.pc_EsMovimiento;
                    Address.pc_Estado        = Info.pc_Estado;

                    Context.ct_GrupoEmpresarial_plancta.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.ToString();
                throw new Exception(ex.ToString());
            }
        }
Beispiel #29
0
 public Boolean EliminarDB(ct_Cbtecble_det_Info _CbteCbleInfo, ref string MensajeError)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_cbtecble_det.FirstOrDefault(tbCbteCble => tbCbteCble.IdEmpresa == _CbteCbleInfo.IdEmpresa && tbCbteCble.IdTipoCbte == _CbteCbleInfo.IdTipoCbte && tbCbteCble.IdCbteCble == _CbteCbleInfo.IdCbteCble);
             if (contact != null)
             {
                 context.ct_cbtecble_det.Remove(contact);
                 context.SaveChanges();
                 context.Dispose();
             }
         }
         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());
     }
 }
Beispiel #30
0
 public Boolean ModificarDB(ct_Plancta_nivel_Info _PCninfo)
 {
     try
     {
         using (EntitiesDBConta context = new EntitiesDBConta())
         {
             var contact = context.ct_plancta_nivel.FirstOrDefault(Pcta_info => Pcta_info.IdNivelCta == _PCninfo.IdNivelCta && Pcta_info.IdEmpresa == _PCninfo.IdEmpresa);
             if (contact != null)
             {
                 contact.IdEmpresa      = _PCninfo.IdEmpresa;
                 contact.IdNivelCta     = Convert.ToByte(_PCninfo.IdNivelCta);
                 contact.nv_NumDigitos  = Convert.ToByte(_PCninfo.nv_NumDigitos);
                 contact.nv_Descripcion = _PCninfo.nv_Descripcion;
                 contact.Estado         = _PCninfo.Estado;
                 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();
         throw new Exception(ex.ToString());
     }
 }