示例#1
0
 private void login_button_Click(object sender, EventArgs e)
 {
     using (var db = new Session2Entities())
     {
         try
         {
             var user = (from u in db.Users
                         where u.userId == login_box.Text
                         where u.passwd == password_box.Text
                         select u).First();
             if (user.userTypeIdFK == 1)
             {
                 //manager
                 this.Hide();
                 var MMM = new MainMenuManager();
                 MMM.Closed += (s, args) => this.Close();
                 MMM.Show();
             }
             else
             {
                 //Sponsor
                 this.Hide();
                 var MMS = new MainMenuSponsor(login_box.Text);
                 MMS.Closed += (s, args) => this.Close();
                 MMS.Show();
             }
         }
         catch
         {
             MessageBox.Show("Invalid Login");
         }
     }
 }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            var MMS = new MainMenuSponsor(UserID);

            MMS.Closed += (s, args) => this.Close();
            MMS.Show();
        }