public DataGrid() { Columns = new DataGridColumns(); Columns.ItemsInserted += OnColumnsInserted; Rows = new DataGridRows(); Rows.ItemsInserted += OnRowsInserted; }
private void SetDataGrid() { try { if (xDocument == null) { return; } var articles = Business.GetAccountingArticleBusiness().GetByAccountingDcoumentId(xDocument.Id); var dataGridRows = new List <DataGridRows>(); foreach (var item in articles) { var tafsils = Business.GetAccountingTafsilArticleBusiness().GetByAccountingArticleId(item.ID).ToList(); var moein = Business.GetMoeinStructureDefineBusiness().GetByID(tafsils.First().IDAccountingMoein.Value); var dataGridRow = new DataGridRows() { Count = item.ACount.ToInt().ToString(), Creditor = item.ACreditor.ToDecimal().ToString(Localize.DoubleMaskType), Debtor = item.ADebtor.ToDecimal().ToString(Localize.DoubleMaskType), Description = item.ADescription, Id = item.ID }; //TO DO: ali younesi enable this section foreach (var labelItem in FrmBLablels) { dataGridRow.CodehaieHesabdari += labelItem.value; } //foreach (var tafsilLevelDetail in tafsilLevelDetails) //{ // dataGridRow.CodehaieHesabdari = string.Format("{0}, {1}", dataGridRow.CodehaieHesabdari, tafsilLevelDetail.ATLName); //} dataGridRows.Add(dataGridRow); } DataGridTest.ItemsSource = dataGridRows; } catch { throw; } }
private void SetDataGrid() { try { if (Document == null) { return; } var articles = Business.GetAccountingArticleBusiness().GetByAccountingDcoumentId(Document.Id); var dataGridRows = new List <DataGridRows>(); foreach (var item in articles) { var tafsils = Business.GetAccountingTafsilArticleBusiness().GetByAccountingArticleId(item.ID).ToList(); var moein = Business.GetAccountingMoeinBusiness().GetById(tafsils.First().IDAccountingMoein.Value); var tafsilLevelDetails = Business.GetAccountingTafsilLevelDetailBusiness().GetByIds(tafsils.Where(r => r.IdAccountingTafsilLDetails.HasValue) .Select(r => r.IdAccountingTafsilLDetails.Value).ToList()).ToList(); var dataGridRow = new DataGridRows() { Count = item.ACount.ToInt().ToString(), Creditor = item.ACreditor.ToDecimal().ToString(Localize.DoubleMaskType), Debtor = item.ADebtor.ToDecimal().ToString(Localize.DoubleMaskType), Description = item.ADescription, Id = item.ID }; dataGridRow.CodehaieHesabdari = string.Format("{0},{1},{2}", moein.MIdGroup, moein.MIdAll, moein.MName); foreach (var tafsilLevelDetail in tafsilLevelDetails) { dataGridRow.CodehaieHesabdari = string.Format("{0}, {1}", dataGridRow.CodehaieHesabdari, tafsilLevelDetail.ATLName); } dataGridRows.Add(dataGridRow); } DataGridTest.ItemsSource = dataGridRows; } catch { throw; } }