public void CreateNewDateRangeRow(int gsftObjDtlId, ScopeArchivGeschaeftsObjektKlasse gsftObjKls, ScopeArchivDatenElementId elementId,
                                          ScopeArchivDatenElementTyp elementTyp, ScopeArchivDateOperator dateOperator, string bgnDtStnd, string endDtStnd, DateTime bgnDt,
                                          DateTime endDt, bool bgnApprox, bool endApprox,
                                          int sequence)
        {
            var newRow = CreateBasicRow(gsftObjDtlId, gsftObjKls, elementId, elementTyp, sequence);

            newRow.BGN_DT_STND   = bgnDtStnd;
            newRow.END_DT_STND   = endDtStnd;
            newRow.BGN_DT        = bgnDt;
            newRow.END_DT        = endDt;
            newRow.BGN_CIRCA_IND = bgnApprox ? 1 : 0;
            newRow.END_CIRCA_IND = endApprox ? 1 : 0;
            newRow.DT_OPRTR_ID   = (int)dateOperator;
            detailDataSet.DetailData.AddDetailDataRow(newRow);
        }
        public static DateRangeDateOperator MapDateOperator(ScopeArchivDateOperator scopeArchivDateOperator)
        {
            switch (scopeArchivDateOperator)
            {
            case ScopeArchivDateOperator.Between:
                return(DateRangeDateOperator.between);

            case ScopeArchivDateOperator.FromTo:
                return(DateRangeDateOperator.fromTo);

            case ScopeArchivDateOperator.After:
                return(DateRangeDateOperator.after);

            case ScopeArchivDateOperator.From:
                return(DateRangeDateOperator.startingWith);

            case ScopeArchivDateOperator.Before:
                return(DateRangeDateOperator.before);

            case ScopeArchivDateOperator.To:
                return(DateRangeDateOperator.to);

            case ScopeArchivDateOperator.SineDato:
                return(DateRangeDateOperator.sd);

            case ScopeArchivDateOperator.Exact:
                return(DateRangeDateOperator.exact);

            case ScopeArchivDateOperator.None:
                return(DateRangeDateOperator.na);

            case 0:
                return(DateRangeDateOperator.exact);

            default:
                throw new ArgumentOutOfRangeException(nameof(scopeArchivDateOperator), scopeArchivDateOperator, null);
            }
        }
Exemplo n.º 3
0
        public static List <DataElementElementValueTextValue> GetDateRangeTranslations(ScopeArchivDateOperator dateOperator, string standardDateFrom,
                                                                                       string standardDateTo, bool approxFlagFrom,
                                                                                       bool approxFlagTo, LanguageSettings languageSettings)
        {
            var retVal = new List <DataElementElementValueTextValue>();
            // Add default language
            var trf = new TimeRangeFormatter(languageSettings.DefaultLanguage);

            retVal.Add(new DataElementElementValueTextValue
            {
                Value         = trf.Format(dateOperator, standardDateFrom, standardDateTo, approxFlagFrom, approxFlagTo),
                Lang          = languageSettings.DefaultLanguage.TwoLetterISOLanguageName,
                IsDefaultLang = true
            });

            // Add supported languages
            foreach (var cultureInfo in languageSettings.SupportedLanguages)
            {
                trf = new TimeRangeFormatter(cultureInfo);
                retVal.Add(new DataElementElementValueTextValue
                {
                    Value = trf.Format(dateOperator, standardDateFrom, standardDateTo, approxFlagFrom, approxFlagTo),
                    Lang  = cultureInfo.TwoLetterISOLanguageName
                });
            }

            return(retVal);
        }
        /// <summary>
        ///     Formatiert einen Zeitraum in ein länderspezifisches Textformat.
        /// </summary>
        /// <param name="dateOperator">Der Zeitraumsoperator.</param>
        /// <param name="bgnDtStd">Der Von-Datumswert im scopeArchiv-Standardformat.</param>
        /// <param name="endDtStd">Der Bis-Datumswert im scopeArchiv-Standardformat.</param>
        /// <param name="bgnCirca">Der Circa-Indikator beim Von-Datumswert.</param>
        /// <param name="endCirca">Der Circa-Indikator beim Bis-Datumswert.</param>
        /// <returns></returns>
        public string Format(ScopeArchivDateOperator dateOperator, string bgnDtStd, string endDtStd, bool bgnCirca, bool endCirca)
        {
            string format;
            var    von = "";
            var    bis = "";

            switch (dateOperator)
            {
            case ScopeArchivDateOperator.Between:
                format = resourceManager.GetString("TimeRangeFormatter_Zwischen", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                bis    = Format(endDtStd, endCirca);
                break;

            case ScopeArchivDateOperator.FromTo:
                format = resourceManager.GetString("TimeRangeFormatter_VonBis", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                bis    = Format(endDtStd, endCirca);
                break;

            case ScopeArchivDateOperator.After:
                format = resourceManager.GetString("TimeRangeFormatter_Nach", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                break;

            case ScopeArchivDateOperator.From:
                format = resourceManager.GetString("TimeRangeFormatter_Ab", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                break;

            case ScopeArchivDateOperator.Before:
                format = resourceManager.GetString("TimeRangeFormatter_Vor", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                break;

            case ScopeArchivDateOperator.To:
                format = resourceManager.GetString("TimeRangeFormatter_Bis", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                break;

            case ScopeArchivDateOperator.SineDato:
                format = resourceManager.GetString("TimeRangeFormatter_SineDato", cultureInfo);
                break;

            case ScopeArchivDateOperator.Exact:
                format = resourceManager.GetString("TimeRangeFormatter_Genau", cultureInfo);
                von    = Format(bgnDtStd, bgnCirca);
                break;

            case ScopeArchivDateOperator.None:
                format = resourceManager.GetString("TimeRangeFormatter_KeineAngabe", cultureInfo);
                break;

            default:
                format = "";
                break;
            }

            Debug.Assert(format != null, "format != null");
            return(string.Format(format, von, bis));
        }