コード例 #1
0
        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();
        }
コード例 #2
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);
        }
コード例 #3
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;
                    }
                }
            }