| | |
| | | if (text == Language.StringByID(StringId.kongqiyou)) |
| | | { |
| | | //优 |
| | | value = "excellent"; |
| | | value = "Excellent"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.kongqiliang)) |
| | | { |
| | | //良 |
| | | value = "good"; |
| | | value = "Good"; |
| | | } |
| | | else if (text == Language.StringByID(StringId.kongqicha)) |
| | | { |
| | | //差 |
| | | value = "poor"; |
| | | value = "Poor"; |
| | | } |
| | | AddDic(value); |
| | | }; |
| | |
| | | { |
| | | Input input = new Input(); |
| | | input.sid = LogicMethod.CurrLogicMethod.NewSid(); |
| | | input.condition_type = "9"; |
| | | input.condition_type = "6"; |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "key", "airquality"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "="); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string"); |
| | | LogicMethod.CurrLogicMethod.dictionary(dic, "value", value); |
| | | input.condition.Add(dic); |
| | | AddCondition(input); |
| | | AddCondition(input, "airquality" ,"="); |
| | | } |
| | | /// <summary> |
| | | /// 添加条件 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | private void AddCondition(Input input) |
| | | private void AddCondition(Input input, string keyValue, string comparator) |
| | | { |
| | | ///记录索引值 |
| | | int index = -1; |
| | | for (var i = 0; i < Logic.currlogic.input.Count; i++) |
| | | { |
| | | var condition_type = Logic.currlogic.input[i].condition_type; |
| | | if (condition_type == "9") |
| | | if (condition_type == "6") |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | var dicList = Logic.currlogic.input[i].condition; |
| | | if (ExistKey(dicList, keyValue, comparator)) |
| | | { |
| | | ///找到标记索引,退出循环体 |
| | | index = i; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (index != -1) |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断是否存在Key |
| | | /// </summary> |
| | | /// <param name="dicList"></param> |
| | | /// <param name="keyValue"></param> |
| | | /// <param name="comparator">比较关系</param> |
| | | /// <returns></returns> |
| | | private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator) |
| | | { |
| | | for (int i = 0; i < dicList.Count; i++) |
| | | { |
| | | var dic = dicList[i]; |
| | | string key = dic["key"]; |
| | | string comparatorValue = dic["comparator"]; |
| | | if (key == keyValue && comparatorValue == comparator) |
| | | { |
| | | //判断是否存在 |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |