示例#1
0
        public int Grabar(cliente item)
        {
            int i = 0;

            PersonaPr.Instancia.Grabar(item.fkpersona);
            using (ispDB db = new ispDB())
            {
                try
                {
                    db.BeginTransaction();
                    if (item.idpersona == 0)
                    {
                        item.idpersona = item.fkpersona.id;
                    }
                    db.InsertOrReplace(item);
                    db.CommitTransaction();
                }
                catch (Exception)
                {
                    db.RollbackTransaction();
                    throw;
                }
                return(i);
            }
        }
示例#2
0
文件: BodegaPr.cs 项目: ferbenor/moro
        public List <bodega> Registros(string expresion = null, params object[] parametros)
        {
            List <bodega> registros = null;

            using (ispDB db = new ispDB())
            {
                //this.lsEmpresa = db.empresas.OrderBy(x => x.nombre).ToList();
                //this.lsOperadoras = db.operadorastelefonias.OrderBy(x => x.nombre).ToList();

                registros = db.bodegas.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).OrderBy(x => x.descripcion).Select(x =>
                                                                                                                                                     x.Relacionar(x.fkbarrio).Relacionar(x.fkusuario).Relacionar(x.fksucursale)).ToList();

                //registros = db.bodegas.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).ToList();


                //RELACIONAMOS EMPRESAS Y OPERADORAS TELEFONICAS
                //registros = registros.Join(this.lsEmpresa, x => x.idempresa, y => y.id, (x, y) => x.Relacionar(y)).ToList();

                //for (int i = 0; i < registros.Count; i++)
                //{
                //    sucursal item = registros[i];
                //    item.fktelefonossucursal = item.fktelefonossucursal.Join(this.lsOperadoras, x => x.idoperadoratelefonia, y => y.id, (x, y) => x.Relacionar(y)).ToList();
                //}
            }
            return(registros);
        }
示例#3
0
        public static object ColumnasPorTabla(string valor, params object[] parametros)
        {
            using (ispDB db = new ispDB())
            {
                LinqToDB.SchemaProvider.GetSchemaOptions GetSchemaOptions =
                    new LinqToDB.SchemaProvider.GetSchemaOptions();

                LinqToDB.SchemaProvider.TableSchema ts = new LinqToDB.SchemaProvider.TableSchema();

                var sp = db.DataProvider.GetSchemaProvider();
                LinqToDB.SchemaProvider.DatabaseSchema dbs = sp.GetSchema(db, GetSchemaOptions);

                List <ColumnaSis> cols = dbs.Tables.Where(x => x.TableName == parametros[0].ToString()).SingleOrDefault().Columns.Select(x => new ColumnaSis()
                {
                    ColumnName = x.ColumnName, ColumnType = x.ColumnName, DataType = x.DataType, Description = x.Description, IsIdentity = x.IsIdentity, IsNullable = x.IsNullable, IsPrimaryKey = x.IsPrimaryKey, MemberName = x.MemberName, MemberType = x.MemberType, PrimaryKeyOrder = x.PrimaryKeyOrder, SystemType = x.SystemType, SkipOnInsert = x.SkipOnInsert, SkipOnUpdate = x.SkipOnUpdate, Table = x.Table
                }).ToList();

                if (cols.Count > 0)
                {
                    cols.Add(new ColumnaSis()
                    {
                        ColumnName = "modificado"
                    });
                }

                return(cols);
            }
        }
示例#4
0
        public List <cliente> Registros(string expresion, params object[] parametros)
        {
            List <cliente> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.clientes.Where(String.IsNullOrEmpty(expresion) ? "idpersona == -1" : expresion, parametros).Select(x =>
                                                                                                                                  //CONYUGE, PERSONA, ESTADOSPERSONA
                                                                                                                                  x.Relacionar(
                                                                                                                                      x.fkconyuge,
                                                                                                                                      x.fkpersona.Relacionar(
                                                                                                                                          x.fkpersona.fkestadospersona)
                                                                                                                                      //BARRIO, PARROQUIA, CANTON, PROVINCIA
                                                                                                                                      ).Relacionar(x.fkbarrio.Relacionar(
                                                                                                                                                       x.fkbarrio.fkparroquia.Relacionar(
                                                                                                                                                           x.fkbarrio.fkparroquia.fkcantone.Relacionar(
                                                                                                                                                               x.fkbarrio.fkparroquia.fkcantone.fkprovincia)))
                                                                                                                                                   )).ToList();
            }

            for (int i = 0; i < registros.Count; i++)
            {
                registros[i] = CargarRelaciones(registros[i]);
            }

            return(registros);
        }
