private void Proccess()
 {
     using (new PXScreenIDScope("CR306015"))
     {
         try
         {
             if (CreateMessage())
             {
                 ProcessMessage();
             }
         }
         finally
         {
             _graph.Clear();
             _activity = null;
             if (_activityMessage != null)
             {
                 _message.Exception = _activityMessage.Exception;
                 _message.MPStatus  = _activityMessage.MPStatus;
             }
             _message         = null;
             _activityMessage = null;
         }
     }
 }
Exemplo n.º 2
0
        protected virtual void cancelActivity()
        {
            CRActivity row = Events.Current;

            if (row == null)
            {
                return;
            }

            if (row.OwnerID != Accessinfo.UserID)
            {
                throw new PXException(Messages.EventNonOwned, row.Subject);
            }
            if (row.UIStatus == ActivityStatusListAttribute.Completed || row.UIStatus == ActivityStatusListAttribute.Canceled)
            {
                throw new PXException(Messages.EventInStatus, row.Subject, new ActivityStatusListAttribute().ValueLabelDic[row.UIStatus]);
            }

            PXLongOperation.StartOperation(this, delegate
            {
                EPEventMaint graph   = CreateInstance <EPEventMaint>();
                graph.Events.Current = graph.Events.Search <CRActivity.noteID>(row.NoteID);
                graph.CancelActivity.Press();
            });
        }
Exemplo n.º 3
0
        public IEnumerable AddMailActivity(PXAdapter adapter, string emailAddress)
        {
            if (!IsCurrentRedy)
            {
                return(adapter.Get());
            }
            PrepareGraph();

            CRActivityMaint graph    = CreateSpecGraph <CRActivityMaint>();
            CRActivity      activity = CreateActivity();
            CRSetup         setup    = PXSelect <CRSetup> .Select(this.Graph);

            activity.Type           = setup.EMailActivityType;
            activity.Status         = ActivityStatus.NotStarted;
            graph.Activites.Current = graph.Activites.Insert(activity);
            PXAdapter mailCreate = new PXAdapter(graph.Activites);

            mailCreate.StartRow    = 0;
            mailCreate.MaximumRows = 1;
            foreach (object e in graph.CreateMail.Press(mailCreate))
            {
                ;
            }
            if (!string.IsNullOrEmpty(emailAddress))
            {
                graph.Message.Current.MailTo = emailAddress;
            }

            throw new PXPopupRedirectException(true, graph, Messages.CRActivityMaint);
        }
Exemplo n.º 4
0
        public CRActivity CreateActivity()
        {
            CRActivity addedActivity = CreateSpecActivity <CRActivity>();

            addedActivity.Status = ActivityStatus.Completed;
            return(addedActivity);
        }
Exemplo n.º 5
0
        public virtual void UpdateServiceOrderDetail(PXCache cache, CRActivity crActivityRow, PXDBOperation operation)
        {
            FSServiceOrder fsServiceOrderRow = GetServiceOrderRecord(cache.Graph, crActivityRow);

            if (fsServiceOrderRow != null)
            {
                PMTimeActivity pmTimeActivityRow = PXSelect <PMTimeActivity,
                                                             Where <
                                                                 PMTimeActivity.refNoteID, Equal <Required <PMTimeActivity.refNoteID> > > >
                                                   .Select(Base, crActivityRow.NoteID);

                if (pmTimeActivityRow == null)
                {
                    return;
                }

                FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

                ServiceOrderEntry graphServiceOrder = PXGraph.CreateInstance <ServiceOrderEntry>();

                //Load existing ServiceOrder
                graphServiceOrder.ServiceOrderRecords.Current = graphServiceOrder.ServiceOrderRecords
                                                                .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);

                //Update ServiceOrder detail
                InsertUpdateDeleteSODet(graphServiceOrder, pmTimeActivityRow, fsxPMTimeActivityRow, operation);

                if (graphServiceOrder.IsDirty)
                {
                    graphServiceOrder.Save.Press();
                }
            }
        }
