private void InitEasyQuery() { var options = new EasyQueryOptions(); EqManager = new EasyQueryManagerSql(options); using (var dbContext = ApplicationDbContext.Create()) EqManager.Model.LoadFromDbContext(dbContext); // EasyQueryManagerSql.RegisterDbGate<SqlServerGate>(); // EqManager.Model.LoadFromConnection(ApplicationDbContext.Create().Database.GetConnection); //saving the reference to Customer Country attribute in our model (will be used on RequestList processing) _countryAttr = EqManager.Model.EntityRoot.FindAttributeById("Customers.Country"); //assign query to all visual controls. QPanel.Query = EqManager.Query; CPanel.Query = EqManager.Query; SPanel.Query = EqManager.Query; EntPanel.Query = EqManager.Query; //setting differnt properties of EasyQuery visual controls CPanel.AllowEditCaptions = true; CPanel.AllowSorting = true; EntPanel.ShowFilter = true; }
//------------------------------------------------------------------------------------------------------- /** * @brief 构建玩家属性列表 * @param */ private static void BuildNPCPropList(GameCmd.t_MapNpcDataPos data, ref EntityAttr[] propList, uint master_id = 0) { if (propList.Length < 0 || propList.Length > (int)NPCProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildNPCPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)EntityProp.BaseID, (int)data.mapnpcdata.npcdata.dwBaseID); // 怪物模板ID 0 propList[index++] = new EntityAttr((int)CreatureProp.Hp, (int)data.mapnpcdata.npcdata.curhp); propList[index++] = new EntityAttr((int)CreatureProp.MaxHp, (int)data.mapnpcdata.npcdata.maxhp); propList[index++] = new EntityAttr((int)CreatureProp.Level, (int)data.mapnpcdata.npcdata.level); propList[index++] = new EntityAttr((int)CreatureProp.Camp, (int)data.mapnpcdata.npcdata.camp); propList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, (int)data.mapnpcdata.npcdata.movespeed); propList[index++] = new EntityAttr((int)NPCProp.Job, (int)data.mapnpcdata.npcdata.job); propList[index++] = new EntityAttr((int)NPCProp.Sex, (int)data.mapnpcdata.npcdata.sex); propList[index++] = new EntityAttr((int)NPCProp.ArenaNpcType, (int)data.mapnpcdata.npcdata.arenanpctype); propList[index++] = new EntityAttr((int)NPCProp.Masterid, (int)master_id); propList[index++] = new EntityAttr((int)NPCProp.SuitID, (int)data.mapnpcdata.npcdata.suitid); propList[index++] = new EntityAttr((int)NPCProp.SkillStatus, (int)data.mapnpcdata.npcdata.skill_status); // 技能形态 propList[index++] = new EntityAttr((int)NPCProp.MasterType, (int)data.mapnpcdata.npcdata.master_type); // 技能形态 }
//------------------------------------------------------------------------------------------------------- /** * @brief 构建Box属性列表 * @param */ private static void BuildBoxPropList(t_MapObjectData data, ref EntityAttr[] propList) { if (propList.Length < 0 || propList.Length > (int)BoxProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildPlayerPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)EntityProp.BaseID, (int)data.dwObjectID); // 玩家没有模板ID 0则使用默认数据 需要根据职业和性别来获取 需要读取配置表 propList[index++] = new EntityAttr((int)BoxProp.Number, (int)data.wdNumber); propList[index++] = new EntityAttr((int)BoxProp.OwnerType, (int)data.byOwnerType); //propList[index++] = new EntityAttr((int)BoxProp.Owner, (int)data.dwOwner); //氏族ID分为两个存 uint owner = data.dwOwner; int ownerLow = (int)(owner & 0x0000ffff); int ownerHigh = (int)(owner >> 16); propList[index++] = new EntityAttr((int)BoxProp.OwnerLow, ownerLow); propList[index++] = new EntityAttr((int)BoxProp.OwnerHigh, ownerHigh); uint low = (uint)ownerLow; uint high = (uint)ownerHigh; uint newhigh = high << 16; uint newOwner = newhigh | low; Engine.Utility.Log.Error("--->>> 服务器owner:" + data.dwOwner); Engine.Utility.Log.Error("--->>> 客户端owner:" + newOwner); }
//------------------------------------------------------------------------------------------------------- /** * @brief 构建玩家属性列表 * @param */ public static void BuildPlayerPropList(GameCmd.t_MainUserData data, ref EntityAttr[] propList) { if (propList.Length < 0 || propList.Length > (int)PlayerProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildPlayerPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)CreatureProp.Mp, (int)data.sp); // 法力值 propList[index++] = new EntityAttr((int)CreatureProp.MaxMp, (int)data.maxsp); // 法力值 propList[index++] = new EntityAttr((int)PlayerProp.Exp, (int)data.exp); // 经验 propList[index++] = new EntityAttr((int)PlayerProp.PkMode, (int)data.pkmode); //Pk模式 propList[index++] = new EntityAttr((int)FightCreatureProp.Power, (int)data.power); // 战斗力 propList[index++] = new EntityAttr((int)FightCreatureProp.Strength, (int)data.liliang); // 力量 propList[index++] = new EntityAttr((int)FightCreatureProp.Corporeity, (int)data.tizhi); // 体质 propList[index++] = new EntityAttr((int)FightCreatureProp.Intelligence, (int)data.zhili); // 智力 propList[index++] = new EntityAttr((int)FightCreatureProp.Spirit, (int)data.jingshen); // 精神 propList[index++] = new EntityAttr((int)FightCreatureProp.Agility, (int)data.minjie); // 敏捷 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAttack, (int)data.pdam_min); // 最小物理攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsDefend, (int)data.pdef_min); // 最小物理防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAttack, (int)data.mdam_min); // 最小法术攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicDefend, (int)data.mdef_min); // 最小法术防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsAttack, (int)data.pdam_max); // 最大物理攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsDefend, (int)data.pdef_max); // 最大物理防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicAttack, (int)data.mdam_max); // 最大法术攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicDefend, (int)data.mdef_max); // 最大法术防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsCrit, (int)data.lucky); // 物理致命一击 //propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsCritDefend, (int)data.luckydef); // 抗暴击 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicCrit, (int)data.mlucky); // 法术致命一击 //propList[index++] = new EntityAttr((int)FightCreatureProp.MagicCritDefend, (int)data.mluckydef); propList[index++] = new EntityAttr((int)FightCreatureProp.Hit, (int)data.phit); // 命中 propList[index++] = new EntityAttr((int)FightCreatureProp.Dodge, (int)data.hide_per); // 闪避 propList[index++] = new EntityAttr((int)FightCreatureProp.IceAttack, (int)data.ssdam); // 冰攻 propList[index++] = new EntityAttr((int)FightCreatureProp.FireAttack, (int)data.esdam); // 火攻 propList[index++] = new EntityAttr((int)FightCreatureProp.EleAttack, (int)data.lsdam); // 电攻 propList[index++] = new EntityAttr((int)FightCreatureProp.WitchAttack, (int)data.vsdam); // 暗攻 propList[index++] = new EntityAttr((int)FightCreatureProp.IceDefend, (int)data.ssdef); // 冰防 propList[index++] = new EntityAttr((int)FightCreatureProp.FireDefend, (int)data.esdef); // 火防 propList[index++] = new EntityAttr((int)FightCreatureProp.EleDefend, (int)data.lsdef); // 电防 propList[index++] = new EntityAttr((int)FightCreatureProp.WitchDefend, (int)data.vsdef); // 暗防 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAbsorb, (int)data.pabs); // 物伤吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAbsorb, (int)data.mabs); // 法伤吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.HarmDeepen, (int)data.harm_add_per); // 伤害加深 propList[index++] = new EntityAttr((int)FightCreatureProp.HarmAbsorb, (int)data.harm_sub_per); // 伤害吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.CritiRatio, (int)data.criti_ratio); // 暴击伤害百分比 propList[index++] = new EntityAttr((int)FightCreatureProp.Cure, (int)data.cure); // 治疗 propList[index++] = new EntityAttr((int)PlayerProp.LoginOutTime, (int)data.lastofftime); // 最近一次下线时间 propList[index++] = new EntityAttr((int)PlayerProp.ExpAddBuff, (int)data.exp_add_per); // 最近一次下线时间 // 战斗属性 }
private void InitEasyQuery() { var options = new EasyQueryOptions(); EqManager = new EasyQueryManagerSql(options); // loads model from DbContext EqManager.Model.LoadFromDbContext(ApplicationDbContext.Create()); // intialize the data model and load it from XML (or JSON) file // EqManager.Model.LoadFromJsonFile("Your path"); // intialize the data model and load it from connection // DbGate.Register<SqlServerGate>(); // EqManager.Model.LoadFromConnection(ApplicationDbContext.Create().Database.Connection); //saving the reference to Customer Country attribute in our model (will be used on RequestList processing) _countryAttr = EqManager.Model.EntityRoot.FindAttributeById("Customers.Country"); //assign query to all visual controls. QPanel.Query = EqManager.Query; CPanel.Query = EqManager.Query; SPanel.Query = EqManager.Query; EntPanel.Query = EqManager.Query; //setting differnt properties of EasyQuery visual controls this.CPanel.AllowEditCaptions = true; this.CPanel.AllowSorting = true; this.EntPanel.ShowFilter = true; }
private static void BuildRobotPropList(table.RobotDataBase data, table.NpcDataBase npcdb, uint moveSpeed, ref EntityAttr[] propList) { if (propList.Length < 0 || propList.Length > (int)RobotProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildRobotPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)RobotProp.Sex, (int)npcdb.sex); propList[index++] = new EntityAttr((int)RobotProp.Job, (int)data.dwJob); propList[index++] = new EntityAttr((int)CreatureProp.Level, (int)data.dwLevel); propList[index++] = new EntityAttr((int)EntityProp.BaseID, (int)npcdb.dwID); //模型ID 0 propList[index++] = new EntityAttr((int)CreatureProp.Mp, (int)data.mp); // 法力值 propList[index++] = new EntityAttr((int)CreatureProp.MaxMp, (int)data.mp); // 法力值 propList[index++] = new EntityAttr((int)CreatureProp.Hp, (int)data.hp); propList[index++] = new EntityAttr((int)CreatureProp.MaxHp, (int)data.hp); propList[index++] = new EntityAttr((int)FightCreatureProp.Power, (int)data.power); // 战斗力 propList[index++] = new EntityAttr((int)FightCreatureProp.Strength, (int)data.liliang); // 力量 propList[index++] = new EntityAttr((int)FightCreatureProp.Corporeity, (int)data.tizhi); // 体质 propList[index++] = new EntityAttr((int)FightCreatureProp.Intelligence, (int)data.zhili); // 智力 propList[index++] = new EntityAttr((int)FightCreatureProp.Spirit, (int)data.jingshen); // 精神 propList[index++] = new EntityAttr((int)FightCreatureProp.Agility, (int)data.minjie); // 敏捷 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAttack, (int)(data.pdam * 0.8)); // 最小物理攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsDefend, (int)(data.pdef * 0.8)); // 最小物理防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAttack, (int)(data.mdam * 0.8)); // 最小法术攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicDefend, (int)(data.mdef * 0.8)); // 最小法术防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsAttack, (int)(data.pdam * 1.15)); // 最大物理攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsDefend, (int)(data.pdef * 1.15)); // 最大物理防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicAttack, (int)(data.mdam * 1.15)); // 最大法术攻击力 propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicDefend, (int)(data.mdef * 1.15)); // 最大法术防御力 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsCrit, (int)data.lucky); // 物理致命一击 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicCrit, (int)data.mlucky); // 法术致命一击 propList[index++] = new EntityAttr((int)FightCreatureProp.Hit, (int)data.phit); // 命中 propList[index++] = new EntityAttr((int)FightCreatureProp.Dodge, (int)data.hide_per); // 闪避 propList[index++] = new EntityAttr((int)FightCreatureProp.IceAttack, (int)data.ssdam); // 冰攻 propList[index++] = new EntityAttr((int)FightCreatureProp.FireAttack, (int)data.esdam); // 火攻 propList[index++] = new EntityAttr((int)FightCreatureProp.EleAttack, (int)data.lsdam); // 电攻 propList[index++] = new EntityAttr((int)FightCreatureProp.WitchAttack, (int)data.vsdam); // 暗攻 propList[index++] = new EntityAttr((int)FightCreatureProp.IceDefend, (int)data.ssdef); // 冰防 propList[index++] = new EntityAttr((int)FightCreatureProp.FireDefend, (int)data.esdef); // 火防 propList[index++] = new EntityAttr((int)FightCreatureProp.EleDefend, (int)data.lsdef); // 电防 propList[index++] = new EntityAttr((int)FightCreatureProp.WitchDefend, (int)data.vsdef); // 暗防 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAbsorb, (int)data.pabs); // 物伤吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAbsorb, (int)data.mabs); // 法伤吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.HarmDeepen, (int)data.harm_add_per); // 伤害加深 propList[index++] = new EntityAttr((int)FightCreatureProp.HarmAbsorb, (int)data.harm_sub_per); // 伤害吸收 propList[index++] = new EntityAttr((int)FightCreatureProp.CritiRatio, (int)data.criti_ratio); // 暴击伤害百分比 propList[index++] = new EntityAttr((int)FightCreatureProp.Cure, (int)data.cure); // 治疗 propList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, (int)moveSpeed); // propList[index++] = new EntityAttr((int)PlayerProp.LoginOutTime, (int)data.lastofftime); // 最近一次下线时间 }
//------------------------------------------------------------------------------------------------------- /** * @brief 构建玩家属性列表 * @param */ private static void BuildPlayerPropList(GameCmd.t_MapUserData data, ref EntityAttr[] propList) { if (propList.Length < 0 || propList.Length > (int)PlayerProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildPlayerPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)EntityProp.BaseID, 1); // 玩家没有模板ID 0则使用默认数据 需要根据职业和性别来获取 需要读取配置表 propList[index++] = new EntityAttr((int)CreatureProp.Hp, (int)data.userdata.curhp); propList[index++] = new EntityAttr((int)CreatureProp.MaxHp, (int)data.userdata.maxhp); propList[index++] = new EntityAttr((int)CreatureProp.Level, (int)data.userdata.level); propList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, (int)data.userdata.movespeed); propList[index++] = new EntityAttr((int)PlayerProp.Job, (int)data.userdata.type); propList[index++] = new EntityAttr((int)PlayerProp.Country, (int)1); propList[index++] = new EntityAttr((int)CreatureProp.Face, (int)1); propList[index++] = new EntityAttr((int)PlayerProp.Sex, (int)FaceToSex(1)); propList[index++] = new EntityAttr((int)PlayerProp.GoodNess, (int)data.userdata.goodstate); propList[index++] = new EntityAttr((int)PlayerProp.RideBaseId, (int)data.userdata.ride_base_id); propList[index++] = new EntityAttr((int)PlayerProp.TransModelResId, (int)data.userdata.trans_model_id); propList[index++] = new EntityAttr((int)PlayerProp.StateBit, (int)0); propList[index++] = new EntityAttr((int)EntityProp.EntityState, (int)0); //氏族id //propList[index++] = new EntityAttr((int)CreatureProp.ClanId, (int)data.userdata.clan_id); propList[index++] = new EntityAttr((int)PlayerProp.TitleId, (int)data.userdata.title_id); //称号Id propList[index++] = new EntityAttr((int)PlayerProp.GodLevel, (int)data.userdata.god_level); //神魔等级 propList[index++] = new EntityAttr((int)CreatureProp.Camp, (int)data.userdata.camp); propList[index++] = new EntityAttr((int)PlayerProp.SkillStatus, (int)(data.userdata.skill_status + 1)); //氏族ID分为两个存 uint clanId = data.userdata.clan_id; int clanIdLow = (int)(clanId & 0x0000ffff); int clanIdHigh = (int)(clanId >> 16); propList[index++] = new EntityAttr((int)CreatureProp.ClanIdLow, clanIdLow); propList[index++] = new EntityAttr((int)CreatureProp.ClanIdHigh, clanIdHigh); //验证代码 uint low = (uint)clanIdLow; uint high = (uint)clanIdHigh; uint newhigh = high << 16; uint newClanId = newhigh | low; Engine.Utility.Log.Error("--->>> 服务器发的:" + data.userdata.clan_id); Engine.Utility.Log.Error("--->>> 客户端存的:" + newClanId); Engine.Utility.Log.Error("---客户端存的低位:" + low); Engine.Utility.Log.Error("---客户端存的高位:" + newhigh); }
/// <summary> /// 构建宠物属性列表 /// </summary> /// <param name="data"></param> /// <param name="propList"></param> public static void BuildPetPropListByPetData(GameCmd.PetData data, ref EntityAttr[] propList) { if (propList.Length < 0 || propList.Length > (int)PetProp.End - (int)EntityProp.Begin) { Engine.Utility.Log.Error("BuildPlayerPropList:属性列表长度非法"); return; } int index = 0; propList[index++] = new EntityAttr((int)CreatureProp.Hp, (int)data.hp); propList[index++] = new EntityAttr((int)PetProp.LevelExp, (int)data.exp); // 经验 propList[index++] = new EntityAttr((int)CreatureProp.Level, (int)data.lv); propList[index++] = new EntityAttr((int)PetProp.Sex, (data.male == true) ? 0 : 1); propList[index++] = new EntityAttr((int)PetProp.Character, (int)data.character); propList[index++] = new EntityAttr((int)PetProp.PetGuiYuanStatus, (int)data.grade); propList[index++] = new EntityAttr((int)PetProp.YinHunExp, (int)data.yh_exp); propList[index++] = new EntityAttr((int)PetProp.YinHunLevel, (int)data.yh_lv); propList[index++] = new EntityAttr((int)PetProp.Life, (int)data.life); propList[index++] = new EntityAttr((int)PetProp.MaxPoint, (int)data.max_point); propList[index++] = new EntityAttr((int)PetProp.BaseID, (int)data.base_id); // propList[index++] = new EntityAttr( (int)FightCreatureProp.Power , (int)data.power ); // 战斗力 //当前天赋 propList[index++] = new EntityAttr((int)PetProp.StrengthTalent, (int)data.cur_talent.liliang); propList[index++] = new EntityAttr((int)PetProp.CorporeityTalent, (int)data.cur_talent.tizhi); propList[index++] = new EntityAttr((int)PetProp.IntelligenceTalent, (int)data.cur_talent.zhili); propList[index++] = new EntityAttr((int)PetProp.SpiritTalent, (int)data.cur_talent.jingshen); propList[index++] = new EntityAttr((int)PetProp.AgilityTalent, (int)data.cur_talent.minjie); propList[index++] = new EntityAttr((int)PetProp.CommonJieBianLv, (int)data.by_lv); propList[index++] = new EntityAttr((int)PetProp.AdvaceJieBianLv, (int)data.replace_by_lv); //属性 propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAttack, (int)data.attr.pdam); propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsDefend, (int)data.attr.pdef); propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAttack, (int)data.attr.mdam); propList[index++] = new EntityAttr((int)FightCreatureProp.MagicDefend, (int)data.attr.mdef); propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsCrit, (int)data.attr.plucky); // 暴击 propList[index++] = new EntityAttr((int)FightCreatureProp.MagicCrit, (int)data.attr.mlucky); propList[index++] = new EntityAttr((int)FightCreatureProp.Hit, (int)data.attr.hit); propList[index++] = new EntityAttr((int)FightCreatureProp.Dodge, (int)data.attr.hide); propList[index++] = new EntityAttr((int)FightCreatureProp.FireDefend, (int)data.attr.heatdef + data.attr.mdef); propList[index++] = new EntityAttr((int)FightCreatureProp.IceDefend, (int)data.attr.biochdef + data.attr.mdef); propList[index++] = new EntityAttr((int)FightCreatureProp.EleDefend, (int)data.attr.lightdef + data.attr.mdef); propList[index++] = new EntityAttr((int)FightCreatureProp.WitchDefend, (int)data.attr.wavedef + data.attr.mdef); propList[index++] = new EntityAttr((int)FightCreatureProp.Power, (int)data.attr.fight_power); propList[index++] = new EntityAttr((int)CreatureProp.MaxHp, (int)data.attr.maxhp); // 战斗属性 }
private void query1_ConditionsChanged(object sender, ConditionsChangeEventArgs e) { EntityAttr baseAttr = null; if (e.Condition != null) { baseAttr = e.Condition.BaseAttr; } if (baseAttr != null && baseAttr == _countryAttr) { QPanel.RefreshList("RegionList"); } BuildSQL(); ResultDS.Reset(); }
protected void QueryPanel1_CreateValueElement(object sender, Korzh.EasyQuery.WebControls.CreateValueElementEventArgs e) { // this method demonstrates an ability to change value elelements at run-time // for example in this case we change element from ListRowElement to EditRowElement if list of available values is too long if (e.ConditionRow.Condition is SimpleCondition) { EqExpression baseExpr = ((SimpleCondition)e.ConditionRow.Condition).BaseExpr; EntityAttr attr = ((EntityAttrExpr)baseExpr).Attribute; if (attr.DefaultEditor is SqlListValueEditor) { string sql = ((SqlListValueEditor)attr.DefaultEditor).SQL; if (ResultSetIsTooBig(sql)) //or put your condition here { e.Element = new EditXElement(); } } } }
protected void QueryPanel1_ListRequest(object sender, Korzh.EasyQuery.WebControls.ListRequestEventArgs e) { EntityAttr countryAttr = query.Model.EntityRoot.FindAttribute(EntityAttrProp.Expression, "Customers.Country"); string country = query.GetOneValueForAttr(countryAttr); if (e.ListName == "SQL") { string sql = e.Data.ToString(); GetListBySql(sql, e.ListItems); } else if (e.ListName == "RegionList") { e.ListItems.Clear(); if (country == "Canada") { e.ListItems.Add("British Columbia", "BC"); e.ListItems.Add("Quebec", "Quebec"); } else if (country == "USA") { e.ListItems.Add("California", "CA"); e.ListItems.Add("Colorado", "CO"); e.ListItems.Add("Oregon", "OR"); e.ListItems.Add("Washington", "WA"); } } else if (e.ListName == "CityList") { string sql = "SELECT DISTINCT city, city FROM Customers"; if (!string.IsNullOrEmpty(country)) { sql += " WHERE country = '" + country.Replace("'", "''") + "'"; } GetListBySql(sql, e.ListItems); } }
private void InitEasyQuery() { //intialize the data model and load it from XML (or JSON) file _dataModel = new DbModel(); _dataModel.LoadFromXmlFile(System.IO.Path.Combine(_dataFolder, "NWindSQL.xml")); //uncomment the next line if your prefer to store the model in JSON //_dataModel.LoadFromJsonFile(System.IO.Path.Combine(_dataFolder, "NWindSQL.json")); //saving the reference to Customer Country attribute in our model (will be used on RequestList processing) _countryAttr = _dataModel.EntityRoot.FindAttribute(EntityAttrProp.Expression, "Customers.Country"); //initialize the query and assign it to all visual controls. _query = new DbQuery(_dataModel); QPanel.Query = _query; CPanel.Query = _query; SPanel.Query = _query; EntPanel.Query = _query; //setting differnt properties of EasyQuery visual controls this.CPanel.AllowEditCaptions = true; this.CPanel.AllowSorting = true; this.EntPanel.ShowFilter = true; }