private void timer1_Tick(object sender, EventArgs e)
 {
     if (Once)
     {
         A_Matricula.Focus();
         Once = false;
     }
 }
示例#2
0
        private void pnlData_Load(object sender, EventArgs e)
        {
            if (!FromContext)
            {
                metroCarrera.SelectedIndex  = 0;
                metroSemestre.SelectedIndex = 0;
                AddStudent.Enabled          = true;
                Cancel.Enabled        = true;
                DeleteStudent.Enabled = false;
                Edit.Enabled          = false;
                FirstLoad             = false;
                SetStudents();
                A_Matricula.Focus();
                AlumnosList.ClearSelection();
                FirstLoad = true;
            }
            else
            {
                metroCarrera.SelectedIndex  = 0;
                metroSemestre.SelectedIndex = 0;
                AddStudent.Enabled          = false;
                Cancel.Enabled        = true;
                DeleteStudent.Enabled = false;
                AlumnosList.Enabled   = false;

                A_Matricula.Enabled    = false;
                A_Nombre.Enabled       = false;
                A_ApellidoP.Enabled    = false;
                A_ApellidoM.Enabled    = false;
                metroCarrera.Enabled   = false;
                metroSemestre.Enabled  = false;
                Becario.Enabled        = false;
                ServicioSocial.Enabled = false;
                Verano.Enabled         = false;
                Invierno.Enabled       = false;

                //AlumnosList.View = View.Details;
                //SetSingleStudent(int.Parse("1427409"));
                SetSingleStudent(int.Parse(Matricula_Alumno));
                A_Matricula.Focus();
                Edit.Enabled = false;
            }
        }
        private void Edit_Click(object sender, EventArgs e)
        {
            AlumnosList.UpdateItemSubItems(SaveStudent());

            StateText.Text         = "Alumno Editado...";
            A_Matricula.Text       = "";
            A_Nombre.Text          = "";
            A_ApellidoP.Text       = "";
            A_ApellidoM.Text       = "";
            Carrera.SelectedIndex  = 0;
            Semestre.SelectedIndex = 0;
            Becario.Checked        = true;
            Verano.Checked         = true;

            A_Matricula.Focus();
            AddStudent.Enabled    = true;
            Cancel.Enabled        = true;
            DeleteStudent.Enabled = false;
            Edit.Enabled          = false;
        }
        private void AltaAlumno_Load(object sender, EventArgs e)
        {
            if (!FromContext)
            {
                Carrera.SelectedIndex  = 0;
                Semestre.SelectedIndex = 0;
                AddStudent.Enabled     = true;
                Cancel.Enabled         = true;
                DeleteStudent.Enabled  = false;
                Edit.Enabled           = false;
                AlumnosList.View       = View.Details;
                SetStudents();
                A_Matricula.Focus();
            }
            else
            {
                Carrera.SelectedIndex  = 0;
                Semestre.SelectedIndex = 0;
                AddStudent.Enabled     = false;
                Cancel.Enabled         = true;
                DeleteStudent.Enabled  = false;
                Edit.Enabled           = false;
                AlumnosList.Enabled    = false;

                A_Matricula.Enabled    = false;
                A_Nombre.Enabled       = false;
                A_ApellidoP.Enabled    = false;
                A_ApellidoM.Enabled    = false;
                Carrera.Enabled        = false;
                Semestre.Enabled       = false;
                Becario.Enabled        = false;
                ServicioSocial.Enabled = false;
                Verano.Enabled         = false;
                Invierno.Enabled       = false;

                AlumnosList.View = View.Details;
                SetSingleStudent(int.Parse(Matricula_Alumno));
                A_Matricula.Focus();
            }
        }
        private void AlumnosList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            string[] name = AlumnosList.GetSubItemsFromSelectedIndex(1).Split(' ');
            if (name.Count() > 1)
            {
                A_Matricula.Text = AlumnosList.GetSubItemsFromSelectedIndex(0);

                if (name.Count() > 3)
                {
                    if (name.Count() > 4)
                    {
                        A_Nombre.Text    = name[0] + " " + name[1] + " " + name[2];
                        A_ApellidoP.Text = name[3];
                        A_ApellidoM.Text = name[4];
                    }
                    else
                    {
                        A_Nombre.Text    = name[0] + " " + name[1];
                        A_ApellidoP.Text = name[2];
                        A_ApellidoM.Text = name[3];
                    }
                }
                else
                {
                    A_Nombre.Text    = name[0];
                    A_ApellidoP.Text = name[1];
                    A_ApellidoM.Text = name[2];
                }

                Carrera.Text  = AlumnosList.GetSubItemsFromSelectedIndex(2);
                Semestre.Text = AlumnosList.GetSubItemsFromSelectedIndex(3);
                tipoServicio  = AlumnosList.GetSubItemsFromSelectedIndex(5);
                periodo       = AlumnosList.GetSubItemsFromSelectedIndex(4);

                if (tipoServicio == "B")
                {
                    Becario.Checked = true;
                }
                else
                {
                    if (tipoServicio == "SS")
                    {
                        ServicioSocial.Checked = true;
                    }
                }

                if (periodo == "EJ")
                {
                    Verano.Checked = true;
                }
                else
                {
                    if (periodo == "AD")
                    {
                        Invierno.Checked = true;
                    }
                }
            }

            if (AlumnosList.SelectedIndices.Count <= 1)
            {
                AddStudent.Enabled    = false;
                Cancel.Enabled        = true;
                DeleteStudent.Enabled = true;
                Edit.Enabled          = false;
                A_Matricula.Focus();
            }
            else
            {
                AddStudent.Enabled    = true;
                Cancel.Enabled        = true;
                DeleteStudent.Enabled = false;
                Edit.Enabled          = false;
                A_Matricula.Focus();
            }
        }
        private void DeleteStudent_Click(object sender, EventArgs e)
        {
            if (!Edit.Enabled)
            {
                DialogResult result = MessageBox.Show("Esta seguro que desea eliminar el registro?", "Atencion",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    student.Matricula    = int.Parse(A_Matricula.Text);
                    student.Nombre       = A_Nombre.Text;
                    student.Second_Name  = A_ApellidoP.Text;
                    student.Second_Name2 = A_ApellidoM.Text;
                    student.Carrera      = Carrera.Text;
                    student.Semestre     = int.Parse(Semestre.Text);
                    student.T_Servicio   = tipoServicio.ToString();
                    student.Periodo      = periodo.ToString();
                    DM.DeleteStudent(student);

                    AlumnosList.DeleteSelectedIndex(false);

                    StateText.Text         = "Alumno Eliminado...";
                    A_Matricula.Text       = "";
                    A_Nombre.Text          = "";
                    A_ApellidoP.Text       = "";
                    A_ApellidoM.Text       = "";
                    Carrera.SelectedIndex  = 0;
                    Semestre.SelectedIndex = 0;
                    Becario.Checked        = true;
                    Verano.Checked         = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                }
                else if (result == DialogResult.No)
                {
                    A_Matricula.Text       = "";
                    A_Nombre.Text          = "";
                    A_ApellidoP.Text       = "";
                    A_ApellidoM.Text       = "";
                    Carrera.SelectedIndex  = 0;
                    Semestre.SelectedIndex = 0;
                    Becario.Checked        = true;
                    Verano.Checked         = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Desea continuar sin aplicar los cambios?", "Atencion",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    DeleteStudent.Text     = "Eliminar";
                    A_Matricula.Text       = "";
                    A_Nombre.Text          = "";
                    A_ApellidoP.Text       = "";
                    A_ApellidoM.Text       = "";
                    Carrera.SelectedIndex  = 0;
                    Semestre.SelectedIndex = 0;
                    Becario.Checked        = true;
                    Verano.Checked         = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                }
                else if (result == DialogResult.No)
                {
                    ////Continue in code
                }
            }
        }
