Exemple #1
0
        private void btnPerson_Click(object sender, EventArgs e)
        {
            frmPerson frm = new frmPerson();

            frm.Show();
            this.Close();
        }
Exemple #2
0
        private void txtPassword_KeyPress(object sender, KeyPressEventArgs e)
        {
            //اگر دکمه enter را زد
            if (e.KeyChar == 13)
            {
                //از کلاس کاربر یک شی جدید بگیرد
                Person myUser = new Person();
                try
                {
                    //اگر اطلاعات صحیح بود
                    if (myUser.CheckLogin(Int32.Parse(txtUser.Text), txtPassword.Text))
                    {
                        ServiceManager.User = Int32.Parse(txtUser.Text);
                        frmPerson newForm = new frmPerson();
                        newForm.Show();
                        this.Dispose();
                    }
                    else//اگر اشتباه بود
                    {
                        MessageBox.Show(null,
                                        "نام کاربری یا پسورد اشتباه است", "اخطار"
                                        , MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ServiceManager.Exit();
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }