private IEnumerable <Mailbox> GetExternalMailOutside(EPActivity message) { var prevActivity = message; if (prevActivity == null) { yield break; } if (prevActivity.IsIncome == true) { var mailFrom = prevActivity.MailFrom.With(_ => _.Trim()); if (!string.IsNullOrEmpty(mailFrom)) { yield return(Mailbox.Parse(mailFrom)); } } else { foreach (Mailbox address in ParseAddresses(prevActivity.MailTo)) { yield return(address); } foreach (Mailbox address in ParseAddresses(prevActivity.MailCc)) { yield return(address); } //TODO: need BCC } }
public override void CancelRow(EPActivity row) { if (row != null) { CancelTask(row); } }
public static bool RecordCostTrans(RegisterEntry registerEntry, List <EPActivityApprove> activities) { registerEntry.FieldVerifying.AddHandler <PMTran.inventoryID>((PXCache sender, PXFieldVerifyingEventArgs e) => { e.Cancel = true; });//restriction should be applicable only for budgeting. EmployeeCostEngine costEngine = new EmployeeCostEngine(registerEntry); registerEntry.Views.Caches.Add(typeof(EPActivity)); PXCache activityCache = registerEntry.Caches <EPActivity>(); registerEntry.Document.Cache.Insert(); bool success = true; bool activityAdded = false; for (int i = 0; i < activities.Count; i++) { EPActivity activity = PXSelect <EPActivity> .Search <EPActivity.taskID>(registerEntry, activities[i].TaskID); if (activity.Released == true) //activity can be released to PM via Timecard prior to releasing the case. { continue; } try { if (activity.ProjectTaskID != null) //cost transactions are created only if project is set. { EPEmployee employee = PXSelect <EPEmployee> .Search <EPEmployee.userID>(registerEntry, activity.Owner); activity.LabourItemID = costEngine.GetLaborClass(activity); activityCache.Update(activity); decimal?cost = costEngine.CalculateEmployeeCost(activity, employee.BAccountID, activity.StartDate.Value); registerEntry.CreateTransaction(activity, employee.BAccountID, activity.StartDate.Value, activity.TimeSpent, activity.TimeBillable, cost); activity.EmployeeRate = cost; activityAdded = true; } activity.Released = true; activityCache.Update(activity); } catch (Exception e) { PXProcessing <EPActivityApprove> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message); success = false; } } if (success) { if (activityAdded) { registerEntry.Save.Press(); } else { activityCache.Persist(PXDBOperation.Update); } } return(success); }
private Dictionary <int, List <EPActivity> > GetMailByAccount() { bool isanyselected = false; var MailDictionary = new Dictionary <int, List <EPActivity> >(); EPActivity currentemail = Emails.Current; foreach (EPActivity email in Emails.Select()) { if (email != null) { if (email.Selected == true) { if (MailDictionary.ContainsKey((int)email.MailAccountID)) { MailDictionary[(int)email.MailAccountID].Add(email); } else { MailDictionary.Add((int)email.MailAccountID, new List <EPActivity>()); MailDictionary[(int)email.MailAccountID].Add(email); } isanyselected = true; } } } if (isanyselected == false) { if (currentemail != null) { MailDictionary.Add((int)currentemail.MailAccountID, new List <EPActivity>()); MailDictionary[(int)currentemail.MailAccountID].Add(currentemail); } } return(MailDictionary); }
private void FillOrganizer(vEvent card, EPActivity row) { InfoSelect.View.Clear(); var set = InfoSelect.Select(row.TaskID); if (set == null || set.Count == 0) { return; } var owner = (Users)set[0][typeof(Users)]; var contact = (Contact)set[0][typeof(Contact)]; string fullName; string email; ExtractAttendeeInfo(owner, contact, out fullName, out email); card.OrganizerName = fullName; card.OrganizerEmail = email; if (!string.IsNullOrEmpty(fullName)) { card.Attendees.Add(new vEvent.Attendee( fullName, email, vEvent.Attendee.Statuses.Accepted, vEvent.Attendee.Rules.Chair)); } }
private void UpdateAcitivtyRemindInfo(object id, UpdateRemindInfo handler) { EPReminder remindInfo = RemindInfo.Select(id); if (remindInfo == null) { remindInfo = (EPReminder)RemindInfo.Cache.Insert(); EPActivity activity = PXSelect <EPActivity, Where <EPActivity.taskID, Equal <Required <EPActivity.taskID> > > > . Select(this, id); remindInfo.NoteID = PXNoteAttribute.GetNoteID(Caches[typeof(EPActivity)], activity, EntityHelper.GetNoteField(typeof(EPActivity))); remindInfo.UserID = PXAccess.GetUserID(); remindInfo.Date = PXTimeZoneInfo.Now; RemindInfo.Cache.Normalize(); } handler(remindInfo); RemindInfo.Update(remindInfo); using (var ts = new PXTransactionScope()) { RemindInfo.Cache.Persist(PXDBOperation.Insert); RemindInfo.Cache.Persist(PXDBOperation.Update); ts.Complete(this); } RemindInfo.Cache.Persisted(false); ActivityList.Cache.Clear(); ActivityList.View.Clear(); ActivityCount.Cache.Clear(); ActivityCount.View.Clear(); ReminderList.Cache.Clear(); ReminderList.View.Clear(); ReminderListCurrent.View.Clear(); }
public override void CompleteRow(EPActivity row) { if (row != null) { CompleteTask(row); } }
private string GenerateFrom(EPActivity message) { var defaultAddress = _account.Address.With(_ => _.Trim()); var defaultDisplayName = _account.Description.With(_ => _.Trim()); return(GenerateBackAddress(message, defaultDisplayName, defaultAddress, true)); }
public virtual void NavigateToItem(EPActivity current) { if (current != null) { var graphType = EPActivityPrimaryGraphAttribute.GetGraphType(current); if (!PXAccess.VerifyRights(graphType)) { ReminderList.Ask(CR.Messages.AccessDenied, CR.Messages.FormNoAccessRightsMessage(graphType), MessageButtons.OK, MessageIcon.Error); } else { var graph = (PXGraph)PXGraph.CreateInstance(graphType); var cache = graph.Caches[current.GetType()]; var searchView = new PXView( graph, false, BqlCommand.CreateInstance(typeof(Select <>), cache.GetItemType())); var startRow = 0; var totalRows = 0; var acts = searchView. Select(null, null, new object[] { current.TaskID }, new string[] { typeof(EPActivity.taskID).Name }, null, null, ref startRow, 1, ref totalRows); if (acts != null && acts.Count > 0) { var act = acts[0]; cache.Current = act; PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow); } } } }
private void SendCopyMessageToInside(PXGraph graph, EMailAccount account, EPActivity message, IEnumerable <Mailbox> email) { var cache = graph.Caches[message.GetType()]; var copy = (EPActivity)cache.CreateCopy(message); copy.TaskID = null; copy.IsIncome = false; copy.ParentTaskID = message.TaskID; copy.MailTo = ConcatAddresses(email); //TODO: need add address description copy.MailCc = null; copy.MailBcc = null; copy.MPStatus = MailStatusListAttribute.PreProcess; copy.ClassID = CRActivityClass.EmailRouting; new AddInfoEmailProcessor().Process(new EmailProcessEventArgs(graph, account, copy)); copy.RefNoteID = null; copy.ParentRefNoteID = null; var imcUid = Guid.NewGuid(); copy.ImcUID = imcUid; copy.MessageId = GetType().Name + "_" + imcUid.ToString().Replace("-", string.Empty); copy.Owner = message.Owner; copy.IsPrivate = message.IsPrivate; cache.Insert(copy); var noteFiles = PXNoteAttribute.GetFileNotes(cache, message); if (noteFiles != null) { PXNoteAttribute.SetFileNotes(cache, copy, noteFiles); } }
//TODO: need optimizae DB requests internal static bool IsFromInternalUser(PXGraph graph, EPActivity message) { var @from = Mailbox.Parse(message.MailFrom).With(_ => _.Address).With(_ => _.Trim()); PXSelect <Users, Where2 <Where <Users.guest, Equal <False>, Or <Users.guest, IsNull> >, And <Users.email, Equal <Required <Users.email> > > > > . Clear(graph); var usersEmail = (Users)PXSelect <Users, Where2 <Where <Users.guest, Equal <False>, Or <Users.guest, IsNull> >, And <Users.email, Equal <Required <Users.email> > > > > . Select(graph, @from) != null; if (usersEmail) { return(true); } PXSelectJoin <EPEmployee, LeftJoin <Contact, On <Contact.contactID, Equal <EPEmployee.defContactID> > >, Where <EPEmployee.userID, IsNotNull, And <Contact.eMail, Equal <Required <Contact.eMail> > > > > . Clear(graph); return((EPEmployee)PXSelectJoin <EPEmployee, LeftJoin <Contact, On <Contact.contactID, Equal <EPEmployee.defContactID> > >, Where <EPEmployee.userID, IsNotNull, And <Contact.eMail, Equal <Required <Contact.eMail> > > > > . Select(graph, @from) != null); }
private DateTime?GetLasttUsingWeek() { DateTime dateFromActivity = new DateTime(1900, 1, 1); DateTime startDate = new DateTime(1900, 1, 1); EPTimeCard lastTimeCard = (EPTimeCard)PXSelectOrderBy <EPTimeCard, OrderBy <Desc <EPTimeCard.weekId> > > .SelectSingleBound(this, null); EPActivity lastActivity = (EPActivity)PXSelect <EPActivity, Where <EPActivity.startDate, IsNotNull>, OrderBy <Desc <EPActivity.weekID> > > .SelectSingleBound(this, null); if (lastTimeCard != null) { startDate = PXWeekSelectorAttribute.GetWeekSrartDate(lastTimeCard.WeekID.Value); } if (lastActivity != null) { dateFromActivity = lastActivity.StartDate.Value; } startDate = startDate >= dateFromActivity ? startDate : dateFromActivity; if (startDate == new DateTime(1900, 1, 1)) { return(null); } else { return(startDate); } }
private void InsertInformationIntoMessage(EPActivity message, IEnumerable<string> briefInfo) { if (briefInfo == null) return; var content = message.Body ?? string.Empty; var match = _HTML_REGEX.Match(content); if (match.Success) { var bodyGroup = match.Groups["body"]; var orgBody = bodyGroup.Value; var sb = new StringBuilder(); foreach (string info in briefInfo) sb.AppendFormat("<i>{0}</i><br/>", info); sb.AppendFormat("<br/>"); var htmlText = sb.ToString(); if (!orgBody.StartsWith(htmlText)) { var newBody = orgBody.Insert(0, htmlText); content = content.Substring(0, bodyGroup.Index) + newBody + content.Substring(bodyGroup.Index + bodyGroup.Length); } } else { var sb = new StringBuilder(); sb.AppendLine("***"); foreach (string info in briefInfo) sb.AppendLine(info); sb.AppendLine("***"); sb.AppendLine(); var plainText = sb.ToString(); if (!content.StartsWith(plainText)) content = content.Insert(0, plainText); } message.Body = content; }
public static void ProcessItem(EPActivity item) { EMailMessageReceiver.ProcessMessage(item); if (item.MPStatus == MailStatusListAttribute.Failed) { throw new PXException(item.Exception); } }
private static EPActivity GetParentMessage(PXGraph graph, EPActivity message) { if (message.Ticket == null) { return(null); } return(SelectActivity(graph, message.Ticket)); }
private void ResendProcess() { bool isanyselected = false; var Send = new CommonMailSendProvider(); var SendDictionary = new Dictionary <int, List <EPActivity> >(); EPActivity currentemail = Emails.Current; foreach (EPActivity email in Emails.Select()) { if (email != null) { if (email.Selected == true) { if (email.IsIncome != true) { if (IsMailProccessable(email)) { email.MPStatus = MailStatusListAttribute.PreProcess; if (SendDictionary.ContainsKey((int)email.MailAccountID)) { SendDictionary[(int)email.MailAccountID].Add(email); } else { SendDictionary.Add((int)email.MailAccountID, new List <EPActivity>()); SendDictionary[(int)email.MailAccountID].Add(email); } } } isanyselected = true; } } } if (isanyselected == false) { if (currentemail != null) { if (currentemail.IsIncome != true) { if (IsMailProccessable(currentemail)) { currentemail.MPStatus = MailStatusListAttribute.PreProcess; SendDictionary.Add((int)currentemail.MailAccountID, new List <EPActivity>()); SendDictionary[(int)currentemail.MailAccountID].Add(currentemail); } } } } foreach (var accountmessages in SendDictionary) { foreach (var message in SendDictionary[accountmessages.Key]) { Send.SendMessage(message); } } }
public static void ProcessItem(EPActivity item) { MailSendProvider.SendMessage(item); if (item.MPStatus == MailStatusListAttribute.Failed) { throw new PXException(item.Exception); } }
private void ValidateOvertimeBillable(PXCache sender, EPActivity row) { sender.RaiseExceptionHandling <EPActivity.overtimeBillable>(row, null, null); if (row.OvertimeBillable != null && row.OvertimeBillable > row.OvertimeSpent) { var exception = new PXSetPropertyException(CR.Messages.OvertimeBillableCannotBeGreaterThanOvertimeSpent); sender.RaiseExceptionHandling <EPActivity.overtimeBillable>(row, row.OvertimeBillable, exception); } }
private void MarkAsRoutingEmail(PXGraph graph, EPActivity message) { var cache = graph.Caches[message.GetType()]; message.ClassID = CRActivityClass.EmailRouting; message.RefNoteID = null; message.ParentRefNoteID = null; cache.Update(message); }
private void PreProcessMessage(EPActivity message) { message = (EPActivity)_graph.Caches[message.GetType()].CreateCopy(message); message.MPStatus = MailStatusListAttribute.InProcess; message.Exception = null; UpdateMessage(message); }
private string GenerateBackAddress(EPActivity message, string defaultDisplayName, string defaultAddress, bool suspendCustomAddress) { if (message.Owner == null) { return(string.IsNullOrEmpty(defaultDisplayName) ? defaultAddress : Mailbox.Create(defaultDisplayName, defaultAddress)); } var records = PXSelectJoin <Users, LeftJoin <EPEmployee, On <EPEmployee.userID, Equal <Users.pKID> >, LeftJoin <Contact, On <Contact.contactID, Equal <EPEmployee.defContactID> > > >, Where <Users.pKID, Equal <Required <Users.pKID> > > > . SelectWindowed(_graph, 0, 1, message.Owner); if (records == null || records.Count == 0) { return(defaultAddress); } var row = records[0]; var employee = (Contact)row[typeof(Contact)]; var user = (Users)row[typeof(Users)]; string displayName = null; string address = defaultAddress; if (user != null && user.PKID != null) { var userDisplayName = user.FullName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(userDisplayName)) { displayName = userDisplayName; } var userAddress = user.Email.With(_ => _.Trim()); if (!suspendCustomAddress && !string.IsNullOrEmpty(userAddress)) { address = userAddress; } } if (employee != null && employee.BAccountID != null) { var employeeDisplayName = employee.DisplayName.With(_ => _.Trim()); if (!string.IsNullOrEmpty(employeeDisplayName)) { displayName = employeeDisplayName; } var employeeAddress = employee.EMail.With(_ => _.Trim()); if (!suspendCustomAddress && !string.IsNullOrEmpty(employeeAddress)) { address = employeeAddress; } } return(string.IsNullOrEmpty(displayName) ? address : Mailbox.Create(displayName, address).ToString()); }
private string GenerateReply(EPActivity message) { var defaultAddress = _account.ReplyAddress.With(_ => _.Trim()); if (string.IsNullOrEmpty(defaultAddress)) { defaultAddress = _account.Address.With(_ => _.Trim()); } return(GenerateBackAddress(message, null, defaultAddress, true)); }
public EmailProcessEventArgs(PXGraph graph, EMailAccount account, EPActivity message) { if (graph == null) throw new ArgumentNullException("graph"); if (account == null) throw new ArgumentNullException("account"); if (message == null) throw new ArgumentNullException("message"); _graph = graph; _account = account; _message = message; }
private EPActivity InsertActivity(PXCache cache) { CRHelper.AssertNull(cache, "cache"); CRHelper.AssertInheritance(typeof(EPActivity), cache.GetItemType(), "cache.GetItemType()"); EPActivity activity = (EPActivity)cache.Insert(); activity.RefNoteID = NoteID; return(activity); }
private Package(PXGraph graph, EMailAccount account, EPActivity message) { if (graph == null) throw new ArgumentNullException("graph"); if (account == null) throw new ArgumentNullException("account"); if (message == null) throw new ArgumentNullException("message"); _graph = graph; _account = account; _message = message; }
protected virtual void EPActivity_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { EPActivity row = e.Row as EPActivity; if (row == null) { return; } string status = ((string)cache.GetValueOriginal <EPActivity.uistatus>(row) ?? ActivityStatusListAttribute.Open); bool editable = status == ActivityStatusListAttribute.Open || status == ActivityStatusListAttribute.Draft || status == ActivityStatusListAttribute.InProcess; PXUIFieldAttribute.SetEnabled(cache, row, editable); Delete.SetEnabled(editable); Complete.SetEnabled(editable); CompleteAndFollowUp.SetEnabled(editable); CancelActivity.SetEnabled(editable); PXUIFieldAttribute.SetEnabled <EPActivity.taskID>(cache, row); PXUIFieldAttribute.SetEnabled <EPActivity.uistatus>(cache, row); PXUIFieldAttribute.SetEnabled <EPActivity.timeSpent>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.createdByID>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.completedDateTime>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.overtimeSpent>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.timeBillable>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.overtimeBillable>(cache, row, false); PXUIFieldAttribute.SetEnabled <EPActivity.reminderDate>(cache, row, row.IsReminderOn == true); GotoParentActivity.SetEnabled(row.ParentTaskID != null); this.ChildActivities.Cache.AllowDelete = this.ReferencedTasks.Cache.AllowInsert = this.ReferencedTasks.Cache.AllowUpdate = this.ReferencedTasks.Cache.AllowDelete = editable; int timespent = 0; int overtimespent = 0; int timebillable = 0; int overtimebillable = 0; foreach (EPActivity child in ChildActivities.Select(row.TaskID)) { timespent += (child.TimeSpent ?? 0); overtimespent += (child.OvertimeSpent ?? 0); timebillable += (child.TimeBillable ?? 0); overtimebillable += (child.OvertimeBillable ?? 0); } row.TimeSpent = timespent; row.OvertimeSpent = overtimespent; row.TimeBillable = timebillable; row.OvertimeBillable = overtimebillable; }
protected virtual void gotoEntity() { EPActivity row = (EPActivity)Caches[typeof(EPActivity)].Current; if (row == null) { return; } new EntityHelper(this).NavigateToRow(row.RefNoteID, PXRedirectHelper.WindowMode.NewWindow); }
private void VerifyReminder(EPActivity row) { if (row.IsReminderOn == true && row.ReminderDate == null) { var reminderDateDisplayName = PXUIFieldAttribute.GetDisplayName <EPActivity.reminderDate>(Tasks.Cache); var exception = new PXSetPropertyException(ErrorMessages.FieldIsEmpty, reminderDateDisplayName); if (Tasks.Cache.RaiseExceptionHandling <EPActivity.reminderDate>(row, null, exception)) { throw new PXRowPersistingException(typeof(EPActivity.reminderDate).Name, null, ErrorMessages.FieldIsEmpty, reminderDateDisplayName); } } }
protected virtual void EPActivityApprove_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { EPActivity row = (EPActivity)e.Row; if (row == null) { return; } PXUIFieldAttribute.SetEnabled(sender, row, false); PXUIFieldAttribute.SetEnabled <EPActivityApprove.isApprove>(sender, row, true); PXUIFieldAttribute.SetEnabled <EPActivityApprove.isReject>(sender, row, true); }
private void UpdateMessage(EPActivity message) { var emailType = message.GetType(); var cache = _graph.Caches[emailType]; message = (EPActivity)cache.Update(message); _graph.EnshureCachePersistance(emailType); var cached = _graph.Caches[message.GetType()].Locate(message); _graph.Persist(); _graph.SelectTimeStamp(); message = (EPActivity)cache.CreateCopy(cached); }
private IEnumerable <Mailbox> GetExternalRecipient(PXGraph graph, EPActivity message) { var previousMessage = GetPreviousExternalMessage(graph, message); if (previousMessage != null) { return(GetExternalMailOutside(previousMessage)); } //TODO: need implementation //var source = FindSource(graph, (long)message.RefNoteID); return(new Mailbox[0]); }
private static void FillMailCC(PXGraph graph, EPActivity message, long?refNoteId) { if (refNoteId != null && refNoteId >= 0) { foreach (Mailbox email in CRRelationsList <CRRelation.refNoteID> .GetEmailsForCC(graph, (long)refNoteId)) { if (email != null) { message.MailCc += email.ToString() + "; "; } } } }
private static string UpdateMailTo(EPActivity result, string addressList) { if (string.IsNullOrEmpty(result.MailTo) && !string.IsNullOrEmpty(addressList)) { var address = SplitAddresses(addressList); if (address.Count != 0) { result.MailTo = address[0]; address.RemoveAt(0); addressList = string.Join(";", address.ToArray()); } } return(addressList); }
private Guid? GetKnownSender(PXGraph graph, EPActivity message) { var @from = Mailbox.Parse(message.MailFrom).With(_ => _.Address).With(_ => _.Trim()); PXSelectJoin<EPEmployee, InnerJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>, InnerJoin<Users, On<Users.pKID, Equal<EPEmployee.userID>>>>, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. Clear(graph); var employeeEmail = (EPEmployee)PXSelectJoin<EPEmployee, InnerJoin<Contact, On<Contact.contactID, Equal<EPEmployee.defContactID>>, InnerJoin<Users, On<Users.pKID, Equal<EPEmployee.userID>>>>, Where<Contact.eMail, Equal<Required<Contact.eMail>>>>. Select(graph, @from); if (employeeEmail != null) return employeeEmail.UserID; return null; }
private void FillAttendee(vEvent card, EPActivity row) { OtherAttendees.View.Clear(); foreach (EPOtherAttendeeWithNotification otherAttendee in OtherAttendees.Select(row.TaskID)) { card.Attendees.Add( new vEvent.Attendee( otherAttendee.Name, otherAttendee.Email, vEvent.Attendee.Statuses.Accepted)); } Attendees.View.Clear(); foreach (PXResult<EPAttendee, Users, EPEmployee, Contact> item in Attendees.Select(row.TaskID)) { var attendee = (EPAttendee)item[typeof(EPAttendee)]; var user = (Users)item[typeof(Users)]; var contact = (Contact)item[typeof(Contact)]; string fullName; string email; ExtractAttendeeInfo(user, contact, out fullName, out email); var status = vEvent.Attendee.Statuses.NeedAction; switch (attendee.Invitation) { case PXInvitationStatusAttribute.ACCEPTED: status = vEvent.Attendee.Statuses.Accepted; break; case PXInvitationStatusAttribute.REJECTED: status = vEvent.Attendee.Statuses.Declined; break; } card.Attendees.Add( new vEvent.Attendee( user.FullName, user.Email, status)); } }
private void FillOrganizer(vEvent card, EPActivity row) { InfoSelect.View.Clear(); var set = InfoSelect.Select(row.TaskID); if (set == null || set.Count == 0) return; var owner = (Users)set[0][typeof(Users)]; var contact = (Contact)set[0][typeof(Contact)]; string fullName; string email; ExtractAttendeeInfo(owner, contact, out fullName, out email); card.OrganizerName = fullName; card.OrganizerEmail = email; if (!string.IsNullOrEmpty(fullName)) card.Attendees.Add(new vEvent.Attendee( fullName, email, vEvent.Attendee.Statuses.Accepted, vEvent.Attendee.Rules.Chair)); }
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(); }
private EPActivity GetRoutingMessage(PXGraph graph, EPActivity message) { return (EPActivity)PXSelect<EPActivity, Where<EPActivity.parentTaskID, Equal<Required<EPActivity.parentTaskID>>>>. SelectWindowed(graph, 0, 1, message.TaskID); }
private void SendCopyMessage(PXGraph graph, EMailAccount account, EPActivity message, string email) { var cache = graph.Caches[message.GetType()]; var copy = (EPActivity)cache.CreateCopy(message); copy.TaskID = null; copy.IsIncome = false; copy.ParentTaskID = message.TaskID; copy.MailTo = email; //TODO: need add address description copy.MailCc = null; copy.MailBcc = null; copy.MPStatus = MailStatusListAttribute.PreProcess; copy.ClassID = CRActivityClass.EmailRouting; new AddInfoEmailProcessor().Process(new EmailProcessEventArgs(graph, account, copy)); copy.RefNoteID = null; copy.ParentRefNoteID = null; copy.Pop3UID = null; copy.ImapUID = null; var imcUid = Guid.NewGuid(); copy.ImcUID = imcUid; copy.MessageId = this.GetType().Name + "_" + imcUid.ToString().Replace("-", string.Empty); copy.Owner = null; copy = (EPActivity)cache.CreateCopy(cache.Insert(copy)); //Update owner and reset owner if employee not found copy.Owner = message.Owner; try { cache.Update(copy); } catch (PXSetPropertyException) { copy.Owner = null; copy = (EPActivity)cache.CreateCopy(cache.Update(copy)); } var noteFiles = PXNoteAttribute.GetFileNotes(cache, message); if (noteFiles != null) PXNoteAttribute.SetFileNotes(cache, copy, noteFiles); graph.EnshureCachePersistance(copy.GetType()); }