示例#7
0
        private void AlumnosList_SelectionChanged(object sender, EventArgs e)
        {
            if (AlumnosList.SelectedRows.Count <= 0)
            {
                return;
            }

            if (FirstLoad)
            {
                string[] name = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[1].Value.ToString().Split(' ');
                //string[] name = AlumnosList.GetSubItemsFromSelectedIndex(1).Split(' ');
                if (name.Count() > 1)
                {
                    //if (Edit.Enabled)
                    //{
                    mat = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[0].Value.ToString();
                    A_Matricula.Text = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[0].Value.ToString();
                    if (name.Count() > 3)
                    {
                        if (name.Count() > 4)
                        {
                            A_Nombre.Text    = name[0] + " " + name[1] + " " + name[2];
                            A_ApellidoP.Text = name[3];
                            A_ApellidoM.Text = name[4];
                        }
                        else
                        {
                            A_Nombre.Text    = name[0] + " " + name[1];
                            A_ApellidoP.Text = name[2];
                            A_ApellidoM.Text = name[3];
                        }
                    }
                    else
                    {
                        A_Nombre.Text    = name[0];
                        A_ApellidoP.Text = name[1];
                        A_ApellidoM.Text = name[2];
                    }

                    metroCarrera.Text  = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[2].Value.ToString();
                    metroSemestre.Text = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[3].Value.ToString();
                    tipoServicio       = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[5].Value.ToString();
                    periodo            = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[4].Value.ToString();

                    if (tipoServicio == "B")
                    {
                        Becario.Checked = true;
                    }
                    else
                    {
                        if (tipoServicio == "SS")
                        {
                            ServicioSocial.Checked = true;
                        }
                    }

                    if (periodo == "EJ")
                    {
                        Verano.Checked = true;
                    }
                    else
                    {
                        if (periodo == "AD")
                        {
                            Invierno.Checked = true;
                        }
                    }
                    //}
                }

                if (AlumnosList.SelectedRows.Count <= 1)
                {
                    AddStudent.Enabled    = false;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = true;
                    Edit.Enabled          = false;
                    A_Matricula.Focus();
                }
                else
                {
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                    A_Matricula.Focus();
                }
            }
        }
