private void ticketForm2_2_1_1BackBtn_Click(object sender, EventArgs e)
        {
            TicketForm2_2_1 tf2_2_1 = new TicketForm2_2_1();

            tf2_2_1.ShowDialog();
            Close();
        }
예제 #2
0
        private async void ticketForm2_2LoginBtn_Click(object sender, EventArgs e)
        {
            if (studentNumber_Txtbx.Text == "Student Number" && Password_Txtbx.Text == "Password")
            {
                MessageBox.Show("STUDENT NUMBER OR PASSWORD CANNOT BE BLANKED!");
            }

            else if (studentNumber_Txtbx.Text == "Student Number")
            {
                MessageBox.Show("STUDENT NUMBER CANNOT BE BLANKED!");
            }

            else if (Password_Txtbx.Text == "Password")
            {
                MessageBox.Show("PASSWORD CANNOT BE BLANKED!");
            }
            else
            {
                var values = new Dictionary <string, string>
                {
                    { "studentNumber", studentNumber_Txtbx.Text },
                    { "pass", Password_Txtbx.Text },
                };
                var content = new FormUrlEncodedContent(values);

                var response = await client.PostAsync("http://dlslqueueingapp-merwincastromjc253154.codeanyapp.com/v1/userLoginDesktop.php", content);

                var responseString = await response.Content.ReadAsStringAsync();

                if (responseString.Contains("true"))
                {
                    MessageBox.Show("INVALID CREDENTIALS");
                }
                else
                {
                    if (responseString.Contains("hasQueueingNumber") && responseString.Contains("YES"))
                    {
                        MessageBox.Show("USER ALREADY HAS A QUEUEING TICKET");
                    }
                    else
                    {
                        MessageBox.Show("LOGGING IN!");
                        TicketForm2_2_1 tf2_2_1 = new TicketForm2_2_1();
                        tf2_2_1.ShowDialog();
                        Close();
                    }
                }
            }
        }