Exemplo n.º 1
0
        private void button_登录_Click(object sender, EventArgs e)
        {
            //倒计时器 a = new 倒计时器("登陆倒计时",30);
            //a.Show();



            if (textBox_用户名.Text.Trim() == String.Empty || textBox_密码.Text.Trim() == String.Empty) //为空
            {
                MessageBox.Show("请输入用户名和密码", "提示");
            }
            else
            {
                用户.初始用户名 = textBox_用户名.Text;
                chaxun_mima();
                if (textBox_密码.Text == 用户.初始密码)
                {
                    主界面 b = new 主界面();
                    b.Show();
                    PageList.nowPageId++;
                    PageList.pageList.Add(b);
                }
                else
                {
                    MessageBox.Show("账号或密码错误,请重新输入", "错误");  //提示错误;
                }
            }
        }
Exemplo n.º 2
0
        private void 主界面_Load(object sender, EventArgs e)
        {
            pCurrentWin_主界面 = this;

            string          connStr;
            OleDbConnection conn;

            connStr =
                "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + 登录.Filename_数据文件 + ";Jet OLEDB:Engine Type=5";
            conn = new OleDbConnection(connStr);
            conn.Open();

            System.Data.OleDb.OleDbDataAdapter da = new OleDbDataAdapter(数据库参数.sql_呼吸器管理, 数据库参数.mycon);

            dt.Clear();
            conn.Close();

            try
            {
                da.Fill(dt);  //将数据库内容填充到dt 这个DataTable(数据表)中

                if (dt.Rows.Count >= 1)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        this.dataGridView1.Rows.Add();
                        this.dataGridView1.Rows[i].Cells["编号"].Value     = dt.Rows[i][2].ToString();
                        this.dataGridView1.Rows[i].Cells["型号"].Value     = dt.Rows[i][4].ToString();
                        this.dataGridView1.Rows[i].Cells["使用单位"].Value   = dt.Rows[i][7].ToString();
                        this.dataGridView1.Rows[i].Cells["上次测试时间"].Value = dt.Rows[i][10].ToString();
                        this.dataGridView1.Rows[i].Cells["检测员"].Value    = dt.Rows[i][6].ToString();
                        this.dataGridView1.Rows[i].Cells["制造商"].Value    = dt.Rows[i][3].ToString();
                    }
                }
                else
                {
                    dataGridView1.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            label_呼吸器总数.Text = dt.Rows.Count.ToString();
            label_待测呼吸器.Text = dt.Rows.Count.ToString();
        }