示例#8
0
        private void DeleteStudent_Click(object sender, EventArgs e)
        {
            if (!Edit.Enabled)
            {
                DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Esta seguro que desea eliminar el registro?"
                                                                          , "ADVERTENCIA - CAMBIO EN PROCESO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.Yes)
                {
                    student.Matricula    = int.Parse(A_Matricula.Text);
                    student.Nombre       = A_Nombre.Text;
                    student.Second_Name  = A_ApellidoP.Text;
                    student.Second_Name2 = A_ApellidoM.Text;
                    student.Carrera      = metroCarrera.Text;
                    student.Semestre     = int.Parse(metroSemestre.Text);
                    student.T_Servicio   = tipoServicio.ToString();
                    student.Periodo      = periodo.ToString();
                    DM.DeleteStudent(student);

                    //AlumnosList.DeleteSelectedIndex(false);

                    //StateText.Text = "Alumno Eliminado...";
                    DialogResult Result2 = MetroFramework.MetroMessageBox.Show(this, "El registro ha sido eliminado con exito."
                                                                               , "ELIMINADO", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (Result2 == DialogResult.OK)
                    {
                        A_Matricula.Text            = "";
                        A_Nombre.Text               = "";
                        A_ApellidoP.Text            = "";
                        A_ApellidoM.Text            = "";
                        metroCarrera.SelectedIndex  = 0;
                        metroSemestre.SelectedIndex = 0;
                        Becario.Checked             = true;
                        Verano.Checked              = true;

                        A_Matricula.Focus();
                        AddStudent.Enabled    = true;
                        Cancel.Enabled        = true;
                        DeleteStudent.Enabled = false;
                        Edit.Enabled          = false;
                        this.swipe(false);
                    }
                }
                else if (Result == DialogResult.No)
                {
                    A_Matricula.Text            = "";
                    A_Nombre.Text               = "";
                    A_ApellidoP.Text            = "";
                    A_ApellidoM.Text            = "";
                    metroCarrera.SelectedIndex  = 0;
                    metroSemestre.SelectedIndex = 0;
                    Becario.Checked             = true;
                    Verano.Checked              = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                }
            }
            else
            {
                DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "Desea continuar sin aplicar los cambios?"
                                                                          , "ADVERTENCIA - CAMBIO EN PROCESO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.Yes)
                {
                    DeleteStudent.Text          = "Eliminar";
                    A_Matricula.Text            = "";
                    A_Nombre.Text               = "";
                    A_ApellidoP.Text            = "";
                    A_ApellidoM.Text            = "";
                    metroCarrera.SelectedIndex  = 0;
                    metroSemestre.SelectedIndex = 0;
                    Becario.Checked             = true;
                    Verano.Checked              = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                    AlumnosList.ClearSelection();
                    mat = null;
                }
                if (Result == DialogResult.No)
                {
                    ////Continue in code
                }
            }
        }
示例#9
0
        private void Edit_Click(object sender, EventArgs e)
        {
            DialogResult Result1 = MetroFramework.MetroMessageBox.Show(this, "Esta seguro que desea modificar el registro?."
                                                                       , "ADVERTENCIA - CAMBIO EN PROCESO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result1 == DialogResult.Yes)
            {
                //AlumnosList.UpdateItemSubItems(SaveStudent());
                //string lastMat = AlumnosList.Rows[AlumnosList.SelectedRows[0].Index].Cells[0].Value.ToString();
                student.Matricula    = int.Parse(A_Matricula.Text);
                student.Nombre       = A_Nombre.Text.ToUpper();
                student.Second_Name  = A_ApellidoP.Text.ToUpper();
                student.Second_Name2 = A_ApellidoM.Text.ToUpper();
                student.Carrera      = metroCarrera.Text;
                student.Semestre     = int.Parse(metroSemestre.Text);

                if (Becario.Checked)
                {
                    student.T_Servicio = "B";
                }
                else
                {
                    if (ServicioSocial.Checked)
                    {
                        student.T_Servicio = "SS";
                    }
                }

                if (Verano.Checked)
                {
                    student.Periodo = "EJ";
                }
                else
                {
                    if (Invierno.Checked)
                    {
                        student.Periodo = "AD";
                    }
                }

                DM.UpdateStudent(student);

                //StateText.Text = "Alumno Editado...";
                DialogResult Result = MetroFramework.MetroMessageBox.Show(this, "La modificacion se ha aplicado con exito."
                                                                          , "EDICION EXITOSA", MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (Result == DialogResult.OK)
                {
                    A_Matricula.Text            = "";
                    A_Nombre.Text               = "";
                    A_ApellidoP.Text            = "";
                    A_ApellidoM.Text            = "";
                    metroCarrera.SelectedIndex  = 0;
                    metroSemestre.SelectedIndex = 0;
                    Becario.Checked             = true;
                    Verano.Checked              = true;

                    A_Matricula.Focus();
                    AddStudent.Enabled    = true;
                    Cancel.Enabled        = true;
                    DeleteStudent.Enabled = false;
                    Edit.Enabled          = false;
                    this.swipe(false);
                }
            }
            if (Result1 == DialogResult.No)
            {
                return;
            }
        }