示例#5
0
        public List <contable> Registros(string expresion = null, params object[] parametros)
        {
            List <contable>        registros;
            List <detallecontable> detalles;

            using (ispDB db = new ispDB())
            {
                detalles = db.detallescontables.Where(String.IsNullOrEmpty(expresion) ? "numerocontable > -1" : expresion, parametros).OrderBy(x => x.tipomovimiento).ThenBy(x => x.fkcuentascontable.codigo).Select(x =>
                                                                                                                                                                                                                     //CONYUGE, PERSONA, ESTADOSPERSONA
                                                                                                                                                                                                                     x.Relacionar(
                                                                                                                                                                                                                         x.fkcuentascontable
                                                                                                                                                                                                                         ).Relacionar(
                                                                                                                                                                                                                         x.fkcontable.Relacionar(
                                                                                                                                                                                                                             x.fkcontable.fkpersona).Relacionar(x.fkcontable.fkfraccionperiodo.Relacionar(x.fkcontable.fkfraccionperiodo.fkperiodo))
                                                                                                                                                                                                                         )).ToList();
            }
            //if (detalles.Count > 0)

            registros = detalles.GroupBy(x => new { x.fkcontable.idperiodo, x.fkcontable.idtipocontable, x.fkcontable.numero }).Select(x =>
                                                                                                                                       new contable(x.First().fkcontable)
            {
                fktiposcontable     = this.ListaTipoContable.Find(y => y.id == x.First().fkcontable.idtipocontable),
                fkdetallescontables = x.ToList()
            }).OrderBy(x => x.fkfraccionperiodo.fkperiodo.anio).ThenBy(x => x.fktiposcontable.descripcion).ThenBy(x => x.fecha).ToList();

            return(registros);
        }
示例#6
0
        public List <conveniopago> Registros(string expresion = null, params object[] parametros)
        {
            List <conveniopago> registros = null;

            using (ispDB db = new ispDB())
            {
                this.ListaFormaPago = db.formaspagos.ToList();
                registros           = (from op in db.ordenespedidos.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros)
                                       from id in db.identificadorespagos.Where(x => x.id == op.ididentificadorpago)
                                       from cp in db.conveniospagos.Where(x => x.identificadorpagos == id.id)
                                       join pg in db.pagos.DefaultIfEmpty() on new { cp.identificadorpagos, cp.idformapago } equals new { pg.identificadorpagos, pg.idformapago }
                                       into gpg
                                       select new conveniopago()
                {
                    identificadorpagos = cp.identificadorpagos,
                    idformapago = cp.idformapago,
                    fkformaspago = cp.fkformaspago,
                    fkpagos = gpg.ToList()
                }).ToList();
            }
            for (int i = 0; i < registros.Count; i++)
            {
                registros[i] = CargarRelaciones(registros[i]);
            }
            return(registros);
        }
示例#7
0
        public int Borrar(object unItem)
        {
            contable item = (contable)unItem;
            int      i    = 0;

            //VERIFICAMOS PERIODO
            if (PeriodoPr.PeriodoCerrado((short)item.fecha.Year, (short)item.fecha.Month))
            {
                throw new Exception("Periodo cerrado no se puede continuar");
            }

            //CONTRA ASIENTO PARA ANULAR CONTABLE
            using (ispDB db = new ispDB())
            {
                try
                {
                    db.BeginTransaction();
                    item.esanulado = true;
                    i = db.InsertOrReplace(item);
                    db.CommitTransaction();
                }
                catch (Exception)
                {
                    db.RollbackTransaction();
                    throw;
                }
            }
            return(i);
        }
示例#8
0
 public static int GrabarDetalle<T>(this IEnumerable<T> lista, string expresionDelete, params object[] parametros) where T : Instrumental1
 {
     int i = 0; int x = 0;
     using (ispDB db = new ispDB())
     {
         try
         {
             db.BeginTransaction();
             db.GetTable<T>().Where(expresionDelete, parametros).Delete();
             int total = lista.Count();
             for (int ix = 0; ix < total; ix++)
             {
                 T objeto = lista.ElementAt(ix);
                 x = db.Insert<T>(objeto);
                 if (i == 0)
                     i = x;
             }
             db.CommitTransaction();
         }
         catch (Exception)
         {
             i = 0;
             db.RollbackTransaction();
             throw;
         }
     }
     return i;
 }
