public void Test_GetForcePowers_WithOutOrderBy_NoResult() { string strWhere = "ForcePowerName Like '%Toad%'"; string strOrderBy = ""; ForcePower objForcePower = new ForcePower(); List <ForcePower> lstForcePowers = new List <ForcePower>(); lstForcePowers = objForcePower.GetForcePowers(strWhere, strOrderBy); Assert.IsTrue(lstForcePowers.Count == 0); }
/// <summary> /// Loads the TreeView tvForcePowerList. /// </summary> public void LoadTreeView() { tvForcePowerList.Nodes.Clear(); List <ForcePower> lstForcePowers = new List <ForcePower>(); ForcePower objForcePower = new ForcePower(); lstForcePowers = objForcePower.GetForcePowers("", ""); foreach (ForcePower objListForcePower in lstForcePowers) { TreeNode objTN = new TreeNode(); objTN.Text = objListForcePower.ForcePowerName; objTN.Tag = objListForcePower.ForcePowerID; tvForcePowerList.Nodes.Add(objTN); } }
/// <summary> /// Handles the Click event of the btnSearch control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnSearch_Click(object sender, EventArgs e) { string searchOrderBy = ""; string searchFilter = ""; switch (searchType) { case Common.searchType.Armor: searchOrderBy = "ArmorName"; if (txtSearch.Text.Contains("%")) { searchFilter = "ArmorName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "ArmorName = '" + txtSearch.Text + "'"; } Armor Armor = new Armor(); List <Armor> Armors = new List <Armor>(); Armors = Armor.GetArmors(searchFilter, searchOrderBy); SetFormForArmor(Armors); break; case Common.searchType.Feat: searchOrderBy = "FeatName"; if (txtSearch.Text.Contains("%")) { searchFilter = "FeatName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "FeatName = '" + txtSearch.Text + "'"; } Feat objFeat = new Feat(); List <Feat> Feats = new List <Feat>(); Feats = objFeat.GetFeats(searchFilter, searchOrderBy); SetFormForFeat(Feats); break; case Common.searchType.ForcePower: searchOrderBy = "ForcePowerName"; if (txtSearch.Text.Contains("%")) { searchFilter = "ForcePowerName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "ForcePowerName = '" + txtSearch.Text + "'"; } ForcePower objForcePower = new ForcePower(); List <ForcePower> ForcePowers = new List <ForcePower>(); ForcePowers = objForcePower.GetForcePowers(searchFilter, searchOrderBy); SetFormForForcePower(ForcePowers); break; case Common.searchType.Character: searchOrderBy = "CharacterName"; if (txtSearch.Text.Contains("%")) { searchFilter = "CharacterName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "CharacterName = '" + txtSearch.Text + "'"; } Character objCharacter = new Character(); List <Character> Characters = new List <Character>(); Characters = objCharacter.GetCharacters(searchFilter, searchOrderBy); SetFormForCharacter(Characters); break; case Common.searchType.Equipment: searchOrderBy = "EquipmentName"; if (txtSearch.Text.Contains("%")) { searchFilter = "EquipmentName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "EquipmentName = '" + txtSearch.Text + "'"; } Equipment objEquipment = new Equipment(); List <Equipment> equipmentList = new List <Equipment>(); equipmentList = objEquipment.GetEquipment(searchFilter, searchOrderBy); SetFormForEquipment(equipmentList); break; case Common.searchType.Skill: searchOrderBy = "SkillName"; if (txtSearch.Text.Contains("%")) { searchFilter = "SkillName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "SkillName = '" + txtSearch.Text + "'"; } Skill objSkill = new Skill(); List <Skill> objSkills = new List <Skill>(); objSkills = objSkill.GetSkills(searchFilter, searchOrderBy); SetFormForSkill(objSkills); break; case Common.searchType.Talent: searchOrderBy = "TalentName"; if (txtSearch.Text.Contains("%")) { searchFilter = "TalentName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "TalentName = '" + txtSearch.Text + "'"; } Talent objTalent = new Talent(); List <Talent> Talents = new List <Talent>(); Talents = objTalent.GetTalents(searchFilter, searchOrderBy); SetFormForTalent(Talents); break; case Common.searchType.Weapon: searchOrderBy = "WeaponName"; if (txtSearch.Text.Contains("%")) { searchFilter = "WeaponName LIKE '" + txtSearch.Text + "'"; } else { searchFilter = "WeaponName = '" + txtSearch.Text + "'"; } Weapon objWeapon = new Weapon(); List <Weapon> Weapons = new List <Weapon>(); Weapons = objWeapon.GetWeapons(searchFilter, searchOrderBy); SetFormForWeapon(Weapons); break; default: break; } }