Пример #1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            bool isvalidUser = false;
            bool isvalidPwd  = false;

            Contacts.Service1 ser      = new Contacts.Service1();
            string            curUsris = "";

            ser.IsValidUser(txt_user.Text, txt_pwd.Text, ref curUsris, out isvalidUser, out isvalidPwd);

            if (isvalidUser)
            {
                lblMsg.Text = "valid user";

                myUser u = new myUser();
                u.Userid = curUsris;
                DataClass.usersCurrent.Add(u);
                foreach (myUser ux in DataClass.usersCurrent)
                {
                    myUtill.loginUser = ux;
                }

                MyPanel pnl = new MyPanel();
                pnl.ShowDialog();
            }
            else
            {
                MessageBox.Show("invalid user");
            }


            //Boolean isFound = false;
            //foreach (myUser u in DataClass.usersArrayList)
            //{
            //    if (u.Username == txt_user.Text && u.Userpwd == txt_pwd.Text)
            //    {
            //        isFound = true;
            //        MyUtill.loginUser = u;

            //    }
            //}

            //if (isFound)
            //{

            //    lblMsg.Text = "valid user";


            //FrmContacts log = new FrmContacts();
            //this.Hide();
            //log.Show();



            //}
            //else
            //{
            //    lblMsg.Text = "invalid user";
            //}
        }