public GroupsService(
            GroupRepository groupRepository,
            EventLocationMapper eventLocationMapper,
            EducatorIdTupleMapper educatorIdMapper,
            ContingentDivisionCourseMapper contingentDivCourseMapper,
            TimetableKindRepository timetableKindRepository,
            TimeTableKindCodeMapper timetableMapper,
            LocaleInfo locale)
        {
            this.groupRepository = groupRepository ??
                                   throw new ArgumentNullException(nameof(groupRepository));

            this.eventLocationMapper = eventLocationMapper ??
                                       throw new ArgumentNullException(nameof(eventLocationMapper));

            this.educatorIdMapper = educatorIdMapper ??
                                    throw new ArgumentNullException(nameof(educatorIdMapper));

            this.contingentDivCourseMapper = contingentDivCourseMapper ??
                                             throw new ArgumentNullException(nameof(contingentDivCourseMapper));
            this.timetableKindRepository = timetableKindRepository ??
                                           throw new ArgumentNullException(nameof(timetableKindRepository));
            this.timetableMapper = timetableMapper ??
                                   throw new ArgumentNullException(nameof(timetableMapper));

            language = locale.Language;
        }
Example #2
0
    protected override void Initialize()
    {
        if (_templateWikiArticleType != null && _rootTemplate != null)
        {
            string language = Request.Params["Language"];
            if (string.IsNullOrEmpty(language))
            {
                language = LocaleInfo.GetCulture().Name;
            }
            int        revision;
            Guid       pageID          = WikiPageId;
            int?       correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
            WikiReader graph           = PXGraph.CreateInstance <WikiReader>();
            object     article         = pageID == Guid.Empty
                                ? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
                                : Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
            _wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
        }
        else
        {
            _wikiShow = new PXWikiShow();
        }

        base.Initialize();
        this.MainForm.DataBinding += new EventHandler(MainForm_DataBinding);
    }
Example #3
0
 protected override void Initialize()
 {
     if (_templateWikiArticleType != null && _rootTemplate != null)
     {
         string language = Request.Params["Language"];
         if (string.IsNullOrEmpty(language))
         {
             language = LocaleInfo.GetCulture().Name;
         }
         int        revision;
         Guid       pageID          = WikiPageId;
         int?       correctRevision = int.TryParse(Request.Params["PageRevisionID"], out revision) ? (int?)revision : null;
         WikiReader graph           = PXGraph.CreateInstance <WikiReader>();
         try
         {
             object article = pageID == Guid.Empty
                                     ? Activator.CreateInstance(_templateWikiArticleType, graph, Request.Params["wiki"], Request.Params["art"], language, correctRevision)
                                     : Activator.CreateInstance(_templateWikiArticleType, graph, pageID, language, correctRevision);
             _wikiShow = new TemplateWikiShow((IWikiArticle)article, (IRootTemplateInfo)_rootTemplate.GetValue(article, null));
         }
         catch (StackOverflowException) { throw; }
         catch (OutOfMemoryException) { throw; }
         catch
         {
             _wikiShow = new PXWikiShow();
         }
     }
     else
     {
         _wikiShow = new PXWikiShow();
     }
     _wikiShow.NotFoundMessage = PXMessages.LocalizeNoPrefix(Msg.WkNotFound);
     base.Initialize();
 }
