public ActionResult ReturnToShowFlightState() { //在这里更改后返回 string nfid = Request.Params["a"]; //需要将这两项每一项拆分为两部分机场航站楼 string nt_a_t = Request.Params["b"]; string[] sArray1 = Regex.Split(nt_a_t, "-", RegexOptions.IgnoreCase); string nt_a = sArray1[0]; string nt_t = sArray1[1]; string nl_a_t = Request.Params["c"]; string[] sArray2 = Regex.Split(nl_a_t, "-", RegexOptions.IgnoreCase); string nl_a = sArray2[0]; string nl_t = sArray2[1]; // string ne_t_t = Request.Params["d"]; string ne_l_t = Request.Params["e"]; string nstate = Request.Params["f"]; // /*在这里修改数据库*/ FLIGHTIME objft = new FLIGHTIME() { F_ID = nfid, T_AIRPORT = nt_a, T_TERMINAL = nt_t, EX_TAKEOFF_TIME = Convert.ToDateTime(ne_t_t), EX_LAND_TIME = Convert.ToDateTime(ne_l_t), L_AIRPORT = nl_a, L_TERMNAL = nl_t }; db.Updateable(objft).ExecuteCommand(); FSTATE objstate = new FSTATE() { F_ID = nfid, STATE = nstate }; db.Updateable(objstate).ExecuteCommand(); /* * Fstate objstate = new Fstate(nfid, nstate); * DataBaseAccess.UpdateObject(objstate); */ // List <string> needs = new List <string>(); needs.Add("F_ID"); needs.Add("t_airport"); needs.Add("t_terminal"); needs.Add("l_airport"); needs.Add("l_termnal"); needs.Add("ex_takeoff_time"); needs.Add("ex_land_time"); needs.Add("state"); List <FlightStateReturn> res = DataBaseAccess.GetFlightsState(needs); // return(View("FlightState", res)); // }
public void dealDropFlightime(FLIGHTIME dropFlightime) { db.Updateable <FLIGHTIME>().SetColumns(it => new FLIGHTIME() { RE_LAND_TIME = dropFlightime.EX_LAND_TIME }) .Where(it => it.F_ID == dropFlightime.F_ID).ExecuteCommand(); db.Updateable <FSTATE>().SetColumns(it => new FSTATE() { STATE = "已降落" }) .Where(it => it.F_ID == dropFlightime.F_ID).ExecuteCommand(); }
public ActionResult ReceiveMsg1() { //新建航班,多表插入 string id = Request.Params["id"]; string pid = Request.Params["pid"]; string t_airport = Request.Params["t_airport"]; string t_terminal = Request.Params["t_terminal"]; string t_time = Request.Params["t_time"]; string l_airport = Request.Params["l_airport"]; string l_terminal = Request.Params["l_terminal"]; string l_time = Request.Params["l_time"]; Actions a = new Actions(); PLANE b = a.GetPLANE(pid); FLIGHT obj2 = new FLIGHT(); obj2.F_ID = id; obj2.P_ID = pid; obj2.CAPACITY = b.CAPACITY; obj2.RESERVE = 0; obj2.CHECKED = 0; obj2.VALUE = 500; obj2.LUGGAGE = 50; obj2.BOARD = 0; FLIGHTIME obj1 = new FLIGHTIME(); obj1.F_ID = id; obj1.T_AIRPORT = t_airport; obj1.T_TERMINAL = t_terminal; obj1.L_AIRPORT = l_airport; obj1.L_TERMNAL = l_terminal; obj1.EX_TAKEOFF_TIME = a.SystemTime.AddHours(10); obj1.EX_LAND_TIME = a.SystemTime.AddHours(12); obj1.RE_TAKEOFF_TIME = null; obj1.RE_LAND_TIME = null; string d_ID = id; //降落飞机ID char[] str = d_ID.ToCharArray(); string d_ID_re; //返回航班ID int temp = int.Parse(str[5].ToString()); if (temp % 2 == 0) { d_ID_re = d_ID.Substring(0, d_ID.Length - 1) + (temp + 1).ToString(); } else { d_ID_re = d_ID.Substring(0, d_ID.Length - 1) + (temp - 1).ToString(); } FLIGHTIME obj3 = new FLIGHTIME(); obj3.F_ID = d_ID_re; obj3.T_AIRPORT = l_airport; obj3.T_TERMINAL = l_terminal; obj3.L_AIRPORT = t_airport; obj3.L_TERMNAL = t_terminal; obj3.EX_TAKEOFF_TIME = a.SystemTime.AddHours(14); obj3.EX_LAND_TIME = a.SystemTime.AddHours(16); obj3.RE_TAKEOFF_TIME = null; obj3.RE_LAND_TIME = null; db.Insertable(obj1).ExecuteCommand(); db.Insertable(obj2).ExecuteCommand(); db.Insertable(obj3).ExecuteCommand(); //DataBaseAccess.insertObj(obj1); //DataBaseAccess.insertObj(obj2); //DataBaseAccess.insertObj(obj3); return(View("Airlines")); }