protected decimal?TryParseNullableDecimal(Cell cell, IXlsxImportResult xlsxImportResult) { if (string.IsNullOrEmpty(cell.Value)) { return(null); } return(TryParseDecimal(cell, xlsxImportResult)); }
protected TEnum TryParseEnum <TEnum>(Cell cell, IXlsxImportResult xlsxImportResult) where TEnum : struct { if (!LocalizationService.IsEnumExistsForLocalisedText <TEnum>(cell.Value)) { xlsxImportResult.ErrorList.Add(string.Format(LocalizationService.GetLocalizedError(ValidationError.WrongDataFormat), cell.Id)); return(default(TEnum)); } return(LocalizationService.GetEnumFromLocalizedText <TEnum>(cell.Value)); }
protected DateTime TryParseDateTime(Cell cell, IXlsxImportResult xlsxImportResult) { DateTime result; if (!DateTime.TryParse(cell.Value, out result)) { xlsxImportResult.ErrorList.Add(string.Format(LocalizationService.GetLocalizedError(ValidationError.WrongDataFormat), cell.Id)); } return(result); }
protected Guid TryGetBelastungskategorie(Cell cell, IXlsxImportResult xlsxImportResult) { var belastungskategorie = belastungskategorieService .AllBelastungskategorieModel .SingleOrDefault(bkm => LocalizationService.GetLocalizedBelastungskategorieTyp(bkm.Typ) == cell.Value); if (belastungskategorie == null) { xlsxImportResult.ErrorList.Add(string.Format(LocalizationService.GetLocalizedError(ValidationError.WrongDataFormat), cell.Id)); return(Guid.Empty); } return(belastungskategorie.Id); }
protected int?TryParseNullableInt(Cell cell, IXlsxImportResult xlsxImportResult) { if (string.IsNullOrEmpty(cell.Value)) { return(null); } int result; if (!int.TryParse(cell.Value, out result)) { xlsxImportResult.ErrorList.Add(string.Format(LocalizationService.GetLocalizedError(ValidationError.WrongDataFormat), cell.Id)); } return(result); }
protected Guid?TryGetMassnahmenvorschlagKatalog(Cell cell, MassnahmenvorschlagKatalogTyp massnahmenvorschlagKatalogTyp, string belastungskategorieTyp, IXlsxImportResult xlsxImportResult) { if (string.IsNullOrEmpty(cell.Value)) { return(null); } var massnahmenvorschlagKatalogModel = massnahmenvorschlagKatalogService .GetMassnahmenvorschlagKatalogModelList(massnahmenvorschlagKatalogTyp, belastungskategorieTyp) .SingleOrDefault(mkm => mkm.TypBezeichnung == cell.Value); if (massnahmenvorschlagKatalogModel == null) { xlsxImportResult.ErrorList.Add(string.Format(LocalizationService.GetLocalizedError(ValidationError.WrongDataFormat), cell.Id)); return(Guid.Empty); } return(massnahmenvorschlagKatalogModel.Id); }