//Submit to the database a new entry with the following details
        //    Initials: Workstudy
        //    Time: Time from datetime function
        //    Date: Date from datetime function
        //    areaInput: "Phone "
        private void Phone(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            areaInput = "";

            string timeInput = DateTime.Now.ToString("h:mm tt");
            string dateInput = DateTime.Today.ToString("dd/MM/yyyy");

            areaInput      += "Phone ";
            submittedRecord = new SubmittedRecord {
                initials = "Workstudy", time = timeInput, date = dateInput, area = areaInput
            };
            submittedRecord.SubmitRecord();
        }
Ejemplo n.º 2
0
        // Submit button
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            string timeInput = DateTime.Now.ToString("h:mm tt");
            string dateInput = DateTime.Today.ToString("dd/MM/yyyy");

            submittedRecord = new SubmittedRecord {
                initials = initialsInput, time = timeInput, date = dateInput, area = areaInput
            };
            submittedRecord.SubmitRecord();

            initialsInput = "";
            areaInput     = "";

            // Clear initials textbox
            foreach (Object i in MainCanvas.Children)
            {
                if (i.GetType().ToString() == "System.Windows.Controls.TextBox")
                {
                    ((TextBox)i).Text = "";
                }
            }

            // Clear area checkboxes
            List <CheckBox> checkBoxes = new List <CheckBox>();

            foreach (Object i in AreaCanvas.Children)
            {
                if (i.GetType().ToString() == "System.Windows.Controls.CheckBox")
                {
                    checkBoxes.Add((CheckBox)i);
                }
            }

            foreach (CheckBox checkBox in checkBoxes)
            {
                checkBox.IsChecked = false;
            }
        }