Exemplo n.º 6
0
        private void FillOrganizer(vEvent card, CRActivity row)
        {
            InfoSelect.View.Clear();
            var set = InfoSelect.Select(row.NoteID);

            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 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);
            }
Exemplo n.º 8
0
 private void followUpTask()
 {
     try
     {
         //out-of-box Activities -> "New Task" Action
         Base.Actions["NewTask"].Press();
     }
     catch (Exception ex)
     {
         if (ex is PXRedirectRequiredException)
         {
             CRTaskMaint graph = (ex as PXRedirectRequiredException).Graph as CRTaskMaint;
             if (graph != null)
             {
                 CRActivity myTask = graph.Tasks.Current;
                 myTask.Subject = String.Format("FollowUp Lead Test");
                 myTask.ClassID = 0;
                 DateTime dueDate = DateTime.Now;
                 myTask.StartDate = dueDate;
                 myTask.EndDate   = dueDate.AddDays(10);
                 CRActivity task = graph.Tasks.Update(myTask);
                 graph.Actions.PressSave();
             }
         }
     }
 }
Exemplo n.º 9
0
        private void CreateTwilioNotificationActivity(ARInvoiceEntry invGraph, string Subject, string MessageBody)
        {
            try
            {
                invGraph.Actions["NewActivity"].Press();
            }
            catch (Exception ex)
            {
                if (ex is PXRedirectRequiredException)
                {
                    try
                    {
                        CRActivityMaint graph = (ex as PXRedirectRequiredException).Graph as CRActivityMaint;
                        if (graph != null)
                        {
                            CRActivity callActivity = graph.Activities.Current;
                            callActivity.Type    = "P";
                            callActivity.Subject = Subject;
                            callActivity.Body    = MessageBody;
                            callActivity         = graph.Activities.Update(callActivity);

                            graph.Actions.PressSave();
                        }
                    }
                    catch (Exception graphErr)
                    {
                        throw graphErr;
                    }
                }
            }
        }
Exemplo n.º 10
0
        protected virtual void MarkAs(PXCache cache, CRActivity row, Guid UserID, int status)
        {
            if (IsImport || row.NoteID == null)
            {
                return;
            }

            var noteidType = typeof(TMaster).GetNestedType(typeof(CRActivity.noteID).Name);
            var ownerType  = typeof(TMaster).GetNestedType(typeof(CRActivity.ownerID).Name);

            var select = BqlCommand.Compose(
                typeof(Select <,>), typeof(EPView), typeof(Where <, ,>),
                typeof(EPView.noteID), typeof(Equal <>), typeof(Required <>), noteidType,
                typeof(And <,>), typeof(EPView.userID), typeof(Equal <>), typeof(Required <>), ownerType
                );

            EPView epview = (EPView) new PXView(this, false,
                                                BqlCommand.CreateInstance(select)).SelectSingle(row.NoteID, UserID);

            if (epview == null)
            {
                epview = new EPView
                {
                    NoteID = row.NoteID,
                    UserID = UserID,
                };
            }
            else
            {
                epview = PXCache <EPView> .CreateCopy(epview);
            }

            if (status == EPViewStatusAttribute.VIEWED
                                        ? epview.Status != EPViewStatusAttribute.VIEWED
                                        : epview.Status == EPViewStatusAttribute.VIEWED)
            {
                epview.Status = status;
                EPViews.Update(epview);

                bool isDirty = false;
                foreach (PXCache c in Views.Caches.Where(t => t != typeof(EPView)).Select(t => Caches[t]))
                {
                    isDirty = c.Inserted.ToArray <object>().Any() || c.Updated.ToArray <object>().Any() || c.Deleted.ToArray <object>().Any();
                    if (isDirty)
                    {
                        break;
                    }
                }
                if (!isDirty)
                {
                    using (PXTransactionScope ts = new PXTransactionScope())
                    {
                        Persist();
                        ts.Complete();
                    }
                }
                EPViews.Cache.IsDirty = false;
            }
        }
