static Prerules readRules(OrclDBManager orclDB_in, List <StandInfo> standList, List <FlightInfo> flightList) { Prerules preRules = new Prerules(); preRules.Stnd_fl_type = new Dictionary <string, int[]>(); try { //设置机型-机位对应关系 for (int i = 0; i != flightList.Count; i++) { string match_flighCode = flightList[i].flightCode; int[] match_stand = new int[standList.Count]; string sql_match = "select * from STAND_CONS where AIRCRAFTTYPE = :aircrafttype"; Dictionary <string, object> paramDic = new Dictionary <string, object>(); paramDic.Add("aircrafttype", flightList[i].flightType.ToString()); DataTable a = orclDB_in.GetDataTable(sql_match, paramDic); List <string> a_stand = new List <string>(); for (int t = 0; t != a.Rows.Count; t++) { a_stand.Add(a.Rows[t]["STANDCODE"].ToString()); } for (int j = 0; j != standList.Count; j++) { if (a_stand.Contains(standList[j].standCode)) { match_stand[j] = 1; } else { match_stand[j] = 0; } } preRules.Stnd_fl_type.Add(match_flighCode, match_stand); a_stand.Clear(); } } catch (Exception e) { Console.Write(e); } return(preRules); }
static void Main(string[] args) { OrclDBManager orclDB_in = new OrclDBManager("gateDatain"); string a = "2015 / 08 / 13 19:20:00", b = "2015 / 08 / 13 22:20:00"; List <FlightInfo> flightList = readFlights(orclDB_in, a, b); List <StandInfo> standList = readStands(orclDB_in); Prerules preRules = readRules(orclDB_in, standList, flightList); foreach (string key in preRules.Stnd_fl_type.Keys) { Console.Write(key + ": "); //Console.Write("key :{0} value:{1}\n", key, preRules.match[key][1]); for (int i = 0; i != preRules.Stnd_fl_type[key].Length; i++) { Console.Write(preRules.Stnd_fl_type[key][i] + " "); } Console.Write("\n"); } /* * int count = 0; * foreach (int i in preRules.match["1033544547"]) * { * count += i; * } * Console.Write(count); */ /* * string key = "1033544547"; * Console.Write(key + ": "); * //Console.Write("key :{0} value:{1}\n", key, preRules.match[key][1]); * for (int i = 0; i != preRules.match[key].Length; i++) * { * Console.Write(standList[i].standCode + ": "); * Console.Write(preRules.match[key][i] + " "); * * } * Console.Write("\n"); * Console.Read(); */ }