private IndexFilter CreateIndexFilter() { IndexFilter filter = new IndexFilter(); filter.MinLevel = MinimumLevel; filter.MaxLevel = MaximumLevel; filter.IncludeEquipped = ShowEquipped; var rarityItems = ItemQualities; if (rarityItems != null) { filter.ItemQualities = rarityItems.Where(x => x.Selected).Select(x => x.Value).ToArray(); } var itemTypes = ItemTypes as IEnumerable <MultiselectComboItem>; if (itemTypes != null) { filter.ItemTypes = itemTypes.Where(x => x.Selected).Select(x => x.Value).ToArray(); } filter.PageSize = 50; return(filter); }
public ActionResult ExportErrors(string Queue, [Bind(Include = "startDate,endDate,userName")] IndexFilter filter) { short queueID = short.Parse(Queue); var files = db.StudentFile.Include(s => s.Record); var q = from e in db.ProcessingError join c in db.ErrorComplete on e.ErrorComID equals c.ErrorComID join et in db.ErrorType on e.ErrorTypeID equals et.ErrorTypeID join p in db.Processing on e.ProcID equals p.ProcID join r in db.Record on p.RecordID equals r.RecordID join t in db.FileType on r.FileTypeID equals t.FileTypeID join f in db.StudentFile on r.FileID equals f.FileID where p.QueueID == queueID && e.DateFound >= filter.startDate && e.DateFound <= filter.endDate select new LookUp { e = e, p = p, r = r, f = f, t = t, et = et, c = c }; var dbList = new System.Data.DataTable("DB"); dbList.Columns.Add("Name"); dbList.Columns.Add("SSN"); dbList.Columns.Add("File Type"); dbList.Columns.Add("Date Found"); dbList.Columns.Add("Error Type"); dbList.Columns.Add("Error Completed"); dbList.Columns.Add("Complete Type"); dbList.Columns.Add("Username"); dbList.Columns.Add("Note"); foreach (var item in q) { dbList.Rows.Add(item.f.FileName, item.f.FileSSN, item.t.TypeDescription, item.e.DateFound, item.et.Description, item.e.DateComplete, item.c.Description, item.p.Username, item.e.Note); } var grid = new GridView(); grid.DataSource = dbList; grid.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=ErrorList.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); grid.RenderControl(htw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult CompletedErrors(string username) { IndexFilter u = new IndexFilter(); u.userName = username; return(View(u)); }
public ActionResult Index([Bind(Include = "startDate,endDate,userName")] IndexFilter filter) { IEnumerable <Processing> comFiles; comFiles = filter.GetCompleteFiles(); return(View("Results", comFiles)); }
public ActionResult CompletedErrors([Bind(Include = "startDate,endDate,userName")] IndexFilter filter) { DateTime dtEnd = (DateTime)filter.endDate; DateTime dtStart = (DateTime)filter.startDate; var errorFiles = db.ProcessingError.Include(p => p.Processing).Include(p => p.Processing.Queue).Include(p => p.ErrorType).Include(p => p.ErrorType).Where(p => p.DateComplete <= dtEnd && p.DateComplete >= dtStart && p.Processing.Username == filter.userName).Select(p => p.Processing).Distinct(); return(View("Index", errorFiles.ToList())); }
// GET: CompletedFiles public ActionResult Index(string username) { IndexFilter u = new IndexFilter(); if (String.IsNullOrEmpty(username)) { username = User.Identity.GetUserName(); } u.userName = username; return(View(u)); }
public async Task <List <Product> > Filter(IndexFilter filter) { #region private_members IQueryable <Product> products = db.Products.Select(p => p); #endregion products = await FilterByCategoryAsync(products, filter.SubCategoryId); products = await FilterByPriceAsync(products, filter.MinPrice, filter.MaxPrice); products = await FilterByPageAsync(products, filter.Page); products = await FilterBySearchQueryAsync(products, filter.SearchQuery); products = await SortByPriceAsync(products, filter.PriceSort); return(await products.ToListAsync()); }
void Start() { GameObject MPC_Spawner = GameObject.Find("CorrectPolygons"); Correcting_polygons_Native MPC_Native_Script = MPC_Spawner.GetComponent <Correcting_polygons_Native>(); int MPC2_num = MPC_Native_Script.ActiveV6_MPC2_NativeList.Length; int MPC3_num = MPC_Native_Script.ActiveV6_MPC3_NativeList.Length; NativeArray <V6> MPC2_Native = MPC_Native_Script.ActiveV6_MPC2_NativeList; NativeArray <Vector3> MPC2_Side = MPC_Native_Script.Active_MPC2_Perpendiculars; NativeArray <V6> MPC3_Native = MPC_Native_Script.ActiveV6_MPC3_NativeList; NativeArray <Vector3> MPC3_Side = MPC_Native_Script.Active_MPC3_Perpendiculars; NativeArray <float> MPC3_Att = MPC_Native_Script.ActiveV6_MPC3_Power; Debug.Log("Size of MPC2 List = " + MPC2_Native.Length + "; MPC3 List = " + MPC3_Native.Length); // all about the LookUpTable for MPC2 #region Generating LookUp Table for MPC2 NativeArray <SeenPath2> allpath2 = new NativeArray <SeenPath2>(MPC2_num * (MPC2_num - 1), Allocator.TempJob); NativeArray <RaycastCommand> CommandsNativeArray_MPC2 = new NativeArray <RaycastCommand>(MPC2_num * (MPC2_num - 1), Allocator.TempJob); NativeArray <RaycastHit> ResultsNativeArray_MPC2 = new NativeArray <RaycastHit>(MPC2_num * (MPC2_num - 1), Allocator.TempJob); NativeArray <Vector2Int> MPC2_ID = new NativeArray <Vector2Int>(MPC2_num * (MPC2_num - 1), Allocator.TempJob); float t_V6 = Time.realtimeSinceStartup; #region Paralle Raycasting MPC2 ParallelRayCastingDataV6 RayCastingData_MPC2 = new ParallelRayCastingDataV6 { MPC_Array = MPC2_Native, commands = CommandsNativeArray_MPC2, ID = MPC2_ID, }; JobHandle jobHandle_RayCastingData_MPC2 = RayCastingData_MPC2.Schedule(MPC2_num * (MPC2_num - 1), 1); jobHandle_RayCastingData_MPC2.Complete(); // parallel raycasting JobHandle rayCastJobMPC1 = RaycastCommand.ScheduleBatch(CommandsNativeArray_MPC2, ResultsNativeArray_MPC2, 64, default); rayCastJobMPC1.Complete(); #endregion #region Parallel Calculation of Path2 Parameters // parallel search of possiblte second order of paths ParallelPath2Search parallelPath2Search = new ParallelPath2Search { MPC_Array = MPC2_Native, MPC_Perpendiculars = MPC2_Side, // Who is writing code like this??? It's actually Active_MPC2_Perpendiculars (perpendiculars Karl!!!) commands = CommandsNativeArray_MPC2, results = ResultsNativeArray_MPC2, ID = MPC2_ID, maxDistance = MaxSeenDistance / 3, angleThreshold = (float)0.1, PossiblePath2 = allpath2, }; JobHandle jobHandlePath2Search = parallelPath2Search.Schedule(MPC2_num * (MPC2_num - 1), 64); jobHandlePath2Search.Complete(); #endregion #region Filtering Zero Valued Path2 NativeList <int> indexes = new NativeList <int>(Allocator.TempJob); IndexFilter indexFilter = new IndexFilter { Array = allpath2, }; JobHandle jobHandleIndexFilter = indexFilter.ScheduleAppend(indexes, allpath2.Length, 64); jobHandleIndexFilter.Complete(); LookUpTableMPC2 = new NativeArray <SeenPath2>(indexes.Length, Allocator.Persistent); NativeArray <Vector2Int> LUTIndexArrayMPC2 = new NativeArray <Vector2Int>(indexes.Length, Allocator.TempJob); LookUpTableFinal lookUpTableFinalMPC2 = new LookUpTableFinal { InArray = allpath2, IndexArray = indexes, OutArray = LookUpTableMPC2, IndxArray = LUTIndexArrayMPC2, }; JobHandle jobHandleLookUpTableMPC2 = lookUpTableFinalMPC2.Schedule(indexes.Length, 64); jobHandleLookUpTableMPC2.Complete(); #endregion #region Testing Function for Preparing Indexes //Vector2Int[] MPC2LUTID = new Vector2Int[MPC2_num]; MPC2LUTID = new NativeArray <Vector2Int>(MPC2_num, Allocator.Persistent); int progressionIndex = 0; for (int i = 0; i < MPC2_num; i++) { int index_min = progressionIndex; int index_max = progressionIndex; int flagIndex = 0; // if 1 then something is found for (int j = progressionIndex; j < LookUpTableMPC2.Length; j++) { if (i == LookUpTableMPC2[j].MPC_IDs.x) { index_max = j; flagIndex = 1; } else { break; } } // check if the MPC can see others or not if (flagIndex == 1) { progressionIndex = index_max + 1; MPC2LUTID[i] = new Vector2Int(index_min, index_max); if (index_max - index_min + 1 > maxlengthMPC2) { maxlengthMPC2 = index_max - index_min + 1; } } // in the case, it sees others else { MPC2LUTID[i] = new Vector2Int(-1, -1); } // in the case it doesn't see others } /* for checking weak paths * int weak_path2 = 0; * for (int i = 0; i < LookUpTableMPC2.Length; i++) * { * if (LookUpTableMPC2[i].AngularGain < 0.001) * { * weak_path2 += 1; * } * }*/ #endregion Debug.Log("Time spent for parallel raycasting : " + ((Time.realtimeSinceStartup - t_V6) * 1000f) + " ms"); #region drawing MPC2 connections /* * for (int i = 0; i < LookUpTableMPC2.Length; i++) * { * int fromMPC = LookUpTableMPC2[i].MPC_IDs.x; * int toMPC = LookUpTableMPC2[i].MPC_IDs.y; * //Debug.DrawLine(MPC2_Native[fromMPC].Coordinates + new Vector3(0,1,0), MPC2_Native[toMPC].Coordinates + new Vector3(0, 1, 0), Color.green, 1.0f); * Debug.DrawLine(MPC2_Native[fromMPC].Coordinates, MPC2_Native[toMPC].Coordinates, Color.green, 1.0f); * } * * for (int i = 0; i < allpath2.Length; i++) * { * if (allpath2[i].AngularGain != 0) * { * Debug.DrawLine(MPC2_Native[MPC2_ID[i].x].Coordinates, MPC2_Native[MPC2_ID[i].y].Coordinates, Color.cyan, 1.0f); * Debug.DrawLine(MPC2_Native[MPC2_ID[i].x].Coordinates, MPC2_Native[MPC2_ID[i].x].Coordinates + 5*MPC2_Native[MPC2_ID[i].x].Normal, Color.red, 1.0f); * } * }*/ #endregion #region Disposing MPC2 NativeArrays LUTIndexArrayMPC2.Dispose(); indexes.Dispose(); MPC2_ID.Dispose(); CommandsNativeArray_MPC2.Dispose(); ResultsNativeArray_MPC2.Dispose(); allpath2.Dispose(); #endregion #endregion // all about the LookUpTable for MPC3 #region Generating LookUp Table for MPC3 NativeArray <SeenPath2> allpath3_half = new NativeArray <SeenPath2>(MPC3_num * (MPC3_num - 1), Allocator.TempJob); NativeArray <RaycastCommand> CommandsNativeArray_MPC3 = new NativeArray <RaycastCommand>(MPC3_num * (MPC3_num - 1), Allocator.TempJob); NativeArray <RaycastHit> ResultsNativeArray_MPC3 = new NativeArray <RaycastHit>(MPC3_num * (MPC3_num - 1), Allocator.TempJob); NativeArray <Vector2Int> MPC3_ID = new NativeArray <Vector2Int>(MPC3_num * (MPC3_num - 1), Allocator.TempJob); // Start: calculation of the first level of path3 #region Paralle Raycasting MPC3 ParallelRayCastingDataV6 RayCastingData_MPC3 = new ParallelRayCastingDataV6 { MPC_Array = MPC3_Native, commands = CommandsNativeArray_MPC3, ID = MPC3_ID, }; JobHandle jobHandle_RayCastingData_MPC3 = RayCastingData_MPC3.Schedule(MPC3_num * (MPC3_num - 1), 1); jobHandle_RayCastingData_MPC3.Complete(); // parallel raycasting JobHandle rayCastJobMPC3 = RaycastCommand.ScheduleBatch(CommandsNativeArray_MPC3, ResultsNativeArray_MPC3, 64, default); rayCastJobMPC3.Complete(); #endregion #region Parallel Calculation of Path3 Parameters // parallel search of possiblte second order of paths ParallelPath2Search parallelPath3Search = new ParallelPath2Search { MPC_Array = MPC3_Native, MPC_Perpendiculars = MPC3_Side, commands = CommandsNativeArray_MPC3, results = ResultsNativeArray_MPC3, ID = MPC3_ID, maxDistance = MaxSeenDistance / 5, angleThreshold = (float)0.1, PossiblePath2 = allpath3_half, }; JobHandle jobHandlePath3Search = parallelPath3Search.Schedule(MPC3_num * (MPC3_num - 1), 64); jobHandlePath3Search.Complete(); #endregion #region Filtering Zero Valued First Floor Path3 NativeList <int> indexes3 = new NativeList <int>(Allocator.TempJob); IndexFilter indexFilter3 = new IndexFilter { Array = allpath3_half, }; JobHandle jobHandleIndexFilter3 = indexFilter3.ScheduleAppend(indexes3, allpath3_half.Length, 64); jobHandleIndexFilter3.Complete(); NativeArray <SeenPath2> LookUpTableMPC3_half = new NativeArray <SeenPath2>(indexes3.Length, Allocator.TempJob); NativeArray <Vector2Int> LUTIndexArrayMPC3 = new NativeArray <Vector2Int>(indexes3.Length, Allocator.TempJob); LookUpTableFinal lookUpTableFinalMPC3 = new LookUpTableFinal { InArray = allpath3_half, IndexArray = indexes3, OutArray = LookUpTableMPC3_half, IndxArray = LUTIndexArrayMPC3, }; JobHandle jobHandleLookUpTableMPC3 = lookUpTableFinalMPC3.Schedule(indexes3.Length, 64); jobHandleLookUpTableMPC3.Complete(); #endregion #region Testing Function for Preparing Indexes for MPC3 NativeArray <Vector2Int> MPC3LUTID = new NativeArray <Vector2Int>(MPC3_num, Allocator.TempJob); //Vector2Int[] MPC3LUTID = new Vector2Int[MPC3_num]; int progressionIndex3 = 0; for (int i = 0; i < MPC3_num; i++) { int index_min = progressionIndex3; int index_max = progressionIndex3; int flagIndex = 0; // if 1 then something is found for (int j = progressionIndex3; j < LookUpTableMPC3_half.Length; j++) { if (i == LookUpTableMPC3_half[j].MPC_IDs.x) { index_max = j; flagIndex = 1; } else { break; } } // check if the MPC can see others or not if (flagIndex == 1) { progressionIndex3 = index_max + 1; MPC3LUTID[i] = new Vector2Int(index_min, index_max); } // in the case, it sees others else { MPC3LUTID[i] = new Vector2Int(-1, -1); } // in the case it doesn't see others } #endregion // End: calculation of the first level of path3 // Start: calculation of the whole path3s #region Finding All Possible Path3 NativeArray <SeenPath3> allpath3 = new NativeArray <SeenPath3>(LookUpTableMPC3_half.Length * MPC3_num, Allocator.TempJob); ParallelPath3Search path3Search = new ParallelPath3Search { In_AttArray = MPC3_Att, InArray = LookUpTableMPC3_half, MPC_array = MPC3_Native, EdgeIndexes = MPC3LUTID, OutArray = allpath3, }; JobHandle jobHandle_path3Searc = path3Search.Schedule(LookUpTableMPC3_half.Length * MPC3_num, 64); jobHandle_path3Searc.Complete(); #endregion #region Filtering Out Inactive Path3 NativeList <int> indexes3_full = new NativeList <int>(Allocator.TempJob); IndexFilterPath3 indexFilter3_full = new IndexFilterPath3 { Array = allpath3, }; JobHandle jobHandleFilterPath3 = indexFilter3_full.ScheduleAppend(indexes3_full, allpath3.Length, 64); jobHandleFilterPath3.Complete(); LookUpTableMPC3 = new NativeArray <SeenPath3>(indexes3_full.Length, Allocator.Persistent); NativeArray <Vector3Int> LookUpTable_test = new NativeArray <Vector3Int>(indexes3_full.Length, Allocator.TempJob); LookUpTableFinalPath3 lookUpTableFinalMPC3_full = new LookUpTableFinalPath3 { InArray = allpath3, IndexArray = indexes3_full, OutArray = LookUpTableMPC3, OutVector3Int = LookUpTable_test }; JobHandle jobHandleLUTMPC3 = lookUpTableFinalMPC3_full.Schedule(indexes3_full.Length, 64); jobHandleLUTMPC3.Complete(); /* for checking how many weak paths we have * int weak_path3 = 0; * for (int i = 0; i < LookUpTableMPC3_full.Length; i++) * { * if (LookUpTableMPC3_full[i].AngularGain < 0.001) * { * weak_path3 += 1; * } * } */ #endregion #region Testing Function for Preparing Indexes for Full Path3 //Vector2Int[] MPC3SeenID = new Vector2Int[MPC3_num]; MPC3SeenID = new NativeArray <Vector2Int>(MPC3_num, Allocator.Persistent); int progressionSeenIndex = 0; for (int i = 0; i < MPC3_num; i++) { int index_min = progressionSeenIndex; int index_max = progressionSeenIndex; int flagIndex = 0; // if flagIndex = 1, then something is found for (int j = progressionSeenIndex; j < LookUpTableMPC3.Length; j++) { if (i == LookUpTableMPC3[j].MPC_IDs.x) { index_max = j; flagIndex = 1; } else { break; } } // check if the MPC can see others or not if (flagIndex == 1) { progressionSeenIndex = index_max + 1; MPC3SeenID[i] = new Vector2Int(index_min, index_max); if (index_max - index_min + 1 > maxlengthMPC3) { maxlengthMPC3 = index_max - index_min + 1; } } // in the case, it sees others else { MPC3SeenID[i] = new Vector2Int(-1, -1); } // in the case it doesn't see others } #endregion #region drawing MPC3 connections /* * //for (int i = 0; i < LookUpTableMPC3.Length; i++) * for (int i = 0; i < 100; i++) * { * int first_MPC = LookUpTableMPC3[i].MPC_IDs.x; * int second_MPC = LookUpTableMPC3[i].MPC_IDs.y; * int third_MPC = LookUpTableMPC3[i].MPC_IDs.z; * * Debug.DrawLine(MPC3_Native[first_MPC].Coordinates, MPC3_Native[second_MPC].Coordinates, Color.yellow, 1.0f); * Debug.DrawLine(MPC3_Native[second_MPC].Coordinates + new Vector3(0,1,0), MPC3_Native[third_MPC].Coordinates + new Vector3(0, 1, 0), Color.red, 1.0f); * }*/ #endregion // End: calculation of the whole path3s #region Disposing MPC3 NativeArrays LUTIndexArrayMPC3.Dispose(); LookUpTableMPC3_half.Dispose(); indexes3.Dispose(); MPC3_ID.Dispose(); CommandsNativeArray_MPC3.Dispose(); ResultsNativeArray_MPC3.Dispose(); allpath3_half.Dispose(); allpath3.Dispose(); MPC3LUTID.Dispose(); indexes3_full.Dispose(); LookUpTable_test.Dispose(); #endregion #endregion }