Exemplo n.º 11
0
        public virtual IEnumerable createAP(PXAdapter adapter)
        {
            UploadFileRevision file = PXSelectJoin <UploadFileRevision,
                                                    InnerJoin <UploadFile,
                                                               On <UploadFileRevision.fileID, Equal <UploadFile.fileID>,
                                                                   And <UploadFileRevision.fileRevisionID, Equal <UploadFile.lastRevisionID> > >,
                                                               InnerJoin <NoteDoc,
                                                                          On <NoteDoc.fileID, Equal <UploadFile.fileID> > > >,
                                                    Where <NoteDoc.noteID, Equal <Required <CRSMEmail.noteID> >,
                                                           And <UploadFile.name, Like <pdfExtension> > >,
                                                    OrderBy <Desc <UploadFileRevision.createdDateTime> > > .Select(Base, Base.Emails.Current.NoteID);

            string url = null;

            if (file != null)
            {
                string rooturl;

                if (HttpContext.Current == null)
                {
                    rooturl = string.Empty;
                }

                var applicationpath = string.IsNullOrEmpty(HttpContext.Current.Request.ApplicationPath)
                                        ? string.Empty
                                        : HttpContext.Current.Request.ApplicationPath + "/";
                rooturl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + applicationpath;

                url = string.Concat(rooturl != null ? rooturl : string.Empty, HandlerURL, file.FileID.GetValueOrDefault(Guid.Empty).ToString("D"));

                CRSMEmail email = Base.Emails.Current;

                APInvoiceEntryPXInhExt graph = PXGraph.CreateInstance <APInvoiceEntryPXInhExt>();
                graph.Clear();
                APInvoice doc = (APInvoice)graph.Document.Cache.CreateInstance();
                doc.GetExtension <APInvoiceExt>().UsrFileURL = url;
                doc.LineCntr = 0;
                TryFillValuesFromPDF(graph.Document.Cache, doc, Base.Emails.Cache, email);
                doc = graph.Document.Insert(doc);

                (email).Selected = false;
                CRSMEmail copy = PXCache <CRSMEmail> .CreateCopy(email);

                CRActivity newActivity = (CRActivity)graph.Caches[typeof(CRActivity)].Insert();

                copy.BAccountID = newActivity.BAccountID;
                copy.ContactID  = newActivity.ContactID;
                copy.RefNoteID  = newActivity.RefNoteID;
                copy.MPStatus   = MailStatusListAttribute.Processed;
                copy.Exception  = null;
                PXRefNoteSelectorAttribute.EnsureNotePersistence(Base, Base.entityFilter.Current.Type, Base.entityFilter.Current.RefNoteID);
                copy = Base.Emails.Update(copy);
                Base.Save.Press();

                PXNoteAttribute.CopyNoteAndFiles(Base.Emails.Cache, Base.Emails.Current, graph.Document.Cache, doc);
                PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
            }
            return(adapter.Get());
        }
        protected virtual void CRActivity_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {
            if (e.TranStatus == PXTranStatus.Open)
            {
                CRActivity crActivityRow = (CRActivity)e.Row;

                UpdateServiceOrderDetail(cache, crActivityRow, e.Operation);
            }
        }
        public static string GetDescription(CRActivity activity, PXGraph graph)
        {
            var entityHelper = new EntityHelper(graph);
            var commitment   = entityHelper.GetEntityRow(activity.RefNoteID) as POOrder;

            return(commitment?.OrderType == POOrderType.RegularSubcontract
                ? GetEntityDescription(entityHelper, commitment, graph)
                : null);
        }
