Esempio n. 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //初始化
            InitDatabase(Resources.InitDataSql);
            SQLiteTools tool = new SQLiteTools();

            tool.StartPosition = FormStartPosition.CenterScreen;
            Application.Run(tool);
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (this.tbUserName.Text == "")
            {
                this.tbUserName.Focus();
                return;
            }
            if (this.tbPassword.Text == "")
            {
                this.tbPassword.Focus();
                return;
            }
            int res = userService.UserLogin(this.tbUserName.Text, this.tbPassword.Text);

            if (res == Result.RESULT_NOT_EXIST)
            {
                MessageBox.Show("用户不存在");
                return;
            }
            if (res == Result.RESULT_ERROR_PASSWORD)
            {
                MessageBox.Show("密码错误");
                return;
            }
            if (res == Result.RESULT_SUCCESS)
            {
                if (this.cbType.SelectedValue.ToString() == "1")
                {
                    UserList user = new UserList();
                    user.StartPosition = FormStartPosition.CenterScreen;
                    user.Show();
                }
                else
                {
                    SQLiteTools tool = new SQLiteTools();
                    tool.StartPosition = FormStartPosition.CenterScreen;
                    tool.Show();
                }
                this.Hide();
            }
        }