Example #1
0
        private void initializeControls()
        {
            RealTimeAMS rtams = new RealTimeAMS();

            section_panels.Clear();
            section_labels.Clear();
            Grid[]  gs = { student_panel, attendance_panel, stats_panel, reports_panel, settings_panel, about_panel };
            Label[] ls = { student_section, attendance_section, stats_section, reports_section, settings_section, about_section };
            foreach (Grid g in gs)
            {
                section_panels.Add(g);
            }

            foreach (Label l in ls)
            {
                section_labels.Add(l);
            }

            RealTimeAMS.time_in_format  = time_in_format.Text;
            RealTimeAMS.time_out_format = time_out_format.Text;

            int status = timeStatus.IsChecked ? 0 : 1;

            rtams.changetimeState(status);
        }
Example #2
0
        private void test_format(object sender, RoutedEventArgs e)
        {
            Button      b     = sender as Button;
            RealTimeAMS rtams = new RealTimeAMS();

            string[] shortcodes = { "[name]", "[date]", "[sect]", "[stdn]" };
            string[] values     = { "Sample A. Name", DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), "Grade 1A", "201801203" };
            string   ti_format  = RealTimeAMS.time_in_format;
            string   to_format  = RealTimeAMS.time_out_format;

            switch (b.Name)
            {
            case "time_in_test":
                ShortCoder sc1 = new ShortCoder(shortcodes, values, ti_format);
                MessageBox.Show(sc1.performFormat());
                break;

            case "time_out_test":
                ShortCoder sc2 = new ShortCoder(shortcodes, values, to_format);
                MessageBox.Show(sc2.performFormat());
                break;

            default:
                break;
            }
        }
Example #3
0
        private void timeStatusChanged(object sender, RoutedEventArgs e)
        {
            HorizontalToggleSwitch swits = sender as HorizontalToggleSwitch;
            RealTimeAMS            rtams = new RealTimeAMS();
            int status = swits.IsChecked ? 0 : 1;

            rtams.changetimeState(status);
        }
Example #4
0
        public Attendance()
        {
            RealTimeAMS rtams = new RealTimeAMS();

            InitializeComponent();
            this.timeStatus   = rtams.timeState();
            this.table_prefix = this.timeStatus == 1 ? "time_out" : "time_in";
            checkAttendance();
            sms.PortLoad(RealTimeAMS.serialPort);
        }
Example #5
0
        private async void checkAttendance()
        {
            string current = "", previous = "";

            while (!isStop)
            {
                previous = stdnum1.Content.ToString();
                RealTimeAMS rtams = new RealTimeAMS();
                await Task.Delay(100);

                int ts = rtams.timeState();
                fullname1.Content = rtams.getFullName(this.table_prefix);

                try
                {
                    image.Source = new BitmapImage(new Uri(path + rtams.getImage(this.table_prefix)));
                }
                catch (ArgumentException e) { this.mainStatus = e.Message; }

                section1.Content = rtams.getSection(this.table_prefix);
                stdnum1.Content  = rtams.getStudentNumber(this.table_prefix);
                current          = stdnum1.Content.ToString();

                if (current != previous && current != "")
                {
                    string[] shortcodes = { "[name]", "[date]", "[sect]", "[stdn]" };
                    string[] values     = { fullname1.Content.ToString(), DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), section1.Content.ToString(), stdnum1.Content.ToString() };
                    string   message    = ts == 0 ? RealTimeAMS.time_in_format : RealTimeAMS.time_out_format;

                    ShortCoder sc = new ShortCoder(shortcodes, values, message);
                    message = sc.performFormat();

                    sms.sendMsg(rtams.getContactNumber(stdnum1.Content.ToString()), message);
                }
                //rtams.getContactNumber(stdnum1.Content.ToString());
                //fullname2.Content = rtams.getLastRFID("time_in"); //Test to check RFID Number
            }
        }