void SkinningLootReloadButton_Click(object sender, EventArgs e)
        {
            var query_skinning = world.skinning_loot_template.Where(x => x.Entry.ToString() == EditBox_skinloot.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            SkinningLootDataGrid.Load(query_skinning);
        }
        void SearchDataGrid_DoubleClick(object sender, EventArgs e)
        {
            if (SearchDataGrid.Rows.Count < 1)
            {
                return;
            }

            int query_id = Convert.ToInt32(SearchDataGrid.Rows[SearchDataGrid.CurrentCell.RowIndex].Cells[0].Value.ToString());

            //// EDIT PAGE
            creature_template query = world.creature_template.Where(x => x.entry == query_id).Single();

            cTemplate = query;
            cTemplateBinding.DataSource = cTemplate;

            // Location
            var query_location = world.creature.Where(x => x.id == query_id).Select(x => new { x.guid, x.id, x.map, x.position_x, x.position_y, x.position_z, x.orientation, x.spawnMask, x.phaseMask, x.modelid, x.equipment_id, x.spawntimesecs, x.spawndist, x.currentwaypoint, x.curhealth, x.curmana, x.MovementType, x.npcflag, x.unit_flags, x.dynamicflags }).ToList();

            LocationDataGrid.Load(query_location);

            // Model info
            var query_modelInfo = world.creature_model_info.Where(x => (new string[] { EditBox_modelid1.Text, EditBox_modelid2.Text, EditBox_modelid3.Text, EditBox_modelid4.Text }).Contains(x.modelid.ToString())).Select(x => new { x.modelid, x.bounding_radius, x.combat_reach, x.gender, x.modelid_other_gender }).ToList();

            ModelInfoDataGrid.Load(query_modelInfo);

            // Loot
            var query_loot = world.creature_loot_template.Where(x => x.Entry.ToString() == EditBox_lootid.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            LootDataGrid.Load(query_loot);

            // Pick pocket
            var query_pickPocket = world.pickpocketing_loot_template.Where(x => x.Entry.ToString() == EditBox_pickpocketloot.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            PickPocketLootDataGrid.Load(query_pickPocket);

            // Skinning
            var query_skinning = world.skinning_loot_template.Where(x => x.Entry.ToString() == EditBox_skinloot.Text).Select(x => new { x.Entry, x.Item, x.Reference, x.Chance, x.QuestRequired, x.LootMode, x.GroupId, x.MinCount, x.MaxCount, x.Comment }).ToList();

            SkinningLootDataGrid.Load(query_skinning);

            // Equip template
            var query_equip = world.creature_equip_template.Where(x => x.entry.ToString() == EditBox_equipment_id.Text).SingleOrDefault();//.Select(x => new { x.entry, x.id, x.itemEntry1, x.itemEntry2, x.itemEntry3 }).SingleOrDefault();

            cEquipTemplate = query_equip ?? new creature_equip_template();
            cEquipTemplateBinding.DataSource = cEquipTemplate;

            // Template addon
            var query_templateAddon = world.creature_template_addon.Where(x => x.entry == query_id).SingleOrDefault();

            cTemplateAddon = query_templateAddon ?? new creature_template_addon();
            cTemplateAddonBinding.DataSource = cTemplateAddon;

            // Addon
            cAddon = new creature_addon();
            cAddonBinding.DataSource = cAddon;

            // On kill reputation
            var query_onKillReputation = world.creature_onkill_reputation.Where(x => x.creature_id == query_id).SingleOrDefault();

            cOnKillReputation = query_onKillReputation ?? new creature_onkill_reputation();
            cOnKillReputationBinding.DataSource = cOnKillReputation;

            // Involved in
            var query_questStarter = world.creature_queststarter.Where(x => x.id == query_id).ToList();
            var query_questEnder   = world.creature_questender.Where(x => x.id == query_id).ToList();

            InvolvedInTabStartsDataGrid.Reset();
            InvolvedInTabEndsDataGrid.Reset();

            if (query_questStarter.Count > 1)
            {
                InvolvedInTabStartsDataGrid.Rows.Add(query_questStarter.Count - 1);
            }

            if (query_questEnder.Count > 1)
            {
                InvolvedInTabEndsDataGrid.Rows.Add(query_questEnder.Count - 1);
            }

            /* start quests */
            for (int i = 0; i < query_questStarter.Count; i++)
            {
                int quest = query_questStarter[i].quest;

                var query_startQuest = world.quest_template.Where(x => x.Id == quest).SingleOrDefault();

                if (query_startQuest == null)
                {
                    continue;
                }

                InvolvedInTabStartsDataGrid.Rows[i].Cells[0].Value = query_startQuest.Id;
                InvolvedInTabStartsDataGrid.Rows[i].Cells[1].Value = query_startQuest.Title;
                InvolvedInTabStartsDataGrid.Rows[i].Cells[2].Value = query_startQuest.Level;

                if (query_startQuest.RewardOrRequiredMoney != 0)
                {
                    InvolvedInTabStartsDataGrid.Rows[i].Cells[4].Value = $"{query_startQuest.RewardOrRequiredMoney} Min coppers, {query_startQuest.RewardMoneyMaxLevel} Max level coppers.";
                }
                else
                {
                    InvolvedInTabStartsDataGrid.Rows[i].Cells[4].Value = $"{query_startQuest.RewardMoneyMaxLevel} at Max level coppers.";
                }

                bool QuestIsAlliance = false;
                bool QuestIsHorde    = false;

                string QuestFaction = String.Empty;

                string binary = Convert.ToString(query_startQuest.RequiredRaces, 2).PadLeft(22, '0');

                for (int k = binary.Length - 1; k >= 0; k--)
                {
                    if (binary[k] == '1' && WoW.Common.AllianceRaces.Contains(k))
                    {
                        QuestIsAlliance = true;
                    }
                    else if (binary[k] == '1' && WoW.Common.HordeRaces.Contains(k))
                    {
                        QuestIsHorde = true;
                    }
                }

                if (QuestIsAlliance)
                {
                    QuestFaction = "Alliance";
                }
                if (QuestIsHorde)
                {
                    QuestFaction = "Horde";
                }
                if (QuestIsAlliance && QuestIsHorde)
                {
                    QuestFaction = "Neutral";
                }

                InvolvedInTabStartsDataGrid.Rows[i].Cells[3].Value = QuestFaction;
            }

            /* end quests */
            for (int i = 0; i < query_questEnder.Count; i++)
            {
                int quest = query_questEnder[i].quest;

                var query_endQuest = world.quest_template.Where(x => x.Id == quest).SingleOrDefault();

                if (query_endQuest == null)
                {
                    continue;
                }

                InvolvedInTabEndsDataGrid.Rows[i].Cells[0].Value = query_endQuest.Id;
                InvolvedInTabEndsDataGrid.Rows[i].Cells[1].Value = query_endQuest.Title;
                InvolvedInTabEndsDataGrid.Rows[i].Cells[2].Value = query_endQuest.Level;

                if (query_endQuest.RewardOrRequiredMoney != 0)
                {
                    InvolvedInTabEndsDataGrid.Rows[i].Cells[4].Value = $"{query_endQuest.RewardOrRequiredMoney} Min coppers, {query_endQuest.RewardMoneyMaxLevel} Max level coppers.";
                }
                else
                {
                    InvolvedInTabEndsDataGrid.Rows[i].Cells[4].Value = $"{query_endQuest.RewardMoneyMaxLevel} at Max level coppers.";
                }

                bool QuestIsAlliance = false;
                bool QuestIsHorde    = false;

                string QuestFaction = String.Empty;

                string binary = Convert.ToString(query_endQuest.RequiredRaces, 2).PadLeft(22, '0');

                for (int k = binary.Length - 1; k >= 0; k--)
                {
                    if (binary[k] == '1' && WoW.Common.AllianceRaces.Contains(k))
                    {
                        QuestIsAlliance = true;
                    }
                    else if (binary[k] == '1' && WoW.Common.HordeRaces.Contains(k))
                    {
                        QuestIsHorde = true;
                    }
                }

                if (QuestIsAlliance)
                {
                    QuestFaction = "Alliance";
                }
                if (QuestIsHorde)
                {
                    QuestFaction = "Horde";
                }
                if (QuestIsAlliance && QuestIsHorde)
                {
                    QuestFaction = "Neutral";
                }

                InvolvedInTabEndsDataGrid.Rows[i].Cells[3].Value = QuestFaction;
            }

            // Smart AI
            SmartAIDataGrid.Reset();

            var query_smartAI_guids = world.creature.Where(x => x.id == query_id).ToList();
            var query_smartAI_entry = world.smart_scripts.Where(x => x.entryorguid == query_id && x.source_type == 0).ToList();

            if (query_smartAI_guids.Count > 1)
            {
                SmartAIDataGrid.Rows.Add(query_smartAI_guids.Count - 1);
            }

            /* based on entry */
            SmartAIDataGrid.Load(query_smartAI_entry);

            /* based on guid */
            for (int i = 0; i < query_smartAI_guids.Count; i++)
            {
                var guid = -query_smartAI_guids[i].guid;

                var query_smartAI = world.smart_scripts.Where(x => x.entryorguid == guid && x.source_type == 0).ToList();

                for (int j = 0; j < query_smartAI.Count; j++)
                {
                    PropertyInfo[] properties = query_smartAI[j].GetType().GetProperties(); // get properties name

                    foreach (PropertyInfo property in properties)                           // bind property.Name and property.Value to target column
                    {
                        SmartAIDataGrid.SetColumnValue(j + query_smartAI_entry.Count, DisplayColumnName(property.Name), property.GetValue(query_smartAI[j]));
                    }
                }
            }

            CreatureTab.SelectedTab = EditPage;
        }