Example #1
0
        private void dgItems_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (dgItems.Rows[e.RowIndex].Cells["ID"].Value.ToString().Trim() != "")
            {
                //Stopwatch stopwatch = new Stopwatch();
                //stopwatch.Start();

                string          strSQL          = "select * from t_item_exchange where a_index = " + dgItems.Rows[e.RowIndex].Cells["ID"].Value.ToString();
                MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username="******";password="******";database=" + Database);
                MySqlCommand    command         = mySqlConnection.CreateCommand();
                command.CommandText = strSQL;
                mySqlConnection.Open();
                MySqlDataReader mySqlDataReader = command.ExecuteReader();
                while (mySqlDataReader.Read())
                {
                    tbl_exchange exchange = new tbl_exchange();
                    t_exchange_id.Text = mySqlDataReader.GetValue(0).ToString();
                    //exchange.index = Convert.ToInt32(mySqlDataReader.GetValue(0).ToString()); //dethunter12 add
                    tx_npc_id.Text = mySqlDataReader.GetValue(2).ToString();
                    //exchange.npcidx = Convert.ToInt32(mySqlDataReader.GetValue(2).ToString()); //dethunter12 add
                    tb_reward_id.Text = mySqlDataReader.GetValue(3).ToString();
                    //exchange.result_itemIndex = Convert.ToInt32(mySqlDataReader.GetValue(3).ToString());
                    tb_reward_qty.Text = mySqlDataReader.GetValue(4).ToString();
                    //exchange.result_itemCount = Convert.ToInt32(mySqlDataReader.GetValue(4).ToString());
                    r_t_id1.Text = mySqlDataReader.GetValue(5).ToString();
                    //exchange.source_itemIndex0 = Convert.ToInt32(mySqlDataReader.GetValue(5).ToString()); //item index 1
                    textBox6.Text = mySqlDataReader.GetValue(6).ToString();
                    //exchange.source_itemCount0 = Convert.ToInt32(mySqlDataReader.GetValue(6).ToString());
                    r_t_id2.Text = mySqlDataReader.GetValue(7).ToString();
                    //exchange.source_itemIndex1 = Convert.ToInt32(mySqlDataReader.GetValue(7).ToString());
                    textBox9.Text = mySqlDataReader.GetValue(8).ToString();
                    //exchange.source_itemCount1 = Convert.ToInt32(mySqlDataReader.GetValue(8).ToString());
                    r_t_id3.Text = mySqlDataReader.GetValue(9).ToString();
                    //exchange.source_itemIndex2 = Convert.ToInt32(mySqlDataReader.GetValue(9).ToString());
                    textBox12.Text = mySqlDataReader.GetValue(10).ToString();
                    //exchange.source_itemCount2 = Convert.ToInt32(mySqlDataReader.GetValue(10).ToString());
                    r_t_id4.Text = mySqlDataReader.GetValue(11).ToString();
                    //exchange.source_itemIndex3 = Convert.ToInt32(mySqlDataReader.GetValue(11).ToString());
                    textBox15.Text = mySqlDataReader.GetValue(12).ToString();
                    //exchange.source_itemCount3 = Convert.ToInt32(mySqlDataReader.GetValue(12).ToString());
                    r_t_id5.Text = mySqlDataReader.GetValue(13).ToString();
                    //exchange.source_item_Index4 = Convert.ToInt32(mySqlDataReader.GetValue(13).ToString());
                    textBox18.Text = mySqlDataReader.GetValue(14).ToString();
                    //exchange.source_itemCount4 = Convert.ToInt32(mySqlDataReader.GetValue(14).ToString());
                    a_name.Text = mySqlDataReader.GetValue(15).ToString();

                    a_desc.Text = mySqlDataReader.GetValue(16).ToString();
                    ExChangeList.Add(exchange); //add all the values to the list  box
                }
                mySqlConnection.Close();
                //stopwatch.Stop();
            }
        }
Example #2
0
        private void LoadDG()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            dgItems.Rows.Clear();
            string          str1            = "select a_index, a_npc_index, result_itemIndex, result_itemCount, source_itemIndex0, source_itemCount0, source_itemIndex1, source_itemCount1, source_itemIndex2, source_itemCount2, source_itemIndex3, source_itemCount3, source_itemIndex4, source_itemCount4      from t_item_exchange order by a_index";
            MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username="******";password="******";database=" + Database);
            MySqlCommand    command         = mySqlConnection.CreateCommand();

            command.CommandText = str1;
            mySqlConnection.Open();
            MySqlDataReader mySqlDataReader = command.ExecuteReader();

            while (mySqlDataReader.Read())
            {
                tbl_exchange exchange = new tbl_exchange();
                exchange.index              = Convert.ToInt32(mySqlDataReader.GetValue(0).ToString()); //dethunter12 add
                exchange.npcidx             = Convert.ToInt32(mySqlDataReader.GetValue(1).ToString()); //dethunter12 add
                exchange.result_itemIndex   = Convert.ToInt32(mySqlDataReader.GetValue(2).ToString());
                exchange.result_itemCount   = Convert.ToInt32(mySqlDataReader.GetValue(3).ToString());
                exchange.source_itemIndex0  = Convert.ToInt32(mySqlDataReader.GetValue(4).ToString()); //item index 1
                exchange.source_itemCount0  = Convert.ToInt32(mySqlDataReader.GetValue(5).ToString());
                exchange.source_itemIndex1  = Convert.ToInt32(mySqlDataReader.GetValue(6).ToString());
                exchange.source_itemCount1  = Convert.ToInt32(mySqlDataReader.GetValue(7).ToString());
                exchange.source_itemIndex2  = Convert.ToInt32(mySqlDataReader.GetValue(8).ToString());
                exchange.source_itemCount2  = Convert.ToInt32(mySqlDataReader.GetValue(9).ToString());
                exchange.source_itemIndex3  = Convert.ToInt32(mySqlDataReader.GetValue(10).ToString());
                exchange.source_itemCount3  = Convert.ToInt32(mySqlDataReader.GetValue(11).ToString());
                exchange.source_item_Index4 = Convert.ToInt32(mySqlDataReader.GetValue(12).ToString());
                exchange.source_itemCount4  = Convert.ToInt32(mySqlDataReader.GetValue(13).ToString());
                ExChangeList.Add(exchange); //add all the values to the list  box
                string a_index     = mySqlDataReader.GetValue(0).ToString();
                string a_npc_index = mySqlDataReader.GetValue(1).ToString();
                string item_id     = mySqlDataReader.GetValue(2).ToString();

                dgItems.Rows.Add(new Bitmap(databaseHandle.IconFast(Int32.Parse(item_id)), 20, 20), a_index, databaseHandle.ItemNameFast(Int32.Parse(item_id)), databaseHandle.MobNameFast(Int32.Parse(a_npc_index)));
            }
            mySqlConnection.Close();
            stopwatch.Stop();
            TimeSpan elapsed = stopwatch.Elapsed;

            string.Format("{0:00}:{1:00}:{2:00}.{3:00}", elapsed.Hours, elapsed.Minutes, elapsed.Seconds, (elapsed.Milliseconds / 10));

            //toolStripStatusLabel1.Text = "Ready";
        }