public AsistenciaMaestros()
 {
     InitializeComponent();
     TeacherAttendance.InitCombos(this);
     lstTeacherAtt          = TeacherAttendance.initTable();
     myDataGrid.ItemsSource = lstTeacherAtt;
 }
        private void btnCheckBlueEdit_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = TeacherAttendance.validateAddRow(this);

            if (isValid)
            {
                BitmapImage b = new BitmapImage();
                b.BeginInit();
                b.UriSource = new Uri("pack://application:,,,/LIVEX;component/Images/001-checked-1.png");
                b.EndInit();
                imgCheck.Stretch = Stretch.Uniform;
                imgCheck.Source  = b;

                TeacherAttendance.EditSelected(this);

                if (dpFrom.Text == "" || dpUntil.Text == "")
                {
                    myDataGrid.ItemsSource = TeacherAttendance.initTable();
                }
                else if (dpFrom.Text != "" || dpUntil.Text != "")
                {
                    myDataGrid.ItemsSource = TeacherAttendance.FilterTable(Convert.ToDateTime(dpFrom.Text), Convert.ToDateTime(dpUntil.Text));
                }

                TeacherAttendance.ResetRowCombos(this);
            }
        }
        private void btnUpload_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Title  = "Seleccione el archivo";
            openFile.Filter = "csv(*.csv)|*.csv";
            if (openFile.ShowDialog() == true)
            {
                int result = TeacherAttendance.uploadTimerFile(openFile.FileName, openFile.SafeFileName);
                if (result == 1)
                {
                    lstTeacherAtt          = TeacherAttendance.initTable();
                    myDataGrid.ItemsSource = lstTeacherAtt;
                }
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Button           am     = (Button)sender;
            MessageBoxResult result = MessageBox.Show("¿Esta seguro de borrar el registro?", "Delete", MessageBoxButton.YesNo);

            if (MessageBoxResult.Yes == result)
            {
                TeacherAttendance.DeleteRow(this, am.DataContext);

                if (dpFrom.Text == "" || dpUntil.Text == "")
                {
                    myDataGrid.ItemsSource = TeacherAttendance.initTable();
                }
                else if (dpFrom.Text != "" || dpUntil.Text != "")
                {
                    myDataGrid.ItemsSource = TeacherAttendance.FilterTable(Convert.ToDateTime(dpFrom.Text), Convert.ToDateTime(dpUntil.Text));
                }
            }
        }