Exemplo n.º 14
0
        protected virtual void _(Events.RowPersisted <CRActivity> e)
        {
            if (e.TranStatus == PXTranStatus.Open &&
                PXAccess.FeatureInstalled <FeaturesSet.timeReportingModule>())
            {
                CRActivity crActivityRow = (CRActivity)e.Row;

                UpdateServiceOrderDetail(e.Cache, crActivityRow, e.Operation);
            }
        }
Exemplo n.º 15
0
        protected virtual void gotoEntity()
        {
            CRActivity row = (CRActivity)Caches[typeof(CRActivity)].Current;

            if (row == null)
            {
                return;
            }

            new EntityHelper(this).NavigateToRow(row.RefNoteID, PXRedirectHelper.WindowMode.NewWindow);
        }
Exemplo n.º 16
0
        private static void ProcessValidation(PXGraph graph, Contact record, ValidationFilter Filter)
        {
            Type    itemType = record.GetType();
            PXCache cache    = PXGraph.CreateInstance <PXGraph>().Caches[itemType];
            Type    graphType;
            object  copy = cache.CreateCopy(record);

            PXPrimaryGraphAttribute.FindPrimaryGraph(cache, ref copy, out graphType);

            if (graphType == null)
            {
                throw new PXException(Messages.UnableToFindGraph);
            }

            graph = PXGraph.CreateInstance(graphType);


            graph.Views[graph.PrimaryView].Cache.Current = copy;

            CRDuplicateEntities <PXGraph, Contact> .RunActionWithAppliedAutomation(
                graph,
                copy,
                nameof(CRDuplicateEntities <PXGraph, Contact> .CheckForDuplicates));

            DuplicateDocument document = graph.Caches[typeof(DuplicateDocument)].Current as DuplicateDocument;

            record.DuplicateStatus = document?.DuplicateStatus;
            record.DuplicateFound  = document?.DuplicateFound;

            var maxScore = graph
                           .Caches[typeof(CRDuplicateRecord)]
                           .Cached
                           .Cast <CRDuplicateRecord>()
                           .Max(_ => _?.Score) ?? 0;

            if (record.DuplicateStatus == DuplicateStatusAttribute.PossibleDuplicated &&
                record.ContactType == ContactTypesAttribute.Lead
                //&& record.Status == LeadStatusesAttribute.New
                && Filter.CloseNoActivityLeads == true &&
                maxScore > Filter.CloseThreshold)
            {
                CRActivity activity = PXSelect <CRActivity,
                                                Where <CRActivity.refNoteID, Equal <Required <Contact.noteID> > > > .SelectWindowed(graph, 0, 1, record.NoteID);

                if (activity == null)
                {
                    CRDuplicateEntities <PXGraph, Contact> .RunActionWithAppliedAutomation(
                        graph,
                        copy,
                        nameof(CRDuplicateEntities <PXGraph, Contact> .CloseAsDuplicate));
                }
            }
        }
        protected virtual void CRActivity_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            CRActivity row = (CRActivity)e.Row;

            if (row != null)
            {
                var isEditable = row.Status != ActivityStatusListAttribute.Completed &&
                                 row.Status != ActivityStatusListAttribute.Canceled;
                this.CompleteActivity.SetEnabled(isEditable);
                this.CancelActivity.SetEnabled(isEditable);
            }
        }
Exemplo n.º 18
0
        public IEnumerable AddActivity(PXAdapter adapter)
        {
            if (!IsCurrentRedy)
            {
                return(adapter.Get());
            }
            PrepareGraph();

            CRActivityMaint graph = CreateSpecGraph <CRActivityMaint>();
            CRActivity      var1  = CreateActivity();

            graph.Activites.Current = graph.Activites.Insert(var1);
            throw new PXPopupRedirectException(true, graph, Messages.CRActivityMaint);
        }
Exemplo n.º 19
0
        protected virtual IEnumerable viewEntity(PXAdapter adapter)
        {
            var row = Emails.Current;

            if (row != null)
            {
                CRActivity activity = PXSelect <CRActivity, Where <CRActivity.noteID, Equal <Required <CRActivity.noteID> > > > .SelectSingleBound(this, null, row.RefNoteID);

                if (activity != null)
                {
                    new EntityHelper(this).NavigateToRow(activity.RefNoteID, PXRedirectHelper.WindowMode.New);
                }
            }
            return(adapter.Get());
        }
