private NodeState BuyConstruct(ConstructId type) { if (!constructCountQuery.ContainsKey(type)) { constructCountQuery.Add(new QueryItem <ConstructId, float>(type, 0.0f), true); int price = 0; switch (type) { case ConstructId.Barrack: price = ConstructPrice.Barrack; break; case ConstructId.Defender: price = ConstructPrice.Defender; break; case ConstructId.Refinery: price = ConstructPrice.Refinery; break; case ConstructId.Yard: price = ConstructPrice.Yard; break; } npc.TakeGold(-price); } return(NodeState.Success); }
public void Prepare(ref Log returnLog) { try { TraceFile source = new TraceFile(); source.InitializeAsReader(TraceSource); while (source.Read()) { foreach (SQLEvent sqlEvent in EventList) { if (source.GetString(source.GetOrdinal("EventClass")) == sqlEvent.EventName) { SQLStatement newStatement = new SQLStatement(); newStatement.Statement = source.GetString(source.GetOrdinal("TextData")); newStatement.ConnectionString = ConnectionString == "{PARENT}" ? _config.SourceConnectionString : ConnectionString; QueryList.Add(newStatement); } } } returnLog.EndTime = DateTime.Now; returnLog.Message = "Prepare successful."; } catch (Exception ex) { returnLog.EndTime = DateTime.Now; returnLog.Successful = false; returnLog.Message = "Prepare failed - " + ex.Message; } }
public async void Init() { MainPage.Current.ActiveProgressRing(); try { QueryList.Clear(); string jsonResult = await LinqHelper.GetSearchData(SearchModel, "SearchQuery"); if (SearchModel.ExportType.HasValue && SearchModel.ExportType.Value == ExportType.AllPages) { var result = JsonConvert.DeserializeObject <JsonResultTemplate <SearchQuery> >(jsonResult); if (result.ResultCode == (int)ResultCodeType.操作成功) { result.Data.ToList().ForEach(item => { QueryList.Add(item); }); } } else { var result = JsonConvert.DeserializeObject <JsonSearchResultTemplate <SearchQuery> >(jsonResult); SearchModel.TotalCount = result.Data.TotalSize; SearchModel.PageIndex = result.Data.PageIndex; SearchModel.PageSize = result.Data.PageSize; result.Data.Data.ToList().ForEach(item => { QueryList.Add(item); }); } } catch (Exception ex) { await MainPage.ShowErrorMessage(ex.Message); } finally { MainPage.Current.InActiveProgressRing(); } }
/// <summary> /// 新增一个查询项 /// </summary> /// <param name="query">查询项</param> private void AddInputQuery(InputQuery query) { if (query == null) { //TO-DO: throw exception? return; } lock (QueryList) { QueryList.Add(query); } // TO-DO: Do not save anyway, add some saving policies SaveQuery(); }
// Reads XPath queries from queryInfoList into XML_Query object. public void MakeXMLQuery(List <string> queryInfoList) { XML_Query query = new XML_Query(); QueryList.Add(query); query.JobId = queryInfoList[1].Split('=')[1]; query.JobEnabled = queryInfoList[2].Split('=')[1]; query.JobName = queryInfoList[3].Split('=')[1].Trim(); query.JobDescription = queryInfoList[4].Split('=')[1].Trim(); query.System = queryInfoList[6].Split('=')[1]; query.SubSystem = queryInfoList[7].Split('=')[1]; query.Source = queryInfoList[8].Split('=')[1].Trim(); query.Target = queryInfoList[9].Split('=')[1]; query.Query = queryInfoList[12]; }
private NodeState BuyAgent(Soldier type) { if (!agentCountQuery.ContainsKey(type)) { if (CheckEnoughGoldToBuyAgent(type) == NodeState.Success) { agentCountQuery.Add(new QueryItem <Soldier, float>(type, 0.0f), false); return(NodeState.Success); } else { return(NodeState.Failure); } } return(NodeState.Success); }
private void ReadInQueries() { using (StreamReader sr = new StreamReader(DDB_Control.Tearsheet_Queries)) { List <string> QueryList = new List <string>();; while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line.IndexOf("---") > -1) { string fieldName = line.Substring(0, line.IndexOf("---")).Trim(); QueryList.Add(line.Substring(line.IndexOf("---") + 3).Trim()); QueryClusters.Add(fieldName, QueryList); QueryList = new List <string>(); } else { QueryList.Add(line); } } } }
public SearchCommand(ConnectionBase connection, SearchQuery query) : base(connection) { ArgumentAssert.IsNotNull(query, "query"); QueryList.Add(query); }
public ValveType2Up() { byte[] b = new byte[4]; b[0] = 0x01; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Error in calibration CRC"); b[1] = 0x03; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Error in EEPROM CRC"); b[1] = 0x02; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Error in module ID CRC"); b[1] = 0x04; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Watchdog triggered"); b[1] = 0x05; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "EEPROM access error"); b[0] = 0x02; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Supply voltage low"); b[0] = 0x02; b[1] = 0x02; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Supply voltage high"); b[0] = 0x02; b[1] = 0x03; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Supply voltage out of range"); b[0] = 0x03; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Temperature low"); b[0] = 0x03; b[1] = 0x02; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Temperature high"); b[0] = 0x03; b[1] = 0x03; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Temperature out of range"); b[0] = 0x04; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Pump is in error"); //b[0] = 0x04; //b[1] = 0x09; //errorCodes.Add(BitConverter.ToInt16(b, 0), "TestLowError");//! b[0] = 0x05; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Pressure sensor out of range"); b[0] = 0x08; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 1 failure"); CriticalErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 1 failure"); b[0] = 0x08; b[1] = 0x02; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 2 failure"); CriticalErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 2 failure"); b[0] = 0x08; b[1] = 0x03; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 3 failure"); CriticalErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 3 failure"); b[0] = 0x08; b[1] = 0x04; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 4 failure"); CriticalErrorCodes.Add(BitConverter.ToInt16(b, 0), "Valve 4 failure"); b[0] = 0x09; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Input switch stuck"); b[0] = 0x09; b[1] = 0x02; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Input switch out of range"); b[0] = 0x09; b[1] = 0x03; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Input switch short to GND"); b[0] = 0x09; b[1] = 0x04; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Input switch short to VCC"); b[0] = 0x0B; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Ram validation failed"); b[0] = 0x0D; b[1] = 0x01; ErrorCodes.Add(BitConverter.ToInt16(b, 0), "Current out of range"); QueryList.Add(GetTesterPresentQuery()); QueryList.Add(GetTesterPresentQuery()); QueryList.Add(GetActivateDebugQuery()); QueryList.Add(GetEnablePumpQuery()); QueryList.Add(GetValve1OnQuery()); //Cell 1 inflate - lumbar top QueryList.Add(GetValve2OnQuery()); //Cell 1 deflate - lumbar top QueryList.Add(GetValve3OnQuery()); //Cell 2 inflate - lumbar bottom QueryList.Add(GetValve4OnQuery()); //Cell 2 deflate - lumbar bottom QueryList.Add(GetActiveErrors()); QueryList.Add(GetOccuredErrors()); }