Exemple #1
0
        private void FormUpdateUser_Load(object sender, System.EventArgs e)
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.textBox_user.Text = this.userStr;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TUser where UEnabled=1 and UEID='" + KLineTestProcessor.EncrypDisposeFunc(this.userStr) + "'", connection).ExecuteReader();
                    if (dataReader.Read())
                    {
                        this.textBox_name.Text = dataReader["UNAME"].ToString();
                        string tempStr = dataReader["UPWD"].ToString();
                        this.textBox_psw.Text = KLineTestProcessor.DecodeDisposeFunc(tempStr);
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception arg_BA_0)
                {
                    KLineTestProcessor.ExceptionRecordFunc(arg_BA_0.StackTrace);
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
            catch (System.Exception arg_E0_0)
            {
                KLineTestProcessor.ExceptionRecordFunc(arg_E0_0.StackTrace);
            }
        }
Exemple #2
0
        public void RefreshDataGridView()
        {
            OleDbConnection connection = null;
            OleDbDataReader dataReader = null;

            try
            {
                this.dataGridView1.Rows.Clear();
                int iUserCount = 0;
                try
                {
                    connection = new OleDbConnection();
                    connection.ConnectionString = this.gLineTestProcessor.dbPathStr;
                    connection.Open();
                    dataReader = new OleDbCommand("select * from TUser where UEnabled=1 order by UID asc", connection).ExecuteReader();
                    while (dataReader.Read())
                    {
                        string tempStr = dataReader["UEID"].ToString();
                        this.userStrArray[iUserCount] = KLineTestProcessor.DecodeDisposeFunc(tempStr);
                        this.nameStrArray[iUserCount] = dataReader["UNAME"].ToString();
                        iUserCount++;
                        if (iUserCount >= FormUserManage.MAX_USER_NUM)
                        {
                            break;
                        }
                    }
                    dataReader.Close();
                    dataReader = null;
                    connection.Close();
                    connection = null;
                }
                catch (System.Exception ex)
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                        dataReader = null;
                    }
                    if (connection != null)
                    {
                        connection.Close();
                        connection = null;
                    }
                    KLineTestProcessor.ExceptionRecordFunc(ex.StackTrace);
                    goto IL_19E;
                }
                if (iUserCount > 0)
                {
                    this.dataGridView1.AllowUserToAddRows = true;
                    int num;
                    for (int i = 0; i < iUserCount; i = num)
                    {
                        this.dataGridView1.Rows.Add(1);
                        num = i + 1;
                        this.dataGridView1.Rows[i].Cells[0].Value = System.Convert.ToString(num);
                        this.dataGridView1.Rows[i].Cells[1].Value = this.userStrArray[i];
                        this.dataGridView1.Rows[i].Cells[2].Value = this.nameStrArray[i];
                    }
                    this.dataGridView1.AllowUserToAddRows = false;
                }
                IL_19E :;
            }
            catch (System.Exception ex2)
            {
                this.dataGridView1.AllowUserToAddRows = false;
                KLineTestProcessor.ExceptionRecordFunc(ex2.StackTrace);
            }
        }