Exemple #1
0
        private void _btnConsultarClientes_Click(object sender, EventArgs e)
        {
            int unIdCliente = BuscarListaPr.BuscarCliente();

            if (unIdCliente > -1)
            {
                //this.objetoLocal.fkpersona = pero.Instancia.RegistroPorId(unIdCliente);
                this.CargarControlesAdicionales();
            }
        }
Exemple #2
0
        private void txtBuscarSector_ButtonCustomClick(object sender, EventArgs e)
        {
            cliente unCliente = ClientePr.Instancia.RegistroPorId((int)BuscarListaPr.BuscarBarrio());

            if (unCliente != null)
            {
                this.txtBuscarSector.Text = unCliente.nombrecompleto;
                this.txtBuscarSector.Tag  = unCliente.id;
            }
        }
Exemple #3
0
        public string BuscarBeneficiario(ref object unObjetoLocal)
        {
            contable registro = (contable)unObjetoLocal;
            persona  objeto   = (persona)BuscarListaPr.BuscarBeneficiarios();

            if (objeto != null)
            {
                registro.fkpersona = objeto;
            }
            return(registro.fkpersona.ToString());
        }
Exemple #4
0
        void objetoGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewColumn campo = null;

            try
            {
                if (e.ColumnIndex == 2 && e.RowIndex > -1)
                {
                    campo = (DataGridViewColumn)((DataGridView)sender).Columns[((DataGridView)sender).Columns[e.ColumnIndex].Tag.ToString()];
                    campo.DataGridView.CurrentCell = campo.DataGridView.CurrentRow.Cells[campo.Index];
                    if (campo.DataGridView.CurrentRow.Index == campo.DataGridView.NewRowIndex)
                    {
                        campo.DataGridView.EndEdit();
                    }
                    //if (!campo.DataGridView.IsCurrentCellDirty)
                    //    campo.DataGridView.NotifyCurrentCellDirty(true);
                    //else
                    //    campo.DataGridView.NotifyCurrentCellDirty(false);
                    object objeto = BuscarListaPr.BuscarFormaPago();
                    if (objeto != null)
                    {
                        objeto = CrearConvenio(objeto, campo.DataGridView.CurrentRow == null ? null : campo.DataGridView.CurrentRow.DataBoundItem);
                        if (objeto != null)
                        {
                            ////campo.DataGridView.NotifyCurrentCellDirty(false);
                            ////campo.DataGridView.BeginEdit(false);
                            //campo.DataGridView.InvalidateRow(campo.DataGridView.CurrentRow.Index);
                            ////campo.DataGridView.CurrentRow.Cells["colFormaPago"].Value = objeto;
                            ////campo.DataGridView.CurrentRow.DataBoundItem = objeto;
                            //campo.DataGridView.EndEdit();
                        }
                        else
                        {
                            campo.DataGridView.CancelEdit();
                        }
                    }
                    else
                    {
                        campo.DataGridView.EndEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                if (campo != null)
                {
                    campo.DataGridView.NotifyCurrentCellDirty(false);
                    campo.DataGridView.CancelEdit();
                }
                General.Mensaje(ex.Message.ToString());
            }
        }
Exemple #5
0
        public void Buscar(object unObjeto, bool buscar = true)
        {
            cliente objeto = unObjeto as cliente;

            try
            {
                DialogResult respuesta = DialogResult.Yes;
                if (objeto == null)
                {
                    objeto = new cliente();
                }
                if (buscar == true)
                {
                    object valor = BuscarListaPr.BuscarCliente();
                    if (valor != null)
                    {
                        //Cliente clienteEncontrado = this.proveedor.RegistroPorId((int)valor);
                        //if (clienteEncontrado != null)
                        //{
                        //    objeto = clienteEncontrado;
                        //    respuesta = DialogResult.Yes;
                        //}
                        //else
                        //    respuesta = DialogResult.No;
                    }
                    else
                    {
                        respuesta = DialogResult.No;
                    }
                }
                //if (buscar == false)
                //    objeto = this.proveedor.RegistroPorId(objeto.Id);

                if (respuesta == DialogResult.Yes)
                {
                    this.RaiseCargaVista(objeto);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    General.Mensaje(ex.Message);
                }
                else
                {
                    General.Mensaje(ex.InnerException.Message);
                }
            }
            finally { }
        }
Exemple #6
0
        public string BuscarObjeto(ref object unObjetoLocal, short unaOpcion)
        {
            //Cliente registro = (Cliente)unObjetoLocal;
            ModeloDB.cliente registro      = (ModeloDB.cliente)unObjetoLocal;
            string           valorDevuelto = null;

            switch (unaOpcion)
            {
            case 1:
            {
                //Persona entidad = (Persona)BuscarListaPr.BuscarPersona();
                ModeloDB.persona entidad = (ModeloDB.persona)BuscarListaPr.BuscarPersona();
                if (entidad != null)
                {
                    registro.idconyuge = entidad.id;
                    registro.fkconyuge = entidad;
                    valorDevuelto      = registro.fkconyuge.ToString();
                }
            }
            break;

            case 3:
            {
                ModeloDB.barrio entidad = BarrioPr.Instancia.RegistroPorId((int)BuscarListaPr.BuscarBarrio());
                if (entidad != null)
                {
                    registro.idbarrio = entidad.id;
                    registro.fkbarrio = entidad;
                    valorDevuelto     = entidad.ToString();
                }
            }
            break;

            case 4:
            {
                ModeloDB.profesion entidad = ProfesionPr.Instancia.RegistroPorId((short)BuscarListaPr.BuscarProfesion());
                if (entidad != null)
                {
                    registro.idprofesion  = entidad.id;
                    registro.fkprofesione = entidad;
                    valorDevuelto         = entidad.ToString();
                }
            }
            break;
            }
            return(valorDevuelto);
        }
Exemple #7
0
        public string BuscarObjeto(ref object unObjetoLocal, short unaOpcion)
        {
            cliente registro      = (cliente)unObjetoLocal;
            string  valorDevuelto = null;

            switch (unaOpcion)
            {
            case 1:
            {
                persona entidad = (persona)BuscarListaPr.BuscarPersona();
                if (entidad != null)
                {
                    registro.fkconyuge = entidad;
                    valorDevuelto      = registro.fkconyuge.ToString();
                }
            }
            break;

            case 3:
            {
                barrio entidad = (barrio)BuscarListaPr.BuscarBarrio();
                if (entidad != null)
                {
                    registro.fkbarrio = entidad;
                    valorDevuelto     = entidad.ToString();
                }
            }
            break;

            case 4:
            {
                profesion entidad = (profesion)BuscarListaPr.BuscarProfesion();
                if (entidad != null)
                {
                    registro.fkprofesione = entidad;
                    valorDevuelto         = entidad.ToString();
                }
            }
            break;
            }
            return(valorDevuelto);
        }
Exemple #8
0
        static void Main(string[] args)
        {
            using (ispDB db = new ispDB())
            {
                barrio barr      = db.barrios.Where(x => x.id == 1).SingleOrDefault();
                var    registros =
                    (from op in db.inventarios
                     from dt in db.detallesinventarios.Where(x => x.idperiodo == op.idperiodo && x.tipo == op.tipo && x.numero == op.numero).DefaultIfEmpty()
                     group dt by op
                     into gr
                     select gr.Key.Relacionar(gr.ToList())
                    ).ToList();


                //db.inventarios.GroupJoin(db.detallesinventarios, x => x, y => y.fkinventario, (x, y) => x).ToList();

                //(from op in db.inventarios
                // join dt in db.detallesinventarios on op equals dt.fkinventario
                // //into gr
                // join pr in db.productos on dt.fkproducto equals pr
                // select gr.ToList()

                //).ToList();
            }

            NameValueCollection conf = (NameValueCollection)ConfigurationManager.AppSettings;

            object aaaa = BuscarListaPr.BuscarObjeto(TipoConsulta.ColumnasPorTabla, true, true, "barrios");

            using (ispDB db = new ispDB())
            {
                var sp = db.DataProvider.GetSchemaProvider();
                LinqToDB.SchemaProvider.DatabaseSchema aaa = sp.GetSchema(db, new LinqToDB.SchemaProvider.GetSchemaOptions()
                {
                    ExcludedSchemas = new string[] { "empresas" }
                });
            }
            List <prd> prod = new List <prd>()
            {
                new prd()
                {
                    Codigo = 1, TipoPago = new List <pg>()
                    {
                        new pg()
                        {
                            Id = 1, Descripcion = ""
                        }, new pg()
                        {
                            Id = 2, Descripcion = ""
                        }
                    }
                },
                new prd()
                {
                    Codigo = 1, TipoPago = new List <pg>()
                    {
                        new pg()
                        {
                            Id = 1, Descripcion = ""
                        }
                    }
                }
            }
            ;

            object res = prod.Where(x => x.TipoPago.FindIndex(y => y.Id == 2) > -1).ToList();
            string a   = "Hola";
            string b   = Reverse(a);

            perfil uno = new perfil()
            {
                id = 0, descripcion = "no se"
            };

            PerfilPr.Instancia.Grabar(uno);

            using (ispDB db = new ispDB())
            {
                //var lista = (from m in db.perfiles.DefaultIfEmpty()
                //              join p in db.usuariosperfiles on m.id equals p.idperfil
                //              into pm
                //              from a in pm.DefaultIfEmpty()
                //              where a.idusuario == 1 || a.idusuario == null
                //              orderby m.descripcion
                //              select new usuarioperfil()
                //              {
                //                  fkperfile = m,
                //                  idusuario = 1,
                //                  idperfil = m.id,
                //                  Asignado = (a.idperfil == null ? false : true)
                //              }).ToList();

                //var lista1 = (from m in db.menus
                //              join p in db.perfilesmenus on m.id equals p.idmenu
                //              into pm
                //              from a in pm.DefaultIfEmpty()
                //              where a.idperfil == 1 || a.idperfil == null
                //              orderby m.nombre
                //              select new perfilmenu()
                //              {
                //                  fkmenu = m,
                //                  editable = (a.editable == null ? false : a.editable),
                //                  idperfil = 1,
                //                  idmenu = m.id,
                //                  Asignado = (a.idmenu == null ? false : true)
                //              }).ToList();

                var lista = (from m in db.menus
                             from p in db.perfilesmenus
                             .Where(q => q.idmenu == m.id && (q.idperfil == 1 || q.idperfil == null)).DefaultIfEmpty()
                             where p.idperfil == 1
                             select new perfilmenu()
                {
                    fkmenu = m,
                    editable = (p.editable == null ? false : p.editable),
                    idperfil = 1,
                    idmenu = m.id,
                    Asignado = (p.idmenu == null ? false : true)
                }).ToList();

                int it = db.GetTable <perfil>().Max(x => ((short?)x.id ?? 0) + 1);

                string ax = db.LastQuery;
            }

            PerfilPr.RegistrosCombo();

            BancoPr.Instancia.Borrar(new banco()
            {
                id = 0
            });
            DocumentoPr.Instancia.Grabar(new documento()
            {
                id = 5
            });

            using (ispDB db = new ispDB())
            {
                try
                {
                    db.BeginTransaction();
                    pagoregistrado pagoreg;

                    pagoreg = db.QueryProc <pagoregistrado>(pagoregistrado.funcion,
                                                            new DataParameter("pidentificadorpagos", 0, DataType.Int32),
                                                            new DataParameter("pidformapago", 1, DataType.Int16),
                                                            new DataParameter("pnotificacion", false, DataType.Boolean),
                                                            new DataParameter("pfecha", Sql.DateTime, DataType.DateTime),
                                                            new DataParameter("pidusuariocobranza", 1, DataType.Int16),
                                                            new DataParameter("pvalor", 100, DataType.Decimal),
                                                            new DataParameter("pdetalle", "prueba", DataType.VarChar),
                                                            new DataParameter("pidusuarioregistra", 2, DataType.Int16),
                                                            new DataParameter("pidusuarioanula", -1, DataType.Int16),
                                                            new DataParameter("ttran", 1, DataType.Int16)
                                                            ).First();


                    db.CommitTransaction();

                    List <conveniopago> pago = db.
                                               pagos.Where(x => x.identificadorpagos == pagoreg.identificadorpago).Select(x =>
                                                                                                                          x.Relacionar(x.fkconveniospago
                                                                                                                                       .Relacionar(x.fkconveniospago.fkidentificadorespagos
                                                                                                                                                   ).Relacionar(x.fkconveniospago.fkformaspago)
                                                                                                                                       ).Relacionar(x.fkusuario
                                                                                                                                                    )).ToList().GroupBy(x => x.fkconveniospago, (x, y) => new conveniopago()
                    {
                        fkformaspago           = x.fkformaspago,
                        fkidentificadorespagos = x.fkidentificadorespagos,
                        fkpagos = y.ToList()
                    }).ToList();

                    identificadorpago identificador = pago.GroupBy(x => x.fkidentificadorespagos,
                                                                   (x, y) => new identificadorpago()
                    {
                        id = x.id,
                        fkconveniospago = y.ToList()
                    }).Single();
                }
                catch (Exception)
                {
                    db.RollbackTransaction();
                    throw;
                }
            }


            WhereBuilder f  = new WhereBuilder();
            string       ff = f
                              .Donde("uno", Comparacion.Igual, 1)
                              .Y("dos", Comparacion.Contiene, "f")
                              .O("fkpersona.identificacion", Comparacion.NoContiene, "070").Compilar();



            var fff = f.parametros;

            LinqToDB.SchemaProvider.GetSchemaOptions GetSchemaOptions =
                new LinqToDB.SchemaProvider.GetSchemaOptions();

            LinqToDB.SqlProvider.ISqlBuilder SqlBuilder;

            using (ispDB db = new ispDB())
            {
                SqlBuilder = db.DataProvider.CreateSqlBuilder();

                var sp = db.DataProvider.GetSchemaProvider();
                LinqToDB.SchemaProvider.DatabaseSchema db1 = sp.GetSchema(db, GetSchemaOptions);
            }
            usuario ls = UsuarioPr.Instancia.RegistroPorLogin("fer fer");


            //ClientePr c = new ClientePr();
            //Cliente nombre = c.RegistroPorId(3);
            //Cliente client;// = new Cliente();
            //client = nombre;
            //client.Nombre = client.Nombre + " Registro";
            //client.Foto = System.Drawing.Image.FromFile("c:\\a.png");
            //client.IdApoderado = 2;
            //client.IdBarrio = 2;
            //client.IdBeneficiarioMortuorio = 2;
            //client.IdBeneficiarioSeguroVida = 2;
            //client.IdConyugue = 2;
            //client.IdEstadoCivil = 2;
            //client.IdEstadoPersona = 1;
            //client.IdGenero = 1;
            //client.IdNivelEstudio = 1;
            //client.IdProfesion = 1;
            //client.IdTipoSangre = 1;
            //client.Modificado = true;
            //object resp = c.Grabar(client, null, null);



            //bool res = General.ValidarCedula("0704680421");
            //res = General.ValidarCedula("0704680420001");

            //General.periodoActual = 2014;
            //ContablePr a = new ContablePr();
            //Contable b = a.RegistroPorId(0, 1, 1);
            //Console.WriteLine(b.DetalleContable[0].DescripcionDetalleContable);

            //UsuarioSesionActiva usu = new UsuarioSesionActiva(new Usuario(1));
            //MenuSistemaPr menu = new MenuSistemaPr();
            //General.usuarioActivo = usu;


            //Console.WriteLine(usu.CadenaSelect());

            //string a = General.CifrarClave("papo 123123");

            /*Console.WriteLine(EncodePassword("PRUEBA DE ENCRIPTACION").Length);
             * Console.WriteLine(EncodePassword("WALTER PA$$w0rd").Length);
             * Console.WriteLine(EncodePassword("DAVID PODE_SERA_MIO").Length);
             * Console.WriteLine(EncodePassword("DANIEL EstaEsLa ClaveMas Grande del Mundo"));
             */


            //GC.Collect();
            Console.ReadLine();
        }