示例#9
0
        public List <sucursal> Registros(string expresion = null, params object[] parametros)
        {
            List <sucursal> registros = null;

            using (ispDB db = new ispDB())
            {
                this.lsEmpresa    = db.empresas.OrderBy(x => x.nombre).ToList();
                this.lsOperadoras = db.operadorastelefonias.OrderBy(x => x.nombre).ToList();

                //registros = db.oficinas.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).OrderBy(x => x.nombre).Select(x =>
                //x.Relacionar(x.fkbarrio).Relacionar(x.fkpersona)).ToList();

                registros = db.sucursales.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros)
                            .GroupJoin(
                    db.telefonossucursales.DefaultIfEmpty(), x => x.id, y => y.idsucursal, (x, y) => x.Relacionar(y.ToList()).Relacionar(x.fkbarrio).Relacionar(x.fkpersona)).ToList();

                //RELACIONAMOS EMPRESAS Y OPERADORAS TELEFONICAS
                registros = registros.Join(this.lsEmpresa, x => x.idempresa, y => y.id, (x, y) => x.Relacionar(y)).ToList();

                for (int i = 0; i < registros.Count; i++)
                {
                    sucursal item = registros[i];
                    item.fktelefonossucursal = item.fktelefonossucursal.Join(this.lsOperadoras, x => x.idoperadoratelefonia, y => y.id, (x, y) => x.Relacionar(y)).ToList();
                }
            }
            return(registros);
        }
示例#10
0
        public List <usuario> Registros(string expresion = null, params object[] parametros)
        {
            List <usuario> registros = null;

            using (ispDB db = new ispDB())
            {
                if (General.ipLocal == null)
                {
                    General.ipLocal = db.QueryProc <string>("inet_client_addr()").Single();
                }
                registros = db.usuarios.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).GroupJoin(
                    db.usuariosperfiles, x => x.id, y => y.idusuario, (x, y) => new usuario()
                {
                    id             = x.id,
                    idpersona      = x.idpersona,
                    loginusuario   = x.loginusuario,
                    multisesion    = x.multisesion,
                    ReseteaClave   = x.ReseteaClave,
                    activo         = x.activo,
                    administrador  = x.administrador,
                    clave          = x.clave,
                    descripcion    = x.descripcion,
                    diasvigencia   = x.diasvigencia,
                    fechacambio    = x.fechacambio,
                    fechacreacion  = x.fechacreacion,
                    fkpersona      = x.fkpersona,
                    MenusAsignados = (y.Count() == 0 ? false : true)
                }).ToList();
            }

            return(registros);
        }
示例#11
0
 public List <tipocolumna> TiposColumnas()
 {
     using (ispDB db = new ispDB())
     {
         this.listaTiposColumnas = db.tiposcolumnas.ToList();
         return(listaTiposColumnas);
     }
 }
示例#12
0
 public static object Sucursales(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.sucursales.OrderBy(x => x.nombre).Where(x => (x.nombre.Contains(valor) || (x.direccion.ToUpper()).Contains(valor.ToUpper()))).Take(100).ToList();
         return(a);
     }
 }
示例#13
0
 public static object Usuarios(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.usuarios.OrderBy(x => x.descripcion).Where(x => (x.descripcion.Contains(valor) || (x.fkpersona.nombre.ToUpper()).Contains(valor.ToUpper()))).Select(x => x.Relacionar(x.fkpersona)).Take(100).ToList();
         return(a);
     }
 }
示例#14
0
 public List <alineacion> Alineaciones()
 {
     using (ispDB db = new ispDB())
     {
         this.listaAlineaciones = db.alineaciones.ToList();
         return(this.listaAlineaciones);
     }
 }
示例#15
0
 public static object Barrios(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.barrios.OrderBy(x => x.nombre).Where(x => (x.nombre.Contains(valor) || (x.fkparroquia.nombre.ToUpper() + " " + x.fkparroquia.fkcantone.nombre.ToUpper() + " " + x.fkparroquia.fkcantone.fkprovincia.nombre.ToUpper()).Contains(valor.ToUpper()))).Select(x => x.Relacionar(x.fkparroquia.Relacionar(x.fkparroquia.fkcantone.Relacionar(x.fkparroquia.fkcantone.fkprovincia)))).Take(100).ToList();
         return(a);
     }
 }
