private void logOffToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure to LogOff?", "Log-Off", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         this.Dispose(true);
         Home h = new Home();
         h.Show();
     }
     else
     {
         //e.Cancel = false;
     }
 }
예제 #2
0
 public history(Home input)
 {
     InitializeComponent();
     home = input;
 }
 private void logOffToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.Dispose(true);
     Home h = new Home();
     h.Show();
 }
예제 #4
0
 public Schedule(Home previous)
 {
     InitializeComponent();
     home = previous;
     home.Hide();
 }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool user = false;

            //string line;
            //System.IO.StreamReader database = new System.IO.StreamReader("users.in");
            //while (!database.EndOfStream)
            {
                user = true;
                user currentUser = new user();
                //line=database.ReadLine();
                //string username = "";
                //int i = 0;
                //for(i=0;line[i]!=' ';i++)
                //{
                linqtoregdbDataContext db = new linqtoregdbDataContext();
                bool valid = false;

                var queryIsUsername = from usr in db.users
                                      select usr;

                List <string> allUsernames = new List <string>();
                foreach (var c in queryIsUsername)
                {
                    allUsernames.Add(c.username.ToLower());
                    if (c.username.ToLower() == maskedTextBox1.Text.ToLower())
                    {
                        User.username = c.username;
                        valid         = true;
                        currentUser   = c;
                    }
                }
                if (currentUser.password != Hasher.GetHash(maskedTextBox2.Text).ToString())
                {
                    MessageBox.Show("Invalid username/password combination!");
                }
                else
                {
                    //username += line[i];
                    //if (maskedTextBox1.Text.ToString().ToLower()[i] != char.ToLower(line[i]))
                    //{
                    //    user = false;
                    //    break;
                    //}
                    //}
                    //if (user)
                    //{
                    //    User.username = username;
                    //    i = 11;
                    //    user = false;
                    //    foreach (char c in maskedTextBox2.Text.ToString())
                    //    {
                    //        user = true;
                    //        if (c != line[i])
                    //        {
                    //            user = false;
                    //            break;
                    //        }
                    //        i++;
                    //    }
                    //    if (user)
                    //{
                    //i = 70;
                    //string status="";
                    //for(i=70;i<line.Length&&line[i]!='\n'&&line[i]!=' ';i++)
                    //    status+=line[i];
                    string name = "Welcome,\n";
                    name += currentUser.lastName + ", " + currentUser.firstName;
                    //for (i = 22; line[i] != ' '; i++)
                    //    name += line[i];
                    MessageBox.Show(name);
                    User.type = currentUser.usertype;
                    //if (User.type == "admin")
                    //{
                    //    AdminWindow adminScreen = new AdminWindow(this, User);
                    //    adminScreen.Show();
                    //}
                    //else if (User.type == "faculty")
                    //{
                    //    FacultyHome facultyScreen = new FacultyHome(User, this);
                    //    facultyScreen.Show();
                    //}
                    //else
                    //{
                    Home screen = new Home(this, User);
                    screen.Show();
                    //}
                    this.Hide();
                }
            }
            //if (maskedTextBox2.Text.ToString() == "pong")
            //{
            //    linqtoregdbDataContext db = new linqtoregdbDataContext();
            //    var queryUsername = from usr in db.users
            //                        where usr.username.ToLower()==maskedTextBox1.Text.ToLower()
            //                        select usr.username;
            //    if (queryUsername.Count() == 1)
            //    {
            //        PongForm pongWindow = new PongForm(this,queryUsername.First());
            //        pongWindow.Show();
            //        this.Hide();
            //    }
            //    /*MessageBox.Show("Welcome");
            //    Classes screen = new Classes(this);
            //    screen.Show();
            //    this.Hide();*/
            //}
            //database.Close();
            maskedTextBox2.Text = "";
            //maskedTextBox1.Text="";
        }