Exemplo n.º 20
0
        protected void gotoParentActivity()
        {
            CRActivity row = (CRActivity)Caches[typeof(CRActivity)].Current;

            if (row == null || row.ParentNoteID == null)
            {
                return;
            }

            CRActivity parentActivity = PXSelect <CRActivity,
                                                  Where <CRActivity.noteID, Equal <Required <CRActivity.noteID> > > > .Select(this, row.ParentNoteID);

            if (parentActivity != null && parentActivity.NoteID != null)
            {
                new EntityHelper(this).NavigateToRow(parentActivity.NoteID, PXRedirectHelper.WindowMode.NewWindow);
            }
        }
    private void followUpTask()
    {
        CRTaskMaint graph  = PXGraph.CreateInstance <CRTaskMaint>();
        CRActivity  myTask = new CRActivity();

        myTask.Subject = String.Format("FollowUp Lead Test");
        myTask.ClassID = 0;
        DateTime dueDate = DateTime.Now;

        myTask.StartDate = dueDate;
        myTask.EndDate   = dueDate.AddDays(10);
        myTask.RefNoteID = Base.Lead.Current.NoteID;
        myTask.ContactID = Base.Lead.Current.ContactID;
        CRActivity task = (CRActivity)graph.Tasks.Insert(myTask);

        graph.Actions.PressSave();
    }
Exemplo n.º 22
0
        public virtual IEnumerable relate(PXAdapter adapter)
        {
            bool lint = entityFilter.AskExt() == WebDialogResult.OK && entityFilter.VerifyRequired();

            if (lint)
            {
                PXCache       cache            = this.Caches <CRSMEmail>();
                RelatedEntity relatedEntity    = entityFilter.Current;
                EntityHelper  helper           = new EntityHelper(this);
                Type          entityType       = PXBuildManager.GetType(relatedEntity.Type, false);
                object        row              = helper.GetEntityRow(entityType, relatedEntity.RefNoteID);
                Type          graphType        = helper.GetPrimaryGraphType(row, false);
                Type          actualEntityType = PXSubstManager.Substitute(entityType, graphType);
                object        actualRow        = helper.GetEntityRow(actualEntityType, relatedEntity.RefNoteID);
                PXGraph       graph            = PXGraph.CreateInstance(graphType);
                graph.Caches[actualEntityType].Current = actualRow;
                foreach (PXResult <CRSMEmail, EMailAccount, EPView> email in SelectedList())
                {
                    ((CRSMEmail)email).Selected = false;
                    CRSMEmail copy = PXCache <CRSMEmail> .CreateCopy(email);

                    CRActivity newActivity = (CRActivity)graph.Caches[typeof(CRActivity)].Insert();

                    copy.BAccountID = newActivity.BAccountID;
                    copy.ContactID  = newActivity.ContactID;
                    copy.RefNoteID  = newActivity.RefNoteID;
                    copy.MPStatus   = MailStatusListAttribute.Processed;
                    copy.Exception  = null;
                    PXRefNoteSelectorAttribute.EnsureNotePersistence(this, entityFilter.Current.Type, entityFilter.Current.RefNoteID);
                    copy = (CRSMEmail)cache.Update(copy);
                }
                Save.Press();
            }
            else
            {
                entityFilter.Ask(Messages.Warning, Messages.SelectRecord, MessageButtons.OK);
            }

            Emails.Cache.IsDirty = false;
            Emails.Cache.Clear();
            Emails.Cache.ClearQueryCacheObsolete();
            Emails.View.RequestRefresh();
            return(adapter.Get());
        }
