コード例 #1
0
        public bool Update()
        {
            try
            {
                int miId = (from r in CommonBC.ModeloRegistroAcceso.RegistroAcceso
                            where r.Patente == this.Patente
                            orderby r.FechaIngreso
                            select r.Id).Last();

                CapaDeDatos.RegistroAcceso registroAcceso = CommonBC.ModeloRegistroAcceso.RegistroAcceso.First(f => f.Id == miId);

                registroAcceso.Marca          = this.Marca;
                registroAcceso.Color          = this.Color;
                registroAcceso.TipoPersonal   = this.TipoPersonal;
                registroAcceso.NombrePersonal = this.NombrePersonal;
                registroAcceso.FechaIngreso   = this.FechaIngreso;
                registroAcceso.FechaSalida    = this.FechaSalida;

                CommonBC.ModeloRegistroAcceso.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #2
0
        public bool Read()
        {
            try
            {
                int miId = (from r in CommonBC.ModeloRegistroAcceso.RegistroAcceso
                            where r.Patente == this.Patente
                            orderby r.FechaIngreso ascending
                            select r.Id).Last();

                CapaDeDatos.RegistroAcceso registroAcceso = CommonBC.ModeloRegistroAcceso.RegistroAcceso.First(f => f.Id == miId);


                this.Id             = registroAcceso.Id;
                this.Marca          = registroAcceso.Marca;
                this.Color          = registroAcceso.Color;
                this.TipoPersonal   = registroAcceso.TipoPersonal;
                this.NombrePersonal = registroAcceso.NombrePersonal;
                this.FechaIngreso   = registroAcceso.FechaIngreso;
                //if (registroAcceso.FechaSalida != null) {
                this.FechaSalida = (DateTime)registroAcceso.FechaSalida;
                //}

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #3
0
        public bool Delete()
        {
            try
            {
                CapaDeDatos.RegistroAcceso registro = CommonBC.ModeloRegistroAcceso.RegistroAcceso.Find(this.Id);

                CommonBC.ModeloRegistroAcceso.RegistroAcceso.Remove(registro);
                CommonBC.ModeloRegistroAcceso.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #4
0
        public bool Create()
        {
            try
            {
                CapaDeDatos.RegistroAcceso registroAcceso = new CapaDeDatos.RegistroAcceso();

                registroAcceso.Patente        = this.Patente;
                registroAcceso.Marca          = this.Marca;
                registroAcceso.Color          = this.Color;
                registroAcceso.TipoPersonal   = this.TipoPersonal;
                registroAcceso.NombrePersonal = this.NombrePersonal;
                registroAcceso.FechaIngreso   = this.FechaIngreso;

                CommonBC.ModeloRegistroAcceso.RegistroAcceso.Add(registroAcceso);
                CommonBC.ModeloRegistroAcceso.SaveChanges();


                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }