public static void Test(Controller autd) { var config = new SilencerConfig(); autd.Send(config); const double x = Controller.DeviceWidth / 2; const double y = Controller.DeviceHeight / 2; const double z = 150; var center = new Vector3d(x, y, z); var g1 = new Focus(center); var g2 = new GSPAT(); g2.Add(center + new Vector3d(30.0, 0.0, 0.0), 1.0); g2.Add(center - new Vector3d(30.0, 0.0, 0.0), 1.0); var gain = new Grouped(autd); gain.Add(0, g1); gain.Add(1, g2); var mod = new Sine(150); // AM sin 150 Hz autd.Send(mod, gain); }
private void LoadAlbums() { if (artistParam == null) { if (allAlbums.Count == 0) { allAlbums = Grouped.CreateGrouped <AlbumItem>(DatabaseManager.GetAlbumItems(), x => x.Album); } Albums = allAlbums; } else { Albums = Grouped.CreateGrouped <AlbumItem>(DatabaseManager.GetAlbumItems(artistParam), x => x.Album); } }
public async void Run() { //var watch = Stopwatch.StartNew(); //DatabaseManager.GetSongItems(); //watch.Stop(); //long t1 = watch.ElapsedMilliseconds; //watch.Restart(); //await DatabaseManager.GetSongItemsAsync(); //watch.Stop(); //long t2 = watch.ElapsedMilliseconds; //watch.Restart(); //DatabaseManager.GetSongItemsFromGenre("Unknown"); //watch.Stop(); //long t3 = watch.ElapsedMilliseconds; //watch.Restart(); //await DatabaseManager.GetSongItemsFromGenreAsync("Unknown"); //watch.Stop(); //long t4 = watch.ElapsedMilliseconds; //var w = Stopwatch.StartNew(); //DatabaseManager.ConnectionDb(); //w.Stop(); //long q1 = w.ElapsedMilliseconds; //w.Restart(); //DatabaseManager.AsyncConnectionDb(); //w.Stop(); //long q2 = w.ElapsedMilliseconds; var watch = Stopwatch.StartNew(); var a = await DatabaseManager.GetSongItemsAsync(); var b = Grouped.CreateGrouped <SongItem>(a, x => x.Title); watch.Stop(); long t1 = watch.ElapsedMilliseconds; watch.Restart(); var c = DatabaseManager.GetSongItems(); var d = Grouped.CreateGrouped <SongItem>(c, x => x.Title); watch.Stop(); long t2 = watch.ElapsedMilliseconds; }
public TransactionList( IEnumerable <Transaction> transactions, string groupBy, IEnumerable <string> tickers) { Transactions = Ordered(transactions, groupBy); Tickers = tickers; if (groupBy != null) { Grouped = Ordered(transactions, groupBy) .GroupBy(t => GroupByValue(groupBy, t)) .Select(g => new TransactionGroup( g.Key, new TransactionList(g, null, null) )); if (groupBy == "ticker") { Grouped = Grouped.OrderByDescending(a => a.Transactions.Credit - a.Transactions.Debit); } } }
public void Remove(IAreaContents areaItem) { if (areaItem is UIElement uIElement) { if (ContentsCanvas.Children.Contains(uIElement)) { ContentsCanvas.Children.Remove(uIElement); if (string.IsNullOrEmpty(areaItem.Group)) { Grouped[areaItem.Group].Remove(areaItem); if (Grouped[areaItem.Group].Count == 0) { Grouped.Remove(areaItem.Group); } } if (areaItem.Select) { AreaItemSelectOperator.Remove(areaItem); Selected.Remove(areaItem); } } } }
public void SetSelect(IAreaContents areaItem, bool value) { if (!string.IsNullOrEmpty(areaItem.Group)) { Debug.Assert(Grouped.ContainsKey(areaItem.Group)); Grouped[areaItem.Group].ForEach(item => { if (item.Select != value) { item.Select = value; } if (value) { Selected.Add(item); AreaItemSelectOperator.Add(item); } else { AreaItemSelectOperator.Remove(item); Selected.Remove(item); } }); } else { if (value) { Selected.Add(areaItem); AreaItemSelectOperator.Add(areaItem); } else { AreaItemSelectOperator.Remove(areaItem); Selected.Remove(areaItem); } } }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = sender as Button; DataTable dt = new DataTable(); IList <TLCSV_PuchaseOrderDetail> PODetail = new List <TLCSV_PuchaseOrderDetail>(); IList <TLCSV_StockOnHand> SOHDetail = new List <TLCSV_StockOnHand>(); List <DATA> SOHGrouped = new List <DATA>(); BindingSource bindingSource1 = new BindingSource(); if (oBtn != null && formloaded) { if (UserD._External) { if (QueryParms.Customers.Count == 0) { MessageBox.Show("Please select a customer from the drop down list"); return; } if (QueryParms.Whses.Count == 0) { MessageBox.Show("Please select a warehouse fro the drop down list"); return; } } using (var context = new TTI2Entities()) { DGVOutput.DataSource = null; DGVOutput.Rows.Clear(); if (rbAvailable.Checked || rbGrossStock.Checked) { //============================================================ // Can be either Gross Stock or Available stock data needed // Start with Gross Stock always //------------------------------------------------------- SOHDetail = repo.GrossSOHQuery(QueryParms).ToList(); if (rbAvailable.Checked) { // Available Stock only //---------------------------------------------------------- SOHDetail = SOHDetail.Where(x => !x.TLSOH_Picked).ToList(); } if (SOHDetail.Count == 0) { DGVOutput.Visible = false; MessageBox.Show("No records found for selection made"); return; } var GroupedData = SOHDetail.GroupBy(x => new { x.TLSOH_Style_FK, x.TLSOH_Colour_FK, x.TLSOH_Size_FK }).ToList(); foreach (var Grouped in GroupedData) { var Sty = Grouped.FirstOrDefault().TLSOH_Style_FK; var Clr = Grouped.FirstOrDefault().TLSOH_Colour_FK; var xSize = Grouped.FirstOrDefault().TLSOH_Size_FK; var BoxQty = Grouped.Sum(x => (int?)x.TLSOH_BoxedQty ?? 0); var Record = SOHGrouped.Find(x => x._StyleFK == Sty && x._ColourFK == Clr && x._SizeFK == xSize); var index = SOHGrouped.IndexOf(Record); if (index < 0) { DATA dd = new DATA(); dd._BoxedQty = BoxQty; dd._ColourFK = Clr; dd._SizeFK = xSize; dd._StyleFK = Sty; SOHGrouped.Add(dd); } else { Record._BoxedQty += BoxQty; } } //now ready to display //------------------------------------------------- dt = new DataTable(); DataColumn column; // Create column 1 //---------------------------------------------- column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Style"; dt.Columns.Add(column); // Create column 2 //---------------------------------------------- column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Colour"; dt.Columns.Add(column); // Add the size names to the top of the grid box //------------------------------------------------------- foreach (var soh in SOHGrouped) { var xSize = context.TLADM_Sizes.Find(soh._SizeFK).SI_Description; if (!dt.Columns.Contains(xSize)) { dt.Columns.Add(xSize, typeof(Int32)); } else { continue; } } foreach (var soh in SOHGrouped) { var xStyle = context.TLADM_Styles.Find(soh._StyleFK).Sty_Description; var xColour = context.TLADM_Colours.Find(soh._ColourFK).Col_Display; var xSize = context.TLADM_Sizes.Find(soh._SizeFK).SI_Description; var index = dt.Columns.IndexOf(xSize); var SingleRow = (from Rows in dt.Rows.Cast <DataRow>() where Rows.Field <String>(0) == xStyle && Rows.Field <String>(1) == xColour select Rows).FirstOrDefault(); if (SingleRow != null) { SingleRow[index] = soh._BoxedQty; } else { var TheNewRow = dt.NewRow(); TheNewRow[0] = xStyle; TheNewRow[1] = xColour; TheNewRow[index] = soh._BoxedQty; dt.Rows.Add(TheNewRow); } } DataView DataV = dt.DefaultView; DataV.Sort = dt.Columns[0].ColumnName + "," + dt.Columns[1].ColumnName; DGVOutput.DataSource = DataV.ToTable(); DGVOutput.Visible = true; } else { //======================================================================= // this section of the code does the outstanding purchase orders //===================================================================== var Data = repo.POQuery(QueryParms); if (Data.Count() == 0) { DGVOutput.Visible = false; MessageBox.Show("No records found for selection made"); return; } var GroupedData = Data.GroupBy(x => new { x.TLCUSTO_Style_FK, x.TLCUSTO_Colour_FK, x.TLCUSTO_Size_FK }).ToList(); foreach (var Grouped in GroupedData) { var Sty = Grouped.FirstOrDefault().TLCUSTO_Style_FK; var Clr = Grouped.FirstOrDefault().TLCUSTO_Colour_FK; var xSize = Grouped.FirstOrDefault().TLCUSTO_Size_FK; var BoxQty = Grouped.Sum(x => (int?)x.TLCUSTO_Qty ?? 0); var Record = SOHGrouped.Find(x => x._StyleFK == Sty && x._ColourFK == Clr && x._SizeFK == xSize); var index = SOHGrouped.IndexOf(Record); if (index < 0) { DATA dd = new DATA(); dd._BoxedQty = BoxQty; dd._ColourFK = Clr; dd._SizeFK = xSize; dd._StyleFK = Sty; SOHGrouped.Add(dd); } else { Record._BoxedQty += BoxQty; } } //now ready to display //------------------------------------------------- dt = new DataTable(); DataColumn column; // Create column 1 //---------------------------------------------- column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Style"; dt.Columns.Add(column); // Create column 2 //---------------------------------------------- column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "Colour"; dt.Columns.Add(column); // Add the size names to the top of the grid box //------------------------------------------------------- foreach (var soh in SOHGrouped) { var xSize = context.TLADM_Sizes.Find(soh._SizeFK).SI_Description; if (!dt.Columns.Contains(xSize)) { dt.Columns.Add(xSize, typeof(Int32)); } else { continue; } } foreach (var soh in SOHGrouped) { var xStyle = context.TLADM_Styles.Find(soh._StyleFK).Sty_Description; var xColour = context.TLADM_Colours.Find(soh._ColourFK).Col_Display; var xSize = context.TLADM_Sizes.Find(soh._SizeFK).SI_Description; var index = dt.Columns.IndexOf(xSize); var SingleRow = (from Rows in dt.Rows.Cast <DataRow>() where Rows.Field <String>(0) == xStyle && Rows.Field <String>(1) == xColour select Rows).FirstOrDefault(); if (SingleRow != null) { SingleRow[index] = soh._BoxedQty; } else { var TheNewRow = dt.NewRow(); TheNewRow[0] = xStyle; TheNewRow[1] = xColour; TheNewRow[index] = soh._BoxedQty; dt.Rows.Add(TheNewRow); } } DataView DataV = dt.DefaultView; DataV.Sort = dt.Columns[0].ColumnName + "," + dt.Columns[1].ColumnName; DGVOutput.DataSource = DataV.ToTable(); DGVOutput.Visible = true; } } } }
private IKGroupedTable <K1, V1> DoGroup <K1, V1>(IKeyValueMapper <K, V, KeyValuePair <K1, V1> > keySelector, Grouped <K1, V1> grouped) { var selectName = new Named(grouped.Named).OrElseGenerateWithPrefix(this.builder, SELECT_NAME); IKTableProcessorSupplier <K, V, KeyValuePair <K1, V1> > selectSupplier = new KTableRepartitionMap <K, V, K1, V1>(this, keySelector); var processorParameters = new TableProcessorParameters <K, V>(selectSupplier, selectName); // select the aggregate key and values (old and new), it would require parent to send old values var groupByMapNode = new TableProcessorNode <K, V, K1, V1>( selectName, processorParameters, null ); builder.AddGraphNode(this.node, groupByMapNode); this.EnableSendingOldValues(); return(new KGroupedTable <K1, V1>( selectName, grouped, this.setSourceNodes, groupByMapNode, builder)); }
private async void LoadArtists() { var a = await DatabaseManager.GetArtistItemsAsync(); Artists = Grouped.CreateGrouped <ArtistItem>(a, x => x.Artist); }
public IKGroupedTable <KR, VR> GroupBy <KR, VR>(IKeyValueMapper <K, V, KeyValuePair <KR, VR> > keySelector, string named = null) => DoGroup(keySelector, Grouped <KR, VR> .Create(named, null, null));
private void FilterGroupsBySearch() { Grouped.Clear(); GroupedFriendModel csg = new GroupedFriendModel() { LongName = "Your Contacts", ShortName = "C" }; GroupedFriendModel pg = new GroupedFriendModel() { LongName = "Pending Friend Requests", ShortName = "P" }; GroupedFriendModel mg = new GroupedFriendModel() { LongName = "Mutual Friends", ShortName = "M" }; GroupedFriendModel ig = new GroupedFriendModel() { LongName = "Waiting for Response", ShortName = "W" }; if (String.IsNullOrEmpty(SearchEntry)) { if (_includeImportedContacts) { foreach (var mv in ContactSearchRequestFriends.OrderBy(m => m.FirstAndLastName)) { csg.Add(mv); } } foreach (var pv in PendingFriends.OrderBy(m => m.FirstAndLastName)) { pg.Add(pv); } foreach (var mv in MutualFriends.OrderBy(m => m.FirstAndLastName)) { mg.Add(mv); } foreach (var iv in InitiatedRequestFriends.OrderBy(m => m.FirstAndLastName)) { ig.Add(iv); } } else { if (_includeImportedContacts) { foreach (var mv in ContactSearchRequestFriends .Where(p => p.UserName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.FirstName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.LastName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.PhoneNumber .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase)) .OrderBy(m => m.FirstAndLastName)) { csg.Add(mv); } } foreach (var pv in PendingFriends .Where(p => p.UserName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.FirstName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.LastName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.PhoneNumber .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase)) .OrderBy(m => m.FirstAndLastName)) { pg.Add(pv); } foreach (var mv in MutualFriends .Where(p => p.UserName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.FirstName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.LastName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.PhoneNumber .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase)) .OrderBy(m => m.FirstAndLastName)) { mg.Add(mv); } foreach (var iv in InitiatedRequestFriends .Where(p => p.UserName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.FirstName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.LastName .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase) || p.PhoneNumber .StartsWith(SearchEntry, StringComparison.OrdinalIgnoreCase)) .OrderBy(m => m.FirstAndLastName)) { ig.Add(iv); } } if (_includeImportedContacts) { Grouped.Add(csg); } Grouped.Add(pg); Grouped.Add(mg); Grouped.Add(ig); }
private async Task SortDataAsync() { _userSelf = await _requestService.GetAsync <UserInfoContract>("api/UserInfoSelf"); ContactSearchRequestFriends.Clear(); MutualFriends.Clear(); PendingFriends.Clear(); InitiatedRequestFriends.Clear(); var entire = await _friendRequestService.GetAllFriendRequestsAsync(); var initiated = entire.Where(f => f.InitiatorId.Equals(_userSelf.Id) && !f.TargetId.Equals(_userSelf.Id)).ToList(); var targeted = entire.Where(f => f.TargetId.Equals(_userSelf.Id) && !f.InitiatorId.Equals(_userSelf.Id)).ToList(); // first scan through inbound requests, // if there is also an initiated request, becomes mutual, // otherwise, it is a pending request foreach (var req in targeted) { var initiatorInfo = await _userInfoService.GetUserInfoAsync(req.InitiatorId); if (initiated.Any(f => f.TargetId.Equals(req.InitiatorId))) { MutualFriends.Add(new FriendViewCellModel(initiatorInfo, req.TimeStamp, req.Type ?? FriendRequestType.Normal, FriendStatus.Mutual)); } else { PendingFriends.Add(new FriendViewCellModel(initiatorInfo, req.TimeStamp, req.Type ?? FriendRequestType.Normal, FriendStatus.PendingRequest)); } } // scan through the initiated requests, // ignoring requests that have a matching target record, // these should have already been placed into mutual foreach (var req in initiated) { if (!targeted.Any(f => f.InitiatorId.Equals(req.TargetId))) { var targetInfo = await _userInfoService.GetUserInfoAsync(req.TargetId); InitiatedRequestFriends.Add(new FriendViewCellModel(targetInfo, req.TimeStamp, req.Type ?? FriendRequestType.Normal, FriendStatus.Initiated)); } } Grouped.Clear(); GroupedFriendModel csg = new GroupedFriendModel() { LongName = "Your Contacts", ShortName = "C" }; if (_includeImportedContacts) { foreach (var mv in ContactSearchRequestFriends.OrderBy(m => m.FirstAndLastName)) { csg.Add(mv); } } GroupedFriendModel pg = new GroupedFriendModel() { LongName = "Pending Friend Requests", ShortName = "P" }; foreach (var pv in PendingFriends.OrderBy(m => m.FirstAndLastName)) { pg.Add(pv); } GroupedFriendModel mg = new GroupedFriendModel() { LongName = "Mutual Friends", ShortName = "M" }; foreach (var mv in MutualFriends.OrderBy(m => m.FirstAndLastName)) { mg.Add(mv); } GroupedFriendModel ig = new GroupedFriendModel() { LongName = "Waiting for Response", ShortName = "W" }; foreach (var iv in InitiatedRequestFriends.OrderBy(m => m.FirstAndLastName)) { ig.Add(iv); } if (_includeImportedContacts) { Grouped.Add(csg); } Grouped.Add(pg); Grouped.Add(mg); Grouped.Add(ig); }
private void cmboCMTLine_SelectedIndexChanged(object sender, EventArgs e) { ComboBox oCmbo = sender as ComboBox; if (oCmbo != null && formloaded) { var selected = (int)oCmbo.SelectedValue; if (selected != 0) { formloaded = false; dataGridView1.Rows.Clear(); dataGridView2.Rows.Clear(); formloaded = true; txtDifference.Text = "0"; txtTotAGrade.Text = "0"; txtTotBGrade.Text = "0"; txtTPIssued.Text = "0"; txtTPPanels.Text = "0"; txtNoBoxes.Text = "0"; using (var context = new TTI2Entities()) { var LI = context.TLCMT_LineIssue.Find(selected); if (LI != null) { CS = context.TLCUT_CutSheet.Find(LI.TLCMTLI_CutSheet_FK); if (CS != null) { CSR = context.TLCUT_CutSheetReceipt.Where(x => x.TLCUTSHR_CutSheet_FK == CS.TLCutSH_Pk).FirstOrDefault(); if (CSR == null) { MessageBox.Show("Technical error encounted. Qoute number 1400"); frmCompleted_Load(this, null); return; } //------------------------------------------------------- //We have to check that all the BFA Data has been recorded //-------------------------------------------------------------------- int BFACount = context.TLCMT_AuditMeasureRecorded.Where(x => x.TLBFAR_CutSheet_FK == CS.TLCutSH_Pk).Count(); if (BFACount == 0) { MessageBox.Show("Please enter the BFA Audit information" + Environment.NewLine + "using the facility provided"); frmCompleted_Load(this, null); return; } //------------------------------------------------------ // We have to now //========================================= var ExpectUnits = context.TLCUT_ExpectedUnits.Where(x => x.TLCUTE_CutSheet_FK == CS.TLCutSH_Pk).ToList(); foreach (var Unit in ExpectUnits) { TLADM_Sizes Size = new TLADM_Sizes(); Size.SI_Description = context.TLADM_Sizes.Find(Unit.TLCUTE_Size_FK).SI_Description; Size.SI_id = Unit.TLCUTE_Size_FK; oCmboA.Items.Add(Size); } //--------------------------------------------------------------- //If expected units data not available, for what ever reason, go back to the original order //========================================================================== if (oCmboA.Items.Count == 0) { var CutSheetDetail = context.TLCUT_CutSheetReceiptDetail.Where(x => x.TLCUTSHRD_CutSheet_FK == CSR.TLCUTSHR_Pk).GroupBy(x => x.TLCUTSHRD_Size_FK); foreach (var Grouped in CutSheetDetail) { var Size_Pk = Grouped.FirstOrDefault().TLCUTSHRD_Size_FK; TLADM_Sizes Size = new TLADM_Sizes(); Size.SI_Description = context.TLADM_Sizes.Find(Size_Pk).SI_Description; Size.SI_id = Size_Pk; oCmboA.Items.Add(Size); } } oCmboA.DisplayMember = "SI_Description"; oCmboA.ValueMember = "SI_Id"; txtCutSheet.Text = CS.TLCutSH_No; var DB = context.TLDYE_DyeBatch.Find(CS.TLCutSH_DyeBatch_FK); if (DB != null) { var DO = context.TLDYE_DyeOrder.Find(DB.DYEB_DyeOrder_FK); if (DO != null) { var dt = core.FirstDateOfWeek(DO.TLDYO_OrderDate.Year, DO.TLDYO_CMTReqWeek); txtDateRequired.Text = dt.AddDays(5).ToString("dd/MM/yyyy"); } } Styles = context.TLADM_Styles.Find(CS.TLCutSH_Styles_FK); Colours = context.TLADM_Colours.Find(CS.TLCutSH_Colour_FK); StyleGrades = context.TLADM_StylesGrades.Where(x => x.TLSG_Style_Fk == CS.TLCutSH_Styles_FK).FirstOrDefault(); var Existing = context.TLCUT_CutSheetReceiptDetail.Where(x => x.TLCUTSHRD_CutSheet_FK == CSR.TLCUTSHR_Pk).ToList(); /* if (Existing != null) * { * Sizes = context.TLADM_Sizes.Find(Existing.FirstOrDefault().TLCUTSHRD_Size_FK); * }*/ foreach (var row in Existing) { var index = dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Cells[0].Value = row.TLCUTSHRD_BoxNumber; this.dataGridView1.Rows[index].Cells[1].Value = Styles.Sty_Description; this.dataGridView1.Rows[index].Cells[2].Value = Colours.Col_Display; this.dataGridView1.Rows[index].Cells[3].Value = row.TLCUTSHRD_BoxUnits; } txtTPIssued.Text = Existing.Sum(x => x.TLCUTSHRD_BoxUnits).ToString(); // 0 Box No datagridView2 // 1 Code datagridView2 // 2 Size datagridView2 // 3 Grade datagridView2 // 4 Qty datagridView2 // 5 Weight dataGridView2 // 6 FK CutSheetSheet Receipt Detail datagridView2 formloaded = false; foreach (var row in Existing) { var index = dataGridView2.Rows.Add(); this.dataGridView2.Rows[index].Cells[0].Value = row.TLCUTSHRD_BoxNumber; this.dataGridView2.Rows[index].Cells[1].Value = string.Empty; this.dataGridView2.Rows[index].Cells[2].Value = null; // string.Empty; this.dataGridView2.Rows[index].Cells[3].Value = string.Empty; this.dataGridView2.Rows[index].Cells[4].Value = 0; this.dataGridView2.Rows[index].Cells[5].Value = 0.00M; this.dataGridView2.Rows[index].Cells[6].Value = row.TLCUTSHRD_Pk; } formloaded = true; if (this.dataGridView2.Rows.Count != 0) { this.dataGridView2.CurrentCell = this.dataGridView2.Rows[0].Cells[1]; this.dataGridView2.BeginEdit(true); } } } } } } }
/// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ #region Private functions /// <summary> /// Load Request list view /// </summary> private void Load_Case() { try { _cellHeight = 0; _recordIndex = 0; int reqindcheck = 0; _index = new List <Tuple <int, int, int> >(); _lstReqIndex = new List <int>(); PropertyMapping temp = PropertyMappingFromIndex(_initialSectionIndex); //To get the property mapping for (int i = 1; i < temp.ActiveExpanded.Count; i++) { _propertyIndex = temp.ActiveExpanded[1].Property; var requestGroup = temp.ActiveExpanded[i].RequestGroup; if (requestGroup != null) { _requestIndex = requestGroup.Value; } if (temp.ActiveExpanded[i].Record != null) { _recordIndex = temp.ActiveExpanded[i].Record.Value; if (!_lstReqIndex.Contains(_requestIndex)) { _lstReqIndex.Add(_requestIndex); //Request Group index list } _index.Add(Tuple.Create(temp.ActiveExpanded[i].Property, _requestIndex, _recordIndex)); //To get the index mapping of request group } } foreach (var record in LstRequestGroup) { int recordHeight = 0; int reqGrpIndex = _lstReqIndex[reqindcheck]; SriRequestGrp = new GroupedRequestGroupModel() { GroupName = record.Name }; if (record.Records.Count > 0) { //filter mode is ALL if (AppData.PropertyModel.Filter == FilterMode.All || AppData.PropertyModel.Filter == FilterMode.Complete || AppData.PropertyModel.Filter == FilterMode.Incomplete) { List <int> lstRecIndex = new List <int>(); foreach (Tuple <int, int, int> tupleindex in _index) { if (tupleindex.Item1 == _propertyIndex && tupleindex.Item2 == reqGrpIndex) { lstRecIndex.Add(tupleindex.Item3);//Records index list } } for (int i = 0; i < (record.Records.Count > 1 ? record.TempRecords.Count : record.Records.Count); i++) { SriRequestGrp.Add(new SRiRequestGroupModel() { GroupDetails = record.Records.Count > 1 ? record.TempRecords[i].Record.Details : record.Records[i].Record.Details ?? "No details given", TargetResponseDate = record.Records.Count > 1 ? record.TempRecords[i].Record.TargetResponseDate.ToDateString() : record.Records[i].Record.TargetResponseDate.ToDateString(), ShortIndex = new ShortIndexMapping(_initialSectionIndex, reqGrpIndex, lstRecIndex[i], _propertyIndex), GrayLine = (record.Records.Count > 1 ? record.TempRecords.Count - 1 : record.Records.Count - 1) != i, // To set the gray line between records of same groupname, UploadStatusImage = GetSyncStatus(record.Records.Count > 1 ? record.TempRecords[i].Record.Status : record.Records[i].Record.Status) }); recordHeight++; } _cellHeight++; Grouped.Add(SriRequestGrp); } #region future check //fileter mode is Complete else if (AppData.PropertyModel.Filter == FilterMode.Complete) { List <int> recIndex = new List <int>(); for (int s = 0; s < _index.Count; s++) { if (_index[s].Item1 == _propertyIndex && _index[s].Item2 == reqGrpIndex) { recIndex.Add(_index[s].Item3); } } for (int i = 0; i < record.Records.Count; i++) { SriRequestGrp.Add(new SRiRequestGroupModel() { GroupDetails = record.Records[i].Record.Details ?? "No details given", TargetResponseDate = record.Records[i].Record.TargetResponseDate.ToDateString(), ShortIndex = new ShortIndexMapping(_initialSectionIndex, reqGrpIndex, recIndex[i], _propertyIndex), GrayLine = (record.Records.Count - 1) != i // To set the gray line between records of same groupname }); } _cellHeight++; Grouped.Add(SriRequestGrp); } //fileter mode is Incomplete else { List <int> recIndex = new List <int>(); for (int s = 0; s < _index.Count; s++) { if (_index[s].Item1 == _propertyIndex && _index[s].Item2 == reqGrpIndex) { recIndex.Add(_index[s].Item3); } } for (int i = 0; i < record.Records.Count; i++) { SriRequestGrp.Add(new SRiRequestGroupModel() { GroupDetails = record.Records[i].Record.Details ?? "No details given", TargetResponseDate = record.Records[i].Record.TargetResponseDate.ToDateString(), ShortIndex = new ShortIndexMapping(_initialSectionIndex, reqGrpIndex, recIndex[i], _propertyIndex), GrayLine = (record.Records.Count - 1) != i // To set the gray line between records of same groupname }); } _cellHeight++; Grouped.Add(SriRequestGrp); } #endregion var height = recordHeight == 2 ? recordHeight * Device.OnPlatform <double>(38, 38, 36) : 0; HeightRequest = (_cellHeight * Device.OnPlatform <double>(108, 108, 124)) + height; //To Fix the height of listgroup } reqindcheck++; } GC.Collect(); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
public IKGroupedTable <KR, VR> GroupBy <KR, VR, KRS, VRS>(IKeyValueMapper <K, V, KeyValuePair <KR, VR> > keySelector, string named = null) where KRS : ISerDes <KR>, new() where VRS : ISerDes <VR>, new() => DoGroup(keySelector, Grouped <KR, VR> .Create <KRS, VRS>(named));
private async Task LoadSongs() { var a = await DatabaseManager.GetSongItemsAsync(); Songs = Grouped.CreateGrouped <SongItem>(a, x => x.Title); }
public KGroupedTable(string name, Grouped <K, V> grouped, List <string> sourceNodes, StreamGraphNode streamsGraphNode, InternalStreamBuilder builder) : base(name, grouped.Key, grouped.Value, sourceNodes, streamsGraphNode, builder) { }