示例#1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (Once)
     {
         Matricula.Focus();
         Once = false;
     }
 }
 private void CheckInOut_Click(object sender, EventArgs e)
 {
     if (Matricula.Text.Length <= 0 || Matricula.Text.Length > 7)
     {
         MessageBox.Show("Matricula invalida, debe de tener 7 Digitos");
         Matricula.Text = "";
         Matricula.Focus();
     }
     else
     {
         if (!DM.StudentExistByMatricula(int.Parse(Matricula.Text)))
         {
             MessageBox.Show("Alumno Inexistente");
             Matricula.Text = "";
             Matricula.Focus();
         }
         else
         {
             x = DateTime.Now;
             if (!DM.IsNewReg(int.Parse(Matricula.Text)))
             {
                 if (opciones.Automatico)
                 {
                     //auto
                     CheckIn(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                 }
                 else
                 {
                     //manual
                     CheckIn(Convert.ToDateTime(Fecha_E.Value.Date.ToString("yyyy-MM-d")), Hora_E.Text);
                 }
                 Matricula.Text  = "";
                 Status.Text     = "Entrada Exitosa...";
                 AlumnoName.Text = "";
                 Matricula.Focus();
                 menu.SetStudents();
             }
             else
             {
                 if (opciones.Automatico)
                 {
                     //auto
                     CheckOut(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                 }
                 else
                 {
                     //manual
                     CheckOut(Convert.ToDateTime(Fecha_E.Value.Date.ToString("yyyy-MM-d")), Hora_E.Text);
                 }
                 Matricula.Text  = "";
                 Status.Text     = "Salida Exitosa...";
                 AlumnoName.Text = "";
                 Matricula.Focus();
                 menu.SetStudents();
             }
         }
     }
 }
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (Once)
     {
         Matricula.Focus();
         Once = false;
     }
     Time.Text = DM.GetHour(DateTime.Now.Hour, DateTime.Now.Minute);
 }
        private bool ChecarCampos()
        {
            if (Nome.Text == "")
            {
                Nome.Focus();
                return(false);
            }
            if (Matricula.Text == "")
            {
                Matricula.Focus();
                return(false);
            }
            //se nenhuma função estiver selecionada
            if (CkAdmin.IsChecked == false && CkPortaria.IsChecked == false &&
                CkCarrega.IsChecked == false && CkConfere.IsChecked == false &&
                CkDescarrega.IsChecked == false && CkEmpilha.IsChecked == false &&
                CkSepara.IsChecked == false)
            {
                return(false);
            }

            if (CkAdmin.IsChecked == true && Senha.Password == "")
            {
                Senha.Focus();
                return(false);
            }

            if (!isEditing)
            {
                if (Senha.Password != Senha2.Password)
                {
                    Senha2.Focus();
                    return(false);
                }
            }

            return(true);
        }
示例#5
0
        private void Matricula_TextChanged(object sender, EventArgs e)
        {
            //Status.Text = "";
            //if fill all numbers in one event

            if (Matricula.Text.Length == 7)
            {
                Student Temp = new Student();
                Temp = DM.GetStudentByMatricula(int.Parse(Matricula.Text));

                if (Temp != null)
                {
                    AlumnoName = Temp.Nombre + " " + Temp.Second_Name + " " + Temp.Second_Name2;
                }
                else
                {
                    AlumnoName = "Alumno Inexistente.";
                }

                SName.Text = AlumnoName;

                bool isnew = DM.IsNewReg(int.Parse(Matricula.Text));

                if (isnew)
                {
                    CheckInOut.Text      = "Salida";
                    CheckInOut.BackColor = Color.Yellow;
                }

                if (Opciones.Escaner && Temp != null)
                {
                    //auto
                    if (isnew)
                    {
                        CheckOut(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                        DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Se ha dado salida al alumno " + AlumnoName + " con exito"
                                                                                  , "SALIDA EXITOSA.", MessageBoxButtons.OK, MessageBoxIcon.Question);

                        if (Result == DialogResult.OK)
                        {
                            SName.Text = "";
                            Matricula.Focus();
                            menu.SetStudents();
                        }
                    }
                    else
                    {
                        CheckIn(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                        DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Se ha ingresado al alumno " + AlumnoName + " con exito"
                                                                                  , "ENTRADA EXITOSA.", MessageBoxButtons.OK, MessageBoxIcon.Question);

                        if (Result == DialogResult.OK)
                        {
                            SName.Text = "";
                            Matricula.Focus();
                            menu.SetStudents();
                        }
                    }
                    //DialogResult result = MessageBox.Show(Stat + " de Alumno: " + Temp.Nombre + " " + Temp.Second_Name + " " + Temp.Second_Name2 + " Exitosa", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //if (result == DialogResult.OK)
                    //{
                    //    SName.Text = "";
                    //    this.swipe(false);
                    //}
                    menu.SetStudents();
                }
            }
            else
            {
                CheckInOut.Text      = "Entrada";
                CheckInOut.BackColor = Color.SpringGreen;
            }

            //if fill one by one
            GetScannerInput(true);
        }
示例#6
0
        private void CheckInOut_Click(object sender, EventArgs e)
        {
            if (Matricula.Text.Length <= 0 || Matricula.Text.Length > 7)
            {
                DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "La matricula tiene que tener minimo 7 digitos"
                                                                          , "ERROR AL INGRESAR DATOS", MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (Result == DialogResult.OK)
                {
                    Matricula.Text = "";
                    Matricula.Focus();
                    return;
                }
            }
            else
            {
                if (!DM.StudentExistByMatricula(int.Parse(Matricula.Text)))
                {
                    DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "El alumno que ingreso no existe o los datos son incorrectos."
                                                                              , "ADVERTENCIA - ERROR AL INGRESAR DATOS", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    if (Result == DialogResult.OK)
                    {
                        Matricula.Text = "";
                        Matricula.Focus();
                        return;
                    }
                }
                else
                {
                    x = DateTime.Now;
                    if (!DM.IsNewReg(int.Parse(Matricula.Text)))
                    {
                        if (Opciones.Automatico)
                        {
                            //auto
                            CheckIn(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                        }
                        else
                        {
                            //manual
                            CheckIn(Convert.ToDateTime(Fecha_E.Value.Date.ToString("yyyy-MM-d")), Hora_E.Text);
                        }
                        Matricula.Text = "";

                        DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Se ha ingresado al alumno " + AlumnoName + " con exito"
                                                                                  , "ENTRADA EXITOSA.", MessageBoxButtons.OK, MessageBoxIcon.Question);

                        if (Result == DialogResult.OK)
                        {
                            SName.Text = "";
                            Matricula.Focus();
                            menu.SetStudents();
                        }
                    }
                    else
                    {
                        if (Opciones.Automatico)
                        {
                            //auto
                            CheckOut(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-d")), DM.GetHour(x.Hour, x.Minute));
                        }
                        else
                        {
                            //manual
                            CheckOut(Convert.ToDateTime(Fecha_E.Value.Date.ToString("yyyy-MM-d")), Hora_E.Text);
                        }
                        Matricula.Text = "";
                        DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Se ha dado salida al alumno " + AlumnoName + " con exito"
                                                                                  , "SALIDA EXITOSA.", MessageBoxButtons.OK, MessageBoxIcon.Question);

                        if (Result == DialogResult.OK)
                        {
                            SName.Text = "";
                            Matricula.Focus();
                            menu.SetStudents();
                        }
                    }
                }
            }
        }