public IDictionary <string, IList <string> > GetSelectedData(IList <GridViewRowInfo> selectedRows) { var dictionaryData = new Dictionary <string, IList <string> >(); if (selectedRows == null || selectedRows.Count == 0) { return(null); } foreach (var row in selectedRows) { foreach (GridViewCellInfo cell in row.Cells) { if (!cell.ColumnInfo.IsVisible) { continue; } string cellValue; if (cell.Value != null) { if (cell.Value is bool) { cellValue = _translateService.BooleanToString((bool)cell.Value); } else { cellValue = cell.Value.ToString(); } } else { cellValue = ""; } if (!dictionaryData.ContainsKey(cell.ColumnInfo.HeaderText)) { var values = new List <string>(); values.Add(cellValue); dictionaryData.Add(cell.ColumnInfo.HeaderText, values); } else { var values = dictionaryData[cell.ColumnInfo.HeaderText]; values.Add(cellValue); dictionaryData[cell.ColumnInfo.HeaderText] = values; } } } return(dictionaryData); }
public async Task <string> GetOrphanSummary(int Oid) { var orp = _SourceOrphans.FirstOrDefault(o => o.Id == Oid); if (orp == null) { return(string.Empty); } var brothersTask = _apiClient.Orphans_GetBrothersAsync(Oid); Task <OrphanageDataModel.FinancialData.Bail> bailTask = null; Task <OrphanageDataModel.FinancialData.Bail> FamilyBailTask = null; if (orp.IsBailed) { bailTask = _apiClient.Bails_GetAsync(orp.BailId.Value); } if (orp.Family.IsBailed) { FamilyBailTask = _apiClient.Bails_GetAsync(orp.Family.BailId.Value); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(Properties.Resources.FatherName + ": " + orp.Family.Father.Name.FullName()); stringBuilder.AppendLine(Properties.Resources.FatherDeathDate + ": " + _dataFormatterService.GetFormattedDate(orp.Family.Father.DateOfDeath)); stringBuilder.AppendLine(Properties.Resources.MotherFirstName + ": " + orp.Family.Mother.Name.FullName()); stringBuilder.AppendLine(Properties.Resources.MotherIsDead + ": " + _translateService.BooleanToString(orp.Family.Mother.IsDead)); if (orp.Family.Mother.IsDead && orp.Family.Mother.DateOfDeath.HasValue) { stringBuilder.AppendLine(Properties.Resources.MotherDeathDate + ": " + _dataFormatterService.GetFormattedDate(orp.Family.Mother.DateOfDeath.Value)); } stringBuilder.AppendLine(Properties.Resources.MotherIsMarried + ": " + _translateService.BooleanToString(orp.Family.Mother.IsMarried)); if (orp.Family.Mother.IsMarried && orp.Family.Mother.HusbandName != null && orp.Family.Mother.HusbandName.Length > 0) { stringBuilder.AppendLine(Properties.Resources.MotherHusbandName + ": " + orp.Family.Mother.HusbandName); } if (orp.Age.HasValue) { stringBuilder.AppendLine(Properties.Resources.Age + ": " + _translateService.DateToString(orp.Birthday)); } var brothers = await brothersTask; if (brothers != null) { int boys = brothers.Count(o => _translateService.IsBoy(o.Gender)); int girls = brothers.Count(o => !_translateService.IsBoy(o.Gender)); stringBuilder.AppendLine(Properties.Resources.BrothersCountString + ": " + boys + " " + Properties.Resources.MalesString + ", " + girls + " " + Properties.Resources.FemalesString); } else { stringBuilder.AppendLine(Properties.Resources.BrothersCountString + ": 0 " + Properties.Resources.MalesString + ", 0 " + Properties.Resources.FemalesString); } if (bailTask != null || FamilyBailTask != null) { stringBuilder.AppendLine(Properties.Resources.IsBailed + ": " + Properties.Resources.BooleanTrue); OrphanageDataModel.FinancialData.Bail orpBail = null; if (bailTask != null) { orpBail = await bailTask; } if (FamilyBailTask != null) { orpBail = await FamilyBailTask; } if (orpBail != null) { stringBuilder.AppendLine(Properties.Resources.GuarantorName + ": " + orpBail?.Guarantor?.Name.FullName()); stringBuilder.AppendLine(Properties.Resources.BailIsFamily + ": " + _translateService.BooleanToString(orpBail.IsFamilyBail)); stringBuilder.AppendLine(Properties.Resources.BailAmount + ": " + orpBail.Amount.ToString() + " " + orpBail?.Account.CurrencyShortcut); stringBuilder.AppendLine(Properties.Resources.BailIsMonthly + ": " + _translateService.BooleanToString(orpBail.IsMonthlyBail)); stringBuilder.AppendLine(Properties.Resources.BailIsEnded + ": " + _translateService.BooleanToString(orpBail.IsExpired)); } } else { stringBuilder.AppendLine(Properties.Resources.IsBailed + ": " + Properties.Resources.BooleanFalse); } if (orp.EducationId.HasValue && orp.Education != null) { if (orp.Education.Stage.Contains(Properties.Resources.EducationNonStudyKeyword)) { stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanFalse); if (orp.Education.Reasons != null && orp.Education.Reasons.Length > 0) { stringBuilder.AppendLine(Properties.Resources.EducationNonStudyingReasons + ": " + orp.Education.Reasons); } } else { stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanTrue); if (orp.Education.Stage != null && orp.Education.Stage.Length > 0) { stringBuilder.AppendLine(Properties.Resources.EducationStage + ": " + orp.Education.Stage); } if (orp.Education.DegreesRate.HasValue) { stringBuilder.AppendLine(Properties.Resources.EducationAvaregeGrade + ": " + orp.Education.DegreesRate.Value + "%"); } if (orp.Education.School != null && orp.Education.School.Length > 0) { stringBuilder.AppendLine(Properties.Resources.EducationSchoolName + ": " + orp.Education.School); } } } else { stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanFalse); } if (orp.HealthId.HasValue && orp.HealthStatus != null) { stringBuilder.AppendLine(Properties.Resources.IsSick + ": " + Properties.Resources.BooleanTrue); if (orp.HealthStatus.SicknessName != null && orp.HealthStatus.SicknessName.Length > 0) { stringBuilder.AppendLine(Properties.Resources.HealthSicknessName + ": " + orp.HealthStatus.SicknessName); } if (orp.HealthStatus.Medicine != null && orp.HealthStatus.Medicine.Length > 0) { stringBuilder.AppendLine(Properties.Resources.HealthMedicen + ": " + orp.HealthStatus.Medicine); } if (orp.HealthStatus.Cost.HasValue) { stringBuilder.AppendLine(Properties.Resources.Cost + ": " + orp.HealthStatus.Cost.Value); } } else { stringBuilder.AppendLine(Properties.Resources.IsSick + ": " + Properties.Resources.BooleanFalse); } return(stringBuilder.ToString()); }