示例#1
0
        public Enrolamiento(ControlAtraso.Entity.Alumno alumno)
        {
            InitializeComponent();

            this.Run.Content = alumno.Persona.Run;

            this.Nombre.Content = alumno.Persona.Nombre;

            this.Curso.Content = alumno.Matricula.Curso;

            ControlAtraso.UI.Enrolamiento.Enrolamiento.Alumno = alumno;

            if (alumno.Persona.Enrolado)
            {
                this.Message.Content = "El alumno se encuentra enrolado";

                this.HuellaPicture.Source = new BitmapImage(new Uri("/Assets/check.png", UriKind.Relative));
            }

            if (ControlAtraso.UI.MainWindow.Capturer != null)
            {
                ControlAtraso.UI.MainWindow.Capturer.EventHandler = this;

                ControlAtraso.UI.MainWindow.Capturer.StartCapture();

                enroller = new DPFP.Processing.Enrollment();
            }
        }
示例#2
0
        private void Estado(ControlAtraso.Entity.Alumno alumno, Bitmap src)
        {
            System.IO.MemoryStream ms = null;

            if (src != null)
            {
                ms = new System.IO.MemoryStream();

                src.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

                BitmapImage image = new BitmapImage();

                image.BeginInit();

                ms.Seek(0, System.IO.SeekOrigin.Begin);

                image.StreamSource = ms;

                image.EndInit();

                HuellaPicture.Source = image;
            }

            if (alumno.Estado.Equals("Válido"))
            {
                this.Message.Content = string.Format("{0}\n{1}", alumno.Persona.Nombre, alumno.Matricula.Curso);
            }
            else
            {
                this.Message.Content = "Se ha generado un error con el registro del atraso, por favor contacte a soporte NetCore";
            }
        }
示例#3
0
        public Enrolamiento(ControlAtraso.Entity.Alumno alumno)
        {
            ControlAtraso.UI.MVVM.Model.Enrolamiento e = new UI.MVVM.Model.Enrolamiento
            {
                Run    = alumno.Persona.Run,
                Nombre = alumno.Persona.Nombre,
                Curso  = alumno.Matricula.Curso
            };

            this.SaveCommand = new CommandBase(x => this.Save());
        }
示例#4
0
        void DPFP.Capture.EventHandler.OnComplete(object capture, string readerSerialNumber, Sample sample)
        {
            DelegadoEstado delegado = new DelegadoEstado(this.Estado);

            DPFP.Capture.SampleConversion convertor = new DPFP.Capture.SampleConversion();

            Bitmap bitmap = null;

            convertor.ConvertToPicture(sample, ref bitmap);

            ControlAtraso.Entity.Alumno alumno = ControlAtraso.Alumno.Registrar(sample);

            this.Dispatcher.Invoke(delegado, alumno, bitmap);
        }
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.DataGrid.Items.Count > 0)
            {
                ControlAtraso.Entity.Alumno alumno = this.DataGrid.SelectedItems[0] as ControlAtraso.Entity.Alumno;

                if (!alumno.Estado.Equals("No válido"))
                {
                    ControlAtraso.UI.Enrolamiento.Enrolamiento.HomeEnrolamiento = this;

                    ControlAtraso.UI.Enrolamiento.Enrolamiento enrolamiento = new ControlAtraso.UI.Enrolamiento.Enrolamiento(this.DataGrid.SelectedItems[0] as ControlAtraso.Entity.Alumno);

                    NavigationService.Navigate(enrolamiento);
                }
            }
        }
示例#6
0
        public static ControlAtraso.Entity.Alumno Registrar(Sample sample)
        {
            string output = string.Empty;

            Random random = new Random();

            int indice = random.Next(0, 4);

            string startupPath = System.Environment.GetCommandLineArgs()[0];

            System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(startupPath);

            string[] claves = configuration.AppSettings.Settings["PalabrasClave"].Value.Split(',');

            string token = claves[indice];

            byte[] encryted = System.Text.Encoding.Unicode.GetBytes(token);

            token = Convert.ToBase64String(encryted);

            string url = configuration.AppSettings.Settings["targetUrl"].Value;

            url = string.Format("{0}/Registrar", url);

            string rbdCuerpo = configuration.AppSettings.Settings["rbd"].Value;

            System.Data.Linq.Binary binary = new System.Data.Linq.Binary(sample.Bytes);

            ControlAtraso.Entity.RegistroAtraso registroAtraso = new ControlAtraso.Entity.RegistroAtraso
            {
                RbdCuerpo           = int.Parse(rbdCuerpo.Substring(0, rbdCuerpo.Length - 1)),
                RbdDigito           = int.Parse(rbdCuerpo.Substring(rbdCuerpo.Length - 1, 1)),
                SostenedorId        = default(Guid),
                EstablecimientoId   = default(Guid),
                AnoNumero           = DateTime.Today.Year,
                TipoEducacionCodigo = default(int),
                GradoCodigo         = default(int),
                CursoId             = default(Guid),
                LibroClaseId        = default(Guid),
                AlumnoId            = default(Guid),
                Fecha     = DateTime.Today,
                FechaHora = DateTime.Now,
                Huella    = binary
            };

            output = JsonConvert.SerializeObject(registroAtraso, Formatting.Indented);

            byte[] data = UTF8Encoding.UTF8.GetBytes(output);

            HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;

            request.Timeout       = 10 * 1000;
            request.Method        = "POST";
            request.ContentLength = data.Length;
            request.ContentType   = "application/json; charset=utf-8";

            request.Headers.Add("token", token);

            Stream postStream = request.GetRequestStream();

            postStream.Write(data, 0, data.Length);

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            StreamReader reader = new StreamReader(response.GetResponseStream());

            string resp = reader.ReadToEnd();

            // Cerramos los streams
            reader.Close();

            postStream.Close();

            response.Close();

            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();

            ControlAtraso.Entity.Alumno alumno = javaScriptSerializer.Deserialize <ControlAtraso.Entity.Alumno>(resp);

            return(alumno);
        }