Example #4
0
        private static void UpdateLocaleCache(LocaleInfo locale, List <MemberFingerprint> fingerPrints)
        {
            if (fingerPrints.Count > 0)
            {
                var current    = Cache.Fingerprints[locale.LocaleId];
                var newlyAdded = fingerPrints.Except(current).Where(i => i.Status == 1);
                var changed    = current.Intersect(newlyAdded);

                current.AddRange(newlyAdded);
                if (changed.Count() > 0)
                {
                    foreach (var c in changed)
                    {
                        if (c.Status != 0)
                        {
                            var cc = current.Find(i => i.Id == c.Id);
                            if (cc != null)
                            {
                                current.Remove(cc);
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        public void LocaleInfoTest()
        {
            const string name   = "locale";
            var          locale = new LocaleInfo(name);

            Expect(locale.Name == name);
        }
        public static void UpdateReportedInTimeZoneIDIfNeeded(PXCache cache, PMTimeActivity row, DateTime?oldValue, DateTime?newValue)
        {
            if (oldValue != newValue)
            {
                string timeZoneID = newValue != null?LocaleInfo.GetTimeZone()?.Id : null;

                cache.SetValueExt <PMTimeActivity.reportedInTimeZoneID>(row, timeZoneID);
            }
        }
        public EventLocationMapper(
            EducatorIdTupleMapper educatorIdMapper,
            LocaleInfo locale)
        {
            this.educatorIdMapper = educatorIdMapper ??
                                    throw new ArgumentNullException(nameof(educatorIdMapper));

            this.language = locale?.Language ??
                            throw new ArgumentNullException(nameof(locale));
        }
Example #8
0
        public ContingentNameTupleMapper(
            ContingentDivisionCourseMapper divCourseMapper,
            LocaleInfo locale)
        {
            this.divCourseMapper = divCourseMapper ??
                                   throw new ArgumentNullException(nameof(divCourseMapper));

            this.language = locale?.Language ??
                            throw new ArgumentNullException(nameof(locale));
        }
Example #9
0
        public static object setlocale(CodeContext /*!*/ context, int category, [DefaultParameterValue(null)] string locale)
        {
            LocaleInfo li = GetLocaleInfo(context);

            if (locale == null)
            {
                return(li.GetLocale(context, category));
            }

            return(li.SetLocale(context, category, locale));
        }
Example #10
0
        public ProgramsService(
            ProgramRepository programRepository,
            StudyYearRepository studyYearRepository,
            LocaleInfo locale)
        {
            this.programRepository = programRepository ??
                                     throw new ArgumentNullException(nameof(programRepository));

            this.studyYearRepository = studyYearRepository ??
                                       throw new ArgumentNullException(nameof(studyYearRepository));

            language = locale.Language;
        }
Example #11
0
        public void SpeciesInfoTest()
        {
            const string nameOne     = "NameOnly";
            var          speciesName = new SpeciesDescription(nameOne);

            Console.Write("Created species: ");
            Console.WriteLine(speciesName);
            Console.WriteLine("SpeciesInfoTest: testing named species Name property...");
            Expect(speciesName.Name == nameOne);
            Console.WriteLine("SpeciesInfoTest: testing named species Locale property...");
            Expect(speciesName.Locale == null);

            const string nameTwo        = "NameAndPop";
            const int    initialPopOne  = 2012;
            var          speciesNamePop = new SpeciesDescription(nameTwo, initialPopOne);

            Console.Write("Created species: ");
            Console.WriteLine(speciesNamePop);
            Console.WriteLine("SpeciesInfoTest: testing name+pop species Name property...");
            Expect(speciesNamePop.Name == nameTwo);
            Console.WriteLine("SpeciesInfoTest: testing name+pop species Locale property...");
            Expect(speciesNamePop.Locale == null);

            const string nameThree         = "NameAndLocale";
            const string localeOneName     = "univ";
            var          localeOne         = new LocaleInfo(localeOneName);
            var          speciesNameLocale = new SpeciesDescription(nameThree, localeOne);

            Console.Write("Created species: ");
            Console.WriteLine(speciesNameLocale);
            Console.WriteLine("SpeciesInfoTest: testing name+locale species Name property...");
            Expect(speciesNameLocale.Name == nameThree);
            Console.WriteLine("SpeciesInfoTest: testing name+locale species Locale property...");
            Expect(speciesNameLocale.Locale == localeOne);

            const string nameFour             = "NamePopAndLocale";
            const int    initialPopTwo        = 2112;
            const string localeTwoName        = "bellevue";
            var          localeTwo            = new LocaleInfo(localeTwoName);
            var          speciesNamePopLocale = new SpeciesDescription(nameFour, initialPopTwo, localeTwo);

            Console.Write("Created species: ");
            Console.WriteLine(speciesNamePopLocale);
            Console.WriteLine("SpeciesInfoTest: testing name+pop+locale species Name property...");
            Expect(speciesNamePopLocale.Name == nameFour);
            Console.WriteLine("SpeciesInfoTest: testing name+pop+locale species Locale property...");
            Expect(speciesNamePopLocale.Locale == localeTwo);
        }
Example #12
0
        public static object setlocale(CodeContext /*!*/ context, int category, string locale = null)
        {
            LocaleInfo li = GetLocaleInfo(context);

            if (locale == null)
            {
                return(li.GetLocale(context, category));
            }
            //  An empty string specifies the user’s default settings.
            if (locale == "")
            {
                locale = GetDefaultLocale();
            }

            return(li.SetLocale(context, category, locale));
        }
        public StudyDivisionsService(
            DivisionRepository divisionsRepository,
            StudyYearRepository studyYearRepository,
            LocaleInfo locale)
        {
            this.divisionsRepository = divisionsRepository ??
                                       throw new ArgumentNullException(nameof(divisionsRepository));

            this.studyYearRepository = studyYearRepository ??
                                       throw new ArgumentNullException(nameof(studyYearRepository));

            this.language = locale?.Language ??
                            throw new ArgumentNullException(nameof(locale));

            this.culture = locale?.Culture ??
                           throw new ArgumentNullException(nameof(locale));
        }
Example #14
0
        public void Initialize()
        {
            CheckParameters();
            _rareEventValue = model.Parameters.First(p => p.Name == _reValName).Value;
            _rareEventTest  = new EqualTo(_reExpression, new ConstantValue(_rareEventValue));
            SetRareEventType();

            if (_biasingParametersFlag)
            {
                for (int i = 0; i < _reactions.NumReactions; i++)
                {
                    _gamma.Add(new double[_gammaSize]);
                    _propensityCutoff.Add(new double[_gammaSize - 1]);
                }

                _biasingParameters.RareEvent.ExpressionLocale = "global";
                _biasingParameters.RareEvent.ExpressionName   = _reExpressionName;

                foreach (var locale in modelInfo.Locales)
                {
                    var newLocaleInfo = new BiasingParameters.LocaleInfo {
                        Name = locale.Name
                    };
                    var        newReactionInfo = newLocaleInfo.Reactions;
                    LocaleInfo testLocale      = locale;
                    var        reactions       = modelInfo.Reactions.Where(r => r.Locale == testLocale);
                    newReactionInfo.AddRange(reactions.Select(reaction => new BiasingParameters.ReactionInfo {
                        Name = reaction.Name
                    }));
                    _biasingParameters.Locales.Add(newLocaleInfo);
                }
            }
            else
            {
                for (int i = 0; i < _reactions.NumReactions; i++)
                {
                    var localeIndex   = LocaleIndex(_reactions.Reactions[i]);
                    var reactionIndex = ReactionIndex(_reactions.Reactions[i], localeIndex);
                    var tempRareEvent = _biasingParameters.Locales[localeIndex].Reactions[reactionIndex].RareEvents[_biasingParameters.RareEvent.IntermediateRareEventCount - 1];
                    _gamma.Add(tempRareEvent.Gammas);
                    _propensityCutoff.Add(tempRareEvent.Thresholds);
                }
            }
        }
Example #15
0
        private static T TryExecute <T, TArgs>(Func <TArgs, T> method, TArgs args)
            where TArgs : BaseRequestModel
        {
            try
            {
                return(method(args));
            }
            catch (ApiException exception)
            {
                ApiErrorModel error = JsonConvert.DeserializeObject <ApiErrorModel>(exception.ErrorContent);

                if (error.errorCode == Constants.ErrorCode.DocuSignEnvelopeNotInFolder ||
                    error.errorCode == Constants.ErrorCode.DocuSignEnvelopeVoidInvalidState)
                {
                    return(default(T));
                }

                if (error.errorCode == Constants.ErrorCode.DocuSignEnvelopeLock)
                {
                    var accountId    = Authenticate(args.ESignAccount);
                    var envelopesApi = new EnvelopesApi();

                    var lockEnvelope = envelopesApi.GetLock(accountId, args.EnvelopeId);
                    var time         = PXTimeZoneInfo.ConvertTimeFromUtc(
                        DateTime.Parse(lockEnvelope.LockedUntilDateTime).ToUniversalTime(),
                        LocaleInfo.GetTimeZone(),
                        false);

                    var message = string.Format(Messages.ESignEnvelopeLock, time.ToShortTimeString());
                    throw new PXException(message);
                }

                var errorMessage = ErrorCodeHelper.GetValueByKey(error.errorCode);
                if (errorMessage != null)
                {
                    throw new PXException(errorMessage);
                }

                throw new PXException(error.message);
            }
        }
        private static void FillCommon(vEvent card, EPActivity row)
        {
            if (row.StartDate == null)
            {
                throw new ArgumentNullException("row", Messages.NullStartDate);
            }

            var timeZone  = LocaleInfo.GetTimeZone();
            var startDate = PXTimeZoneInfo.ConvertTimeToUtc((DateTime)row.StartDate, timeZone);

            card.Summary     = row.Subject;
            card.IsHtml      = true;
            card.Description = row.Body;
            card.StartDate   = startDate;
            card.EndDate     = row.EndDate.HasValue
                                                                ? PXTimeZoneInfo.ConvertTimeToUtc((DateTime)row.EndDate, timeZone)
                                                                : startDate;
            card.Location  = row.Location;
            card.IsPrivate = row.IsPrivate ?? false;
            card.UID       = row.ImcUID == null ? "ACUMATICA_" + row.TaskID.ToString() : row.ImcUID.ToString();
        }
Example #17
0
        private static Dictionary<LocaleInfo, LocalizationManager> LoadLocales(XElement localeElements)
        {
            var locales = new Dictionary<LocaleInfo, LocalizationManager>();
            foreach (XElement localeElement in localeElements.Elements("locale"))
            {
                string localeId = XmlHelper.GetAttributeValue(localeElement, "id");
                string localeName = XmlHelper.GetAttributeValue(localeElement, "name");
                LocaleInfo localeInfo = new LocaleInfo(localeId, localeName);

                // Ensure locale ID is unique
                if (locales.ContainsKey(localeInfo))
                    throw XmlHelper.CreateException(localeElement, "Duplicate definition of locale: " + localeInfo);

                Debug.WriteLine("Loading locale: " + localeInfo);
                Dictionary<string, LocalizedString> localizedStrings = LoadSingleLocale(localeElement);
                LocalizationManager locale = new LocalizationManager(localizedStrings);
                locales.Add(localeInfo, locale);
            }

            return locales;
        }
Example #18
0
        public EducatorsService(
            EducatorRepository educatorRepository,
            EventLocationMapper eventLocationMapper,
            EducatorIdTupleMapper educatorIdMapper,
            ContingentNameTupleMapper contingentNameMapper,
            LocaleInfo locale)
        {
            this.educatorRepository = educatorRepository ??
                                      throw new ArgumentNullException(nameof(educatorRepository));

            this.eventLocationMapper = eventLocationMapper ??
                                       throw new ArgumentNullException(nameof(eventLocationMapper));

            this.educatorIdMapper = educatorIdMapper ??
                                    throw new ArgumentNullException(nameof(educatorIdMapper));

            this.contingentNameMapper = contingentNameMapper ??
                                        throw new ArgumentNullException(nameof(contingentNameMapper));

            language = locale.Language;
        }
Example #19
0
        public ExtracurDivisionsService(
            ExtracurDivisionRepository divisionsRepository,
            AddressLocationMapper addressLocationMapper,
            ExtracurEventMapper extracurEventMapper,
            LocaleInfo locale)
        {
            if (locale == null)
            {
                throw new ArgumentNullException(nameof(locale));
            }

            this.divisionsRepository = divisionsRepository ??
                                       throw new ArgumentNullException(nameof(divisionsRepository));

            this.addressLocationMapper = addressLocationMapper ??
                                         throw new ArgumentNullException(nameof(addressLocationMapper));

            this.extracurEventMapper = extracurEventMapper ??
                                       throw new ArgumentNullException(nameof(extracurEventMapper));

            language = locale.Language;
            culture  = locale.Culture;
        }
Example #20
0
        private static Dictionary <LocaleInfo, LocalizationManager> LoadLocales(XElement localeElements)
        {
            var locales = new Dictionary <LocaleInfo, LocalizationManager>();

            foreach (XElement localeElement in localeElements.Elements("locale"))
            {
                string     localeId   = XmlHelper.GetAttributeValue(localeElement, "id");
                string     localeName = XmlHelper.GetAttributeValue(localeElement, "name");
                LocaleInfo localeInfo = new LocaleInfo(localeId, localeName);

                // Ensure locale ID is unique
                if (locales.ContainsKey(localeInfo))
                {
                    throw XmlHelper.CreateException(localeElement, "Duplicate definition of locale: " + localeInfo);
                }

                Debug.WriteLine("Loading locale: " + localeInfo);
                Dictionary <string, LocalizedString> localizedStrings = LoadSingleLocale(localeElement);
                LocalizationManager locale = new LocalizationManager(localizedStrings);
                locales.Add(localeInfo, locale);
            }

            return(locales);
        }
 public AddressLocationMapper(LocaleInfo locale)
 {
     language = locale?.Language ??
                throw new ArgumentNullException(nameof(locale));
 }
Example #22
0
        public void ModelInfoTest()
        {
            const string modelName = "test model";
            var          builder   = new ModelInfo.ModelBuilder(modelName);

            const string constraintName          = "test constraint";
            const string constraintPredicateName = "constraint predicate";
            var          constraintExpression    = new EqualToOperator(Two, Two);
            var          constraintPredicate     = new BooleanExpressionTree(constraintPredicateName, constraintExpression);
            var          constraint = new ConstraintInfo(constraintName, constraintPredicate);

            builder.AddConstraint(constraint);

/*
 *          const string eventName = "test event";
 *          const string eventPredicateName = "event predicate";
 *          var eventExpression = new GreaterThanOperator(Three, Two);
 *          var eventPredicate = new BooleanExpressionTree(eventPredicateName, eventExpression);
 *          int eventCount = 0;
 *          var testEvent = new EventInfo(eventName, eventPredicate, () => { eventCount++; });
 *          builder.AddEvent(testEvent);
 */

            const string expressionName = "test expression";
            var          expression     = new AddOperator(Three, Two);
            var          expressionTree = new NumericExpressionTree(expressionName, expression);

            builder.AddExpression(expressionTree);

            const string localeName = "test locale";
            var          locale     = new LocaleInfo(localeName);

            builder.AddLocale(locale);

            const string observableName           = "test observable";
            const string observableExpressionName = "observable expression";
            var          rootOperator             = new PowerOperator(Two, Three);
            var          observableExpressionTree = new NumericExpressionTree(observableExpressionName, rootOperator);
            var          observable = new ObservableInfo(observableName, observableExpressionTree);

            builder.AddObservable(observable);

            const string parameterName = "test parameter";
            var          parameter     = new ParameterInfo(parameterName, 3.14159265f);

            builder.AddParameter(parameter);

            const string predicateName       = "test predicate";
            var          predicateExpression = new LessThanOperator(Two, Three);
            var          predicate           = new BooleanExpressionTree(predicateName, predicateExpression);

            builder.AddPredicate(predicate);

            const string speciesName = "reactant";
            var          reactant    = new SpeciesDescription(speciesName, 2012, locale);

            builder.AddSpecies(reactant);

            const string reactionName = "test reaction";
            var          rBuilder     = new ReactionInfo.ReactionBuilder(reactionName);

            rBuilder.AddReactant(reactant);
            var rateExpression = new MultiplyOperator(Ten, new SymbolReference(speciesName));
            var reactionRate   = new NumericExpressionTree(null, rateExpression);

            rBuilder.SetRate(reactionRate);
            var reaction = rBuilder.Reaction;

            builder.AddReaction(reaction);

            var modelInfo = builder.Model;

            Console.WriteLine("ModelInfoTests: checking model name...");
            Expect(modelInfo.Name == modelName);
            Console.WriteLine("ModelInfoTests: checking constraint count (1)...");
            Expect(modelInfo.Constraints.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking constraint...");
            Expect(modelInfo.Constraints.First() == constraint);

/*
 *          Console.WriteLine("ModelInfoTests: checking event count (1)...");
 *          Expect(modelInfo.Events.Count() == 1);
 *          Console.WriteLine("ModelInfoTests: checking event...");
 *          Expect(modelInfo.Events.First() == testEvent);
 */
            Console.WriteLine("ModelInfoTests: checking expression count (3)...");
            Expect(modelInfo.Expressions.Count() == 3);
            Console.WriteLine("ModelInfoTests: checking expressions...");
            var expressions = modelInfo.Expressions.Where(net => net.Name == expressionName).ToList();

            Expect(expressions.Count == 1);
            Expect(expressions[0] == expressionTree);
            Console.WriteLine("ModelInfoTests: checking locale count (1)...");
            Expect(modelInfo.Locales.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking locale...");
            Expect(modelInfo.Locales.First() == locale);
            Console.WriteLine("ModelInfoTests: checking observable count (1)...");
            Expect(modelInfo.Observables.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking observable...");
            Expect(modelInfo.Observables.First() == observable);
            Console.WriteLine("ModelInfoTests: checking parameter count (1)...");
            Expect(modelInfo.Parameters.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking parameter...");
            Expect(modelInfo.Parameters.First() == parameter);

/*
 *          Console.WriteLine("ModelInfoTests: checking predicate count (3)...");
 *          Expect(modelInfo.Predicates.Count() == 3);
 */
            Console.WriteLine("ModelInfoTests: checking predicate count (2)...");
            Expect(modelInfo.Predicates.Count() == 2);
            Console.WriteLine("ModelInfoTests: checking predicate...");
            var predicates = modelInfo.Predicates.Where(pi => pi.Name == predicateName).ToList();

            Expect(predicates.Count == 1);
            Expect(predicates[0] == predicate);
            Console.WriteLine("ModelInfoTests: checking reaction count (1)...");
            Expect(modelInfo.Reactions.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking reaction...");
            Expect(modelInfo.Reactions.First() == reaction);
            Console.WriteLine("ModelInfoTests: checking species count (1)...");
            Expect(modelInfo.Species.Count() == 1);
            Console.WriteLine("ModelInfoTests: checking species...");
            Expect(modelInfo.Species.First() == reactant);
        }
 public EducatorIdTupleMapper(LocaleInfo locale)
 {
     language = locale?.Language ??
                throw new ArgumentNullException(nameof(locale));
 }
Example #24
0
 internal void SetLocale(LocaleInfo locale)
 {
     _localesById.AddOrUpdate(locale.Id, locale, (id, loc) => locale);
     _localesByCode.AddOrUpdate(locale.Code, locale, (id, loc) => locale);
 }
Example #25
0
        public bool PersistGrams(DuplicateDocument document, bool requireRecreate = false)
        {
            if (graph.Caches[document.GetType()].GetStatus(document) == PXEntryStatus.Deleted)
            {
                PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict <CRGrams.entityID>(PXDbType.Int, 4, document.ContactID, PXComp.EQ));

                return(false);
            }

            if (!requireRecreate && GrammSourceUpdated(document))
            {
                return(false);
            }

            PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict <CRGrams.entityID>(PXDbType.Int, 4, document.ContactID, PXComp.EQ));

            foreach (CRGrams gram in DoCreateGramms(document))
            {
                PXDatabase.Insert <CRGrams>(
                    new PXDataFieldAssign(typeof(CRGrams.entityID).Name, PXDbType.Int, 4, document.ContactID),
                    new PXDataFieldAssign(typeof(CRGrams.fieldName).Name, PXDbType.NVarChar, 60, gram.FieldName),
                    new PXDataFieldAssign(typeof(CRGrams.fieldValue).Name, PXDbType.NVarChar, 60, gram.FieldValue),
                    new PXDataFieldAssign(typeof(CRGrams.score).Name, PXDbType.Decimal, 8, gram.Score),
                    new PXDataFieldAssign(typeof(CRGrams.validationType).Name, PXDbType.NVarChar, 2, gram.ValidationType)
                    );
            }

            document.DuplicateStatus         = DuplicateStatusAttribute.NotValidated;
            document.GrammValidationDateTime = PXTimeZoneInfo.Now;

            PXDatabase.Update <Contact>(
                new PXDataFieldAssign <Contact.duplicateStatus>(PXDbType.NVarChar, document.DuplicateStatus),
                new PXDataFieldAssign <Contact.grammValidationDateTime>(PXDbType.DateTime, PXTimeZoneInfo.ConvertTimeToUtc(document.GrammValidationDateTime.Value, LocaleInfo.GetTimeZone())),
                new PXDataFieldRestrict <Contact.contactID>(PXDbType.Int, document.ContactID)
                );

            return(true);
        }
            private void CreateActivity()
            {
                PXCache cache = _graph.Caches[typeof(CRActivity)];

                _activity = (CRActivity)cache.CreateCopy(cache.Insert());

                _activity.ClassID = CRActivityClass.Email;
                _activity.Type    = null;

                _activity.Subject = _email.Message.Subject.With(_ => _.ToString()) ?? " ";

                string clearedSubject;

                DecodeTicket(_activity.Subject, out clearedSubject);
                _activity.Subject = clearedSubject;

                _activity.StartDate = _email.Message.Date == DateTime.MinValue ? PXTimeZoneInfo.Now : PXTimeZoneInfo.ConvertTimeFromUtc(_email.Message.Date.ToUniversalTime(), LocaleInfo.GetTimeZone());

                _activity = (CRActivity)cache.CreateCopy(cache.Update(_activity));

                _graph.EnsureCachePersistence(_activity.GetType());

                var cached = _graph.Caches[_activity.GetType()].Locate(_activity);

                _graph.Persist();
                _graph.SelectTimeStamp();
                _activity = (CRActivity)cache.CreateCopy(cached);
            }
Example #27
0
 public LocalizationManager this[LocaleInfo locale]
 {
     get { return(_locales[locale]); }
 }
Example #28
0
            public bool PersistGrams(Contact contact, bool requireRecreate = false)
            {
                try
                {
                    if (track == null)
                    {
                        track = DateTime.Now;
                    }
                    if (graph.Caches[contact.GetType()].GetStatus(contact) == PXEntryStatus.Deleted)
                    {
                        PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict("EntityID", PXDbType.Int, 4, contact.ContactID, PXComp.EQ));
                        return(false);
                    }

                    if (!requireRecreate && GrammSourceUpdated(contact))
                    {
                        return(false);
                    }

                    PXDatabase.Delete <CRGrams>(new PXDataFieldRestrict("EntityID", PXDbType.Int, 4, contact.ContactID, PXComp.EQ));
                    foreach (CRGrams gram in DoCreateGramms(contact))
                    {
                        PXDatabase.Insert <CRGrams>(
                            new PXDataFieldAssign(typeof(CRGrams.entityID).Name, PXDbType.Int, 4, contact.ContactID),
                            new PXDataFieldAssign(typeof(CRGrams.fieldName).Name, PXDbType.NVarChar, 60, gram.FieldName),
                            new PXDataFieldAssign(typeof(CRGrams.fieldValue).Name, PXDbType.NVarChar, 60, gram.FieldValue),
                            new PXDataFieldAssign(typeof(CRGrams.score).Name, PXDbType.Decimal, 8, gram.Score),
                            new PXDataFieldAssign(typeof(CRGrams.validationType).Name, PXDbType.NVarChar, 2, gram.ValidationType)
                            );
                        //CRGrams row = (CRGrams)graph.Caches[typeof(CRGrams)].Insert(gram);
                        //graph.Caches[typeof(CRGrams)].PersistInserted(row);
                    }
                    contact.GrammValidationDateTime = PXTimeZoneInfo.Now;
                    PXDatabase.Update <Contact>
                    (
                        new PXDataFieldAssign(typeof(Contact.grammValidationDateTime).Name, PXTimeZoneInfo.ConvertTimeToUtc(contact.GrammValidationDateTime.Value, LocaleInfo.GetTimeZone())),
                        new PXDataFieldRestrict(typeof(Contact.contactID).Name, contact.ContactID)
                    );
                    processedItems += 1;
                    return(true);
                }
                finally
                {
                    if (processedItems % 100 == 0)
                    {
                        TimeSpan taken = DateTime.Now - (DateTime)track;
                        System.Diagnostics.Debug.WriteLine("Items count:{0}, increment taken {1}", processedItems, taken);
                        track = DateTime.Now;
                    }
                }
            }
 public ContingentDivisionCourseMapper(LocaleInfo locale)
 {
     language = locale?.Language ??
                throw new ArgumentNullException(nameof(locale));
 }
Example #30
0
    protected void form_DataBinding(object sender, EventArgs e)
    {
        WikiReader graph   = (WikiReader)this.DS.DataGraph;
        PXCache    cache   = graph.Views[this.DS.PrimaryView].Cache;
        WikiPage   current = cache.Current as WikiPage;

        if (current != null)
        {
            string language = Request.Params["Language"];
            if (string.IsNullOrEmpty(language))
            {
                language = LocaleInfo.GetCulture().Name;
            }

            WikiRevision currentrevision =
                PXSelect <WikiRevision,
                          Where <WikiRevision.pageID,
                                 Equal <Required <WikiRevision.pageID> >,
                                 And <WikiRevision.language, Equal <Required <WikiRevision.language> > > >, OrderBy <Desc <WikiRevision.pageRevisionID> > > .SelectWindowed(new PXGraph(), 0, 1, current.PageID, language);

            if (this.PublicUrlEditor != null)
            {
                this.PublicUrlEditor.Text = string.Empty;
            }

            if (current.WikiID != null)
            {
                if (Master is IPXMasterPage)
                {
                    (Master as IPXMasterPage).ScreenTitle = current.Title;
                }
                if (Master is IPXMasterPage)
                {
                    (Master as IPXMasterPage).BranchAvailable = false;
                }
                graph.Filter.Current.WikiID = current.WikiID;
                WikiDescriptor wiki    = graph.wikis.SelectWindowed(0, 1, current.WikiID);
                PXWikiShow     content = MainForm.FindControl("edContent") as PXWikiShow;
                if (wiki != null)
                {
                    if (!string.IsNullOrEmpty(wiki.PubVirtualPath))
                    {
                        if (PublicUrlEditor != null)
                        {
                            PublicUrlEditor.Text = Request.GetExternalUrl().ToString();
                            int index = PublicUrlEditor.Text.IndexOf("Wiki");
                            if (index > -1)
                            {
                                PublicUrlEditor.Text = PublicUrlEditor.Text.Remove(0, index);
                                PublicUrlEditor.Text = wiki.PubVirtualPath + "/" + PublicUrlEditor.Text;
                            }
                        }
                    }
                    if (!Page.IsPostBack)
                    {
                        PXAuditJournal.Register("WI000000", Wiki.Link(wiki.Name, current.Name));
                    }
                }

                if (content != null)
                {
                    PXDBContext wikiContext = (PXDBContext)content.WikiContext;

                    if (currentrevision != null)
                    {
                        wikiContext.Text = currentrevision.Content;
                    }
                    if (_pageDBContextType == null)
                    {
                        wikiContext.ContentWidth  = current.Width.GetValueOrDefault(0);
                        wikiContext.ContentHeight = current.Height.GetValueOrDefault(0);
                        wikiContext.PageTitle     = current.Title;
                    }

                    wikiContext.WikiID = current.WikiID.Value != Guid.Empty ? current.WikiID.Value : current.PageID.Value;

                    if (current.PageID != null && (_pageDBContextType == null &&
                                                   (PXSiteMap.WikiProvider.GetAccessRights(current.PageID.Value) >= PXWikiRights.Update &&
                                                    current.PageRevisionID > 0)))
                    {
                        wikiContext.LastModified        = current.PageRevisionDateTime;
                        wikiContext.LastModifiedByLogin = cache.GetStateExt(current, "PageRevisionCreatedByID").ToString();
                    }
                    if (current.PageID != null && PXSiteMap.WikiProvider.GetAccessRights(current.PageID.Value) >= PXWikiRights.Update)
                    {
                        wikiContext.RenderSectionLink = true;
                    }
                    else
                    {
                        wikiContext.HideBrokenLink    = true;
                        wikiContext.RedirectAvailable = true;
                    }

                    if (this.WikiTextPanel != null)
                    {
                        this.WikiTextPanel.Caption = current.Title;
                    }
                    if (this.WikiTextEditor != null)
                    {
                        this.WikiTextEditor.Text = graph.ConvertGuidToLink(current.Content);
                    }
                }
                if (this.LinkEditor != null)
                {
                    this.LinkEditor.Text = "[" + (wiki != null && wiki.Name != null ? wiki.Name + "\\" : string.Empty) + current.Name + "]";
                }
            }
        }
        this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "varreg", "var printLink=\"" + ResolveUrl("~/Wiki/Print.aspx") + "?" + ControlHelper.SanitizeUrl(Request.QueryString.ToString()) + "\";", true);

        if (this.LinkEditor != null)
        {
            LinkEditor.ReadOnly = true;
        }
        if (this.UrlEditor != null)
        {
            UrlEditor.Text     = Request.GetExternalUrl().ToString();
            UrlEditor.ReadOnly = true;
        }
        if (this.PublicUrlEditor != null)
        {
            PublicUrlEditor.Enabled  = !string.IsNullOrEmpty(PublicUrlEditor.Text);
            PublicUrlEditor.ReadOnly = true;
        }
    }
Example #31
0
 public LocalizationManager this[LocaleInfo locale]
 {
     get { return _locales[locale]; }
 }