예제 #1
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;
            }
        }
예제 #2
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
            }
        }