protected virtual void DaylightShift_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { var row = e.Row as DaylightShift; if (row == null) { return; } PXTimeZoneInfo timeZoneInfo = (PXTimeZoneInfo)_timeZonesHashtable[row.TimeZone]; row.TimeZoneDescription = PXMessages.LocalizeFormatNoPrefix(timeZoneInfo.DisplayName); var isEditable = row.IsActive == true; PXUIFieldAttribute.SetEnabled <DaylightShift.toDate>(sender, row, isEditable); PXUIFieldAttribute.SetEnabled <DaylightShift.fromDate>(sender, row, isEditable); PXUIFieldAttribute.SetEnabled <DaylightShift.shift>(sender, row, isEditable); if (isEditable) { if (row.ToDate != null && row.FromDate != null && ((DateTime)row.ToDate) <= ((DateTime)row.FromDate)) { sender.RaiseExceptionHandling <DaylightShift.toDate>(row, row.ToDate, new PXSetPropertyException(Messages.IncorrectFromDate)); } } }
private static Message GetListOfMessagesContent(SubmitFeedParamaters objSubmitFeedParams) { Message objMessage = new Message(); objMessage.MessageID = objSubmitFeedParams.shipmentNbr; OrderFulfillment objOrderFulfillment = new OrderFulfillment(); FulfillmentData objFulfillmentData = new FulfillmentData(); objOrderFulfillment.AmazonOrderID = objSubmitFeedParams.amazonOrderID; objOrderFulfillment.FulfillmentDate = new DateTimeOffset(Convert.ToDateTime(objSubmitFeedParams.shipmentDate), PXTimeZoneInfo.FindSystemTimeZoneById("GMTM0800A").UtcOffset).ToString("yyyy-MM-ddTHH:mm:sszzz"); PXTrace.WriteInformation(String.Format("Shipment# {0} FulfillmentDate {1}", objMessage.MessageID, objOrderFulfillment.FulfillmentDate)); objFulfillmentData.CarrierName = objSubmitFeedParams.carrierCode; objFulfillmentData.ShippingMethod = objSubmitFeedParams.shipVia; objFulfillmentData.ShipperTrackingNumber = objSubmitFeedParams.trackingNbr; objOrderFulfillment.FulfillmentData = objFulfillmentData; if (objSubmitFeedParams.liShipItem != null && objSubmitFeedParams.liShipItem.Count > 0) { objOrderFulfillment.Item = objSubmitFeedParams.liShipItem; } objMessage.OrderFulfillment = objOrderFulfillment; return(objMessage); }
protected void ProcessSyncCC(ProcessListDelegate processor, List <Table> list, AUSchedule schedule) { beforeScheduleProcessAll?.Invoke(); PXLongOperation.SetCustomInfo(new List <SyncCCProcessingInfoEntry>(), ProcessingInfo.processingKey); list.Clear(); _InProc = new PXResultset <Table>(); base._ProcessScheduled(processor, list, schedule); var histCache = _Graph.Caches[typeof(AUScheduleHistory)]; List <SyncCCProcessingInfoEntry> infoList = PXLongOperation.GetCustomInfoForCurrentThread(ProcessingInfo.processingKey) as List <SyncCCProcessingInfoEntry>; if (infoList != null) { foreach (SyncCCProcessingInfoEntry infoEntry in infoList) { AUScheduleHistory hist = new PX.SM.AUScheduleHistory(); hist.ExecutionResult = infoEntry.ProcessingMessage.Message; hist.ErrorLevel = (short)infoEntry.ProcessingMessage.ErrorLevel; hist.ScheduleID = schedule.ScheduleID; hist.ScreenID = schedule.ScreenID; var timeZone = PXTimeZoneInfo.FindSystemTimeZoneById(schedule.TimeZoneID); DateTime startUtc = PXTimeZoneInfo.UtcNow; DateTime start = PXTimeZoneInfo.ConvertTimeFromUtc(startUtc, timeZone); hist.ExecutionDate = start; hist.RefNoteID = infoEntry.NoteId; histCache.Insert(hist); } } histCache.Persist(PXDBOperation.Insert); }
static DaylightShiftMaint() { _timeZonesHashtable = new HybridDictionary(); foreach (PXTimeZoneInfo zone in PXTimeZoneInfo.GetSystemTimeZones()) { _timeZonesHashtable.Add(zone.Id, zone); } }
public virtual void BoxUserTokens_RefreshTokenDate_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { var userToken = e.Row as BoxUserTokens; if (userToken != null && userToken.RefreshTokenDate.HasValue) { e.ReturnValue = PXTimeZoneInfo.ConvertTimeFromUtc(userToken.RefreshTokenDate.Value, PXContext.PXIdentity.TimeZone); } }
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(); }
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); }
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; } } }
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); }