Exemplo n.º 1
0
        protected void button_Click(object sender, EventArgs e)
        {
            Button observationType = sender as Button;
            //show popup with text entry to write to file
            string comments;

            using (ConfirmationForm confirmPopup = new ConfirmationForm(obsWHabitsList[Int32.Parse(observationType.Name)]))
            {
                confirmPopup.Text = this.Text + "" + observationType.Text;
                if (confirmPopup.ShowDialog() == DialogResult.OK)
                {
                    //Create a property in ConfirmationForm to return the input of user.
                    comments = confirmPopup.comments;
                    List <int> workHabitsList = new List <int>();
                    for (int i = 0; i < 10; i++)
                    {
                        if (confirmPopup.whButtonList[i].Checked)
                        {
                            workHabitsList.Add(i + 1);
                        }
                    }
                    WriteToGoogleSheets(comments, observationType, workHabitsList);
                }
            }
        }
Exemplo n.º 2
0
        private void submitBtn_Click(object sender, EventArgs e)
        {
            //needs to write to google sheet.
            submitBtn.Visible = false;

            int posNeg;

            foreach (EnhancedButton tempBtn in buttonList)
            {
                if (tempBtn.Text != "x")
                {
                    string     comments       = "";
                    String[]   wrkHabitsArray = { "4", "5", "7" };
                    List <int> workHabitsList = new List <int>();
                    if (tempBtn.BackColor == Color.Green)
                    {
                        posNeg = 0;
                        //write good
                        foreach (string wrkHabit in wrkHabitsArray)
                        {
                            workHabitsList.Add(Int32.Parse(wrkHabit));
                        }
                        if (snapMode)
                        {
                            WriteToCSV(tempBtn.userName, posNeg, comments, workHabitsList);
                        }
                        else if (attendanceMode)
                        {
                            WriteToSheetAttendance(tempBtn.userName);
                        }
                        //WriteData(String spreadSheetID, List<object> cellData, string SheetName, String startCell, String endCell)
                    }
                    else if (tempBtn.BackColor == Color.Red || tempBtn.BackColor == Color.Yellow)
                    {
                        posNeg = -1;
                        //write bad
                        if (tempBtn.BackColor == Color.Yellow)
                        {
                            using (ConfirmationForm confirmPopup = new ConfirmationForm(wrkHabitsArray))
                            {
                                confirmPopup.Text = this.Text + "" + tempBtn.userName;
                                if (confirmPopup.ShowDialog() == DialogResult.OK)
                                {
                                    //Create a property in ConfirmationForm to return the input of user.
                                    comments = confirmPopup.comments;
                                    for (int i = 0; i < 10; i++)
                                    {
                                        if (confirmPopup.whButtonList[i].Checked)
                                        {
                                            workHabitsList.Add(i + 1);
                                        }
                                        string posNegTemp = confirmPopup.posNeg.Text;
                                        if (posNegTemp == "+")
                                        {
                                            posNeg = 1;
                                        }
                                        else
                                        {
                                            posNeg = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (string wrkHabit in wrkHabitsArray)
                            {
                                workHabitsList.Add(Int32.Parse(wrkHabit));
                            }
                        }
                        WriteToCSV(tempBtn.userName, posNeg, comments, workHabitsList);
                    }

                    tempBtn.BackColor = Color.Transparent;
                }
            }
            snapMode                = false;
            attendanceMode          = false;
            snapshotBtn.BackColor   = Color.Transparent;
            attendanceBtn.BackColor = Color.Transparent;
        }