Exemplo n.º 23
0
        public void MyPut(string phoneNumber)
        {
            CRSetupExt ext = setup.Current.GetExtension <CRSetupExt>();
            string     url = ext.UsrVOIPUrl;

            EPEmployee employee = PXSelect <EPEmployee,
                                            Where <EPEmployee.userID, Equal <Required <EPEmployee.userID> > > > .Select(Base, Base.Accessinfo.UserID);

            BAccountExt baccountExtension = employee.GetExtension <BAccountExt>();
            string      phoneExt          = baccountExtension.UsrPhoneExtension;

            HttpClient client = new HttpClient(
                new HttpClientHandler
            {
                UseCookies      = true,
                CookieContainer = new CookieContainer()
            })
            {
                BaseAddress           = new Uri("http://" + url + "/"),
                DefaultRequestHeaders =
                {
                    Accept = { MediaTypeWithQualityHeaderValue.Parse("text/json") }
                }
            };

            var response = client.PostAsync("http://" + url + "/call.php?exten=" + phoneExt + "&number=" + phoneNumber,
                                            new StringContent("", System.Text.Encoding.UTF8, "application/json")).Result;
            var content = response.Content.ReadAsStringAsync().Result;

            response.EnsureSuccessStatusCode();


            CRActivityMaint graph    = PXGraph.CreateInstance <CRActivityMaint>();
            CRActivity      activity = new CRActivity();

            activity           = graph.Activities.Insert(activity);
            activity.Type      = "P";
            activity.Subject   = "Outbound Call";
            activity.OwnerID   = employee.UserID;
            activity.RefNoteID = Base.ContactCurrent.Current.NoteID;
            graph.Activities.Update(activity);

            PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
        }
 private FSServiceOrder GetServiceOrderRecord(PXGraph graph, CRActivity crActivityRow)
 {
     return((FSServiceOrder)
            PXSelectJoin <FSServiceOrder,
                          LeftJoin <CRCase,
                                    On <
                                        CRCase.caseID, Equal <FSServiceOrder.sourceID>,
                                        And <FSServiceOrder.sourceType, Equal <FSServiceOrder.sourceType.Case> > >,
                                    LeftJoin <CROpportunity,
                                              On <
                                                  CROpportunity.opportunityID, Equal <FSServiceOrder.sourceRefNbr>,
                                                  And <FSServiceOrder.sourceType, Equal <FSServiceOrder.sourceType.Opportunity> > >,
                                              InnerJoin <CRActivity,
                                                         On <
                                                             CRActivity.refNoteID, Equal <CRCase.noteID>,
                                                             Or <CRActivity.refNoteID, Equal <CROpportunity.noteID> > > > > >,
                          Where <
                              CRActivity.noteID, Equal <Required <CRActivity.noteID> > > >
            .Select(graph, crActivityRow.NoteID));
 }
        private void UpdateSubject(PXCache cache, PMTimeActivity pmTimeActivityRow, CRActivity crActivityRow)
        {
            FSxPMTimeActivity fsxPMTimeActivityRow = cache.GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

            //Clean the Subject
            if (crActivityRow.Subject != null)
            {
                int positionPipe = crActivityRow.Subject.IndexOf("|");

                if (positionPipe != -1)
                {
                    crActivityRow.Subject = crActivityRow.Subject.Substring(positionPipe + 1).Trim();

                    if (crActivityRow.Subject == string.Empty)
                    {
                        crActivityRow.Subject = null;
                    }
                }
            }

            if (fsxPMTimeActivityRow.ServiceID != null)
            {
                InventoryItem inventoryItemRow = PXSelect <InventoryItem,
                                                           Where <
                                                               InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > >
                                                 .Select(Base, fsxPMTimeActivityRow.ServiceID);

                if (inventoryItemRow != null)
                {
                    if (inventoryItemRow.ItemType == INItemTypes.ServiceItem)
                    {
                        if (string.IsNullOrWhiteSpace(crActivityRow.Subject))
                        {
                            crActivityRow.Subject = string.Empty;
                        }

                        crActivityRow.Subject = TX.ModuleName.SERVICE_DESCRIPTOR + inventoryItemRow.Descr + " | " + crActivityRow.Subject;
                    }
                }
            }
        }
