Пример #1
0
        private void Back_Click(object sender, EventArgs e)
        {
            this.Hide();
            studentMain f8 = new studentMain();

            f8.Show();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            studentMain    st  = new studentMain();
            InstructorMain ins = new InstructorMain();
            ManagerMain    ma  = new ManagerMain();
            string         path;
            int            flag = 0;
            string         un   = textBoxun.Text;
            string         ps   = textBoxps.Text;

            path = "student.txt";
            if (FindUser(un, ps, path))
            {
                st.Show(); flag = 1;
            }
            path = "instructor.txt";
            if (FindUser(un, ps, path))
            {
                ins.Show(); flag = 1;
            }
            path = "manager.txt";
            if (FindUser(un, ps, path))
            {
                ma.Show(); flag = 1;
            }
            if (flag == 0)
            {
                ERE.Text = "Wrong password or ID";
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            studentMain f3 = new studentMain();

            f3.Show();
        }
Пример #4
0
        private void sendBTN_Click(object sender, EventArgs e)
        {
            studentMain    st   = new studentMain();
            InstructorMain ins  = new InstructorMain();
            ManagerMain    ma   = new ManagerMain();
            int            flag = 0;
            string         un   = textBoxun.Text;

            if (un != "")
            {
                if (FindUser(un, "student.txt"))
                {
                    flag = 1;
                }
                else if (FindUser(un, "instructor.txt"))
                {
                    flag = 1;
                }
                else if (FindUser(un, "manager.txt"))
                {
                    flag = 1;
                }
                if (flag == 1)
                {
                    char s = ' ';

                    StreamReader mi      = new StreamReader("user.txt");
                    string       line    = mi.ReadLine();
                    string[]     details = line.Split(' ');
                    string       idM     = details[0];
                    mi.Close();

                    string       message = un + s + idM + s + textBoxMessage.Text + "\r\nEOMessage";
                    StreamWriter mw      = new StreamWriter("messages.txt", true);
                    mw.WriteLine(message);
                    mw.Close();

                    messageLBL.Text = "Message sent";
                }
                else
                {
                    messageLBL.Text = "Wrong password or ID";
                }
            }
            else
            {
                messageLBL.Text = "Fill in the ID or message";
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            studentMain    st  = new studentMain();
            InstructorMain ins = new InstructorMain();
            ManagerMain    ma  = new ManagerMain();


            string un = textBoxun.Text;
            string ps = textBoxps.Text;

            if (!(string.IsNullOrWhiteSpace(un) && string.IsNullOrWhiteSpace(ps)))
            {
                checkUsernamePassword(un, ps);
                if (FindUser(un, ps, "student.txt"))
                {
                    this.Hide(); st.Show();
                }

                else if (FindUser(un, ps, "instructor.txt"))
                {
                    this.Hide(); Task.Delay(1000); ins.Show();
                }

                else if (FindUser(un, ps, "manager.txt"))
                {
                    this.Hide(); Task.Delay(1000); ma.Show();
                }

                else
                {
                    ERE.Text = "Wrong password or ID";
                }
            }
            else
            {
                ERE.Text = "Fill in the password and ID";
            }
        }