示例#16
0
 public static object Bodegas(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.bodegas.OrderBy(x => x.descripcion).Where(x => (x.descripcion.Contains(valor) || (x.codigo.ToUpper()).Contains(valor.ToUpper()) || (x.fkusuario.descripcion.ToUpper()).Contains(valor.ToUpper()))).Take(100).ToList();
         return(a);
     }
 }
示例#17
0
 public static object Productos(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.productos.OrderBy(x => x.descripcion).Where(x => (x.codigo.Contains(valor) || (x.descripcion.Contains(valor) || (x.fkmarca.descripcion.Contains(valor))))).Select(x => x.Relacionar(x.fkmarca)).ToList();
         return(a);
     }
 }
示例#18
0
 public static object Personas(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.personas.OrderBy(x => x.apellido).ThenBy(x => x.nombre).Where(x => (x.identificacion.Contains(valor) || (x.apellido.ToUpper() + " " + x.nombre.ToUpper()).Contains(valor.ToUpper()))).ToList();
         return(a);
     }
 }
示例#19
0
 public static object Clientes(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.clientes.OrderBy(x => x.fkpersona.apellido).ThenBy(x => x.fkpersona.nombre).Where(x => (x.fkpersona.identificacion.Contains(valor) || (x.fkpersona.apellido.ToUpper() + " " + x.fkpersona.nombre.ToUpper()).Contains(valor.ToUpper()))).Select(x => x.Relacionar(x.fkpersona, x.fkconyuge)).ToList();
         return(a);
     }
 }
示例#20
0
 public static object CuentasContablesDeGrupo(string valor)
 {
     using (ispDB db = new ispDB())
     {
         var a = db.cuentascontables.Where(x => (x.codigo.Contains(valor) || x.nombre.ToUpper().Contains(valor.ToUpper())) && x.esgrupo == true).ToList();
         return(a);
     }
 }
示例#21
0
 private List <menu> RegistrosAux()
 {
     using (ispDB db = new ispDB())
     {
         listaPadres = db.menus.OrderBy(x => x.nombre).Where(x => x.contenedor == true).ToList();
         listaPadres.Add(new menu());
     }
     return(listaPadres);
 }
示例#22
0
文件: GeneroPr.cs 项目: ferbenor/moro
 public List<genero> Registros(string expresion = null, params object[] parametros)
 {
     List<genero> registros = null;
     using (ispDB db = new ispDB())
     {
         registros = db.generos.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).ToList();
     }
     return registros;
 }
示例#23
0
        private menu RegistroAux(short unId)
        {
            menu objeto;

            using (ispDB db = new ispDB())
            {
                objeto = db.menus.Where(x => x.id == unId).First();
            }
            return(objeto);
        }
示例#24
0
        public List <parametrogeneral> Registros(string expresion = null, params object[] parametros)
        {
            List <parametrogeneral> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.parametrosgenerales.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).OrderBy(x => x.nombre).ToList();
            }
            return(registros);
        }
示例#25
0
        public List <iteminventario> Registros(string expresion = null, params object[] parametros)
        {
            List <iteminventario> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.itemsinventarios.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).OrderBy(x => x.descripcion).ToList();
            }
            return(registros);
        }
示例#26
0
        public List <estadopersona> Registros(string expresion = null, params object[] parametros)
        {
            List <estadopersona> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.estadospersonas.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).ToList();
            }
            return(registros);
        }
示例#27
0
        public List <unidaddemedida> Registros(string expresion = null, params object[] parametros)
        {
            List <unidaddemedida> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.unidadesdemedidas.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).ToList();
            }
            return(registros);
        }
示例#28
0
        public List <estadoordenpedido> Registros(string expresion = null, params object[] parametros)
        {
            List <estadoordenpedido> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.estadosordenespedidos.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).OrderBy(x => x.id).ToList();
            }
            return(registros);
        }
示例#29
0
        public List <tipocontable> Registros(string expresion = null, params object[] parametros)
        {
            List <tipocontable> registros = null;

            using (ispDB db = new ispDB())
            {
                registros = db.tiposcontables.Where(String.IsNullOrEmpty(expresion) ? "id > -1" : expresion, parametros).ToList();
            }
            return(registros);
        }
示例#30
0
文件: PerfilPr.cs 项目: ferbenor/moro
        public static List <perfil> RegistrosCombo()
        {
            List <perfil> lista;

            using (ispDB db = new ispDB())
            {
                lista = db.perfiles.Where(x => x.activo == true).ToList();
            }
            return(lista);
        }