public void barcos_data(string id) { if (Session["barcos_data"] != null) { BarcosDataView mView = (BarcosDataView)Session["barcos_data"]; switch (mView) { case BarcosDataView.FULL: //barcos_data(Session["punto"].ToString()); break; case BarcosDataView.EN_LIMITES: barcos_data_en_limites(Session["punto"].ToString()); return; case BarcosDataView.EN_ZONA: barcos_data_en_zona(Session["punto"].ToString()); return; } } var newProfiler = new MiniProfiler[] { new MiniProfiler("-task1 (tiempo invalido=>)", ProfileLevel.Verbose), new MiniProfiler("-task2 (tiempo invalido=>)", ProfileLevel.Verbose), new MiniProfiler("-task3 (tiempo invalido=>)", ProfileLevel.Verbose), new MiniProfiler("-task4 (tiempo invalido=>)", ProfileLevel.Verbose) }; Task[] tasks = new Task[4] { Task.Factory.StartNew(() => ViewData["barcos_en_zona"] = DaoLib.barcos_en_zona(id, newProfiler[0])), Task.Factory.StartNew(() => ViewData["barcos_salientes"] = DaoLib.barcos_salientes(id, newProfiler[1])), Task.Factory.StartNew(() => ViewData["barcos_entrantes"] = DaoLib.barcos_entrantes(id, newProfiler[2])), Task.Factory.StartNew(() => ViewData["barcazas_en_zona"] = DaoLib.barcazas_en_zona(id, newProfiler[3])) }; //Block until all tasks complete. Task.WaitAll(tasks); MiniProfiler.Current.AddProfilerResults(newProfiler[0]); MiniProfiler.Current.AddProfilerResults(newProfiler[1]); MiniProfiler.Current.AddProfilerResults(newProfiler[2]); MiniProfiler.Current.AddProfilerResults(newProfiler[3]); }
public void barcos_data_en_zona(string id) { var newProfiler = new MiniProfiler[] { new MiniProfiler("-task1 (tiempo invalido=>)", ProfileLevel.Verbose), new MiniProfiler("-task2 (tiempo invalido=>)", ProfileLevel.Verbose) }; Task[] tasks = new Task[2] { Task.Factory.StartNew(() => ViewData["barcos_en_zona"] = DaoLib.barcos_en_zona(id, newProfiler[0])), Task.Factory.StartNew(() => ViewData["barcazas_en_zona"] = DaoLib.barcazas_en_zona(id, newProfiler[1])) }; //Block until all tasks complete. Task.WaitAll(tasks); MiniProfiler.Current.AddProfilerResults(newProfiler[0]); MiniProfiler.Current.AddProfilerResults(newProfiler[1]); ViewData["barcos_salientes"] = null; ViewData["barcos_entrantes"] = null; }
public ActionResult barcoenzona(int etapa_id, int viaje_id, string carga) { ViewData["viaje_id"] = viaje_id; ViewData["etapa_id"] = etapa_id; ViewData["carga"] = carga; ViewData["barcos_en_zona"] = DaoLib.barcos_en_zona(Session["punto"].ToString(), null); var i = 0; foreach (Dictionary <string, string> barco in (ViewData["barcos_en_zona"] as List <object>)) { if (barco["ETAPA_ID"] == etapa_id.ToString()) { continue; } i++; } if (i == 0) { return(View("noHayBarcos")); } return(View()); }