Exemplo n.º 26
0
        private static void FillCommon(vEvent card, CRActivity 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       = "ACUMATICA_" + row.NoteID;
        }
Exemplo n.º 27
0
        protected virtual void MarkAs(PXCache cache, CRActivity row, Guid UserID, int status)
        {
            if (IsImport || row.NoteID == null)
            {
                return;
            }

            var epviewSelect = new SelectFrom <EPView>
                               .Where <EPView.noteID.IsEqual <@P.AsGuid>
                                       .And <EPView.userID.IsEqual <@P.AsGuid> > >
                               .View(this);

            EPView epview = epviewSelect
                            .Select(row.NoteID, UserID)
                            .FirstOrDefault();

            bool dirty = EPViews.Cache.IsDirty;

            if (epview == null)
            {
                var epView = EPViews.Cache.Insert(
                    new EPView
                {
                    NoteID = row.NoteID,
                    UserID = UserID,
                    Status = status,
                }
                    );

                EPViews.Cache.PersistInserted(epView);
                epviewSelect.View.Clear();
                EPViews.Cache.SetStatus(epView, PXEntryStatus.Notchanged);
            }
            else if (status != epview.Status)
            {
                epview.Status = status;
                EPViews.Cache.PersistUpdated(epview);
            }
            EPViews.Cache.IsDirty = dirty;
        }
Exemplo n.º 28
0
        private void FillAttendee(vEvent card, CRActivity row)
        {
            OtherAttendees.View.Clear();
            foreach (EPOtherAttendeeWithNotification otherAttendee in OtherAttendees.Select(row.NoteID))
            {
                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.NoteID))
            {
                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));
            }
        }
        protected virtual void EPActivityApprove_Hold_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            EPActivityApprove row = (EPActivityApprove)e.Row;

            if (row == null)
            {
                return;
            }

            if (row.ApprovalStatus == ActivityStatusListAttribute.Approved)
            {
                cache.RaiseExceptionHandling <EPActivityApprove.hold>(row, null, new PXSetPropertyException(Messages.Approved, PXErrorLevel.RowWarning));
            }
            if (row.RefNoteID != null)
            {
                CRActivity parent = (CRActivity)Parent.View.SelectSingleBound(new[] { row });
                if (parent != null)
                {
                    parent.UIStatus = row.Hold == true ? ActivityStatusListAttribute.Open : ActivityStatusListAttribute.Completed;
                    Parent.Update(parent);
                }
            }
        }
Exemplo n.º 30
0
    protected void grid_RowDataBound(object sender, PX.Web.UI.PXGridRowEventArgs e)
    {
        PXResult record = e.Row.DataItem as PXResult;

        if (record == null)
        {
            return;
        }

        EPView viewInfo = (EPView)record[typeof(EPView)];
        bool   isBold   = viewInfo != null && (viewInfo.Status == null || viewInfo.Status == EPViewStatusAttribute.NOTVIEWED);

        CRActivity item = (CRActivity)record[typeof(CRActivity)];

        if (isBold)
        {
            e.Row.Style.CssClass = "BaseBold";
        }
        if (item.CategoryID != null && coloredCategories.Contains(item.CategoryID ?? 0))
        {
            if (item.IsOverdue == true)
            {
                e.Row.Style.CssClass = (isBold ? "CssBoldOver" : "CssOver") + item.CategoryID;
            }
            else
            {
                e.Row.Style.CssClass = (isBold ? "CssBold" : "Css") + item.CategoryID;
            }
        }
        else
        {
            if (item.IsOverdue == true)
            {
                e.Row.Style.CssClass = (isBold ? "CssOverdueBold" : "CssOverdue");
            }
        }
    }