예제 #1
0
        /// <summary>
        /// Add the EmailSource.
        /// </summary>
        private static void AddEmailSource(PXGraph graph, int?sourceEmailID, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            EMailAccount emailAccountRow = PXSelect <EMailAccount,
                                                     Where <
                                                         EMailAccount.emailAccountID, Equal <Required <EMailAccount.emailAccountID> > > >
                                           .Select(graph, sourceEmailID);

            if (emailAccountRow != null && emailAccountRow.Address != null)
            {
                recipient = new NotificationRecipient()
                {
                    Active = true,
                    Email  = emailAccountRow.Address,
                    Hidden = false,
                    Format = "H"
                };

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
예제 #2
0
        public void AddRecipientIfMissing(string emailAddress)
        {
            if (RecipientList.Contains(emailAddress))
            {
                return;
            }

            RecipientList.Add(emailAddress);
        }
예제 #3
0
        /// <summary>
        /// Add the Customer info as a recipient in the Email template generated by Appointment.
        /// </summary>
        private static void AddCustomerRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            Customer customerRow = PXSelect <Customer,
                                             Where <
                                                 Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                   .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.CustomerID);

            if (customerRow == null)
            {
                return;
            }

            FSxCustomer fsxCustomerRow = PXCache <Customer> .GetExtension <FSxCustomer>(customerRow);

            if (fsxCustomerRow.SendAppNotification == true)
            {
                if (graphAppointmentEntry.ServiceOrderRelated.Current.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = graphAppointmentEntry.ServiceOrderRelated.Current.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                }
                else
                {
                    Contact srvOrdContactRow = PXSelect <Contact,
                                                         Where <
                                                             Contact.contactID, Equal <Required <Contact.contactID> > > >
                                               .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.ContactID);

                    if (srvOrdContactRow != null && srvOrdContactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = srvOrdContactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                    }
                }

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Add the Employee(s) info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddEmployeeStaffRecipient(AppointmentEntry graphAppointmentEntry,
                                                      int?bAccountID,
                                                      string type,
                                                      NotificationRecipient recSetup,
                                                      RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            Contact contactRow = null;

            if (type == BAccountType.EmployeeType)
            {
                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <
                                                          BAccount.parentBAccountID, Equal <Contact.bAccountID>,
                                                          And <BAccount.defContactID, Equal <Contact.contactID> > > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <
                                                   BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }
            else if (type == BAccountType.VendorType)
            {
                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <
                                                          Contact.contactID, Equal <BAccount.defContactID> > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <
                                                   BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }

            if (contactRow != null && contactRow.EMail != null)
            {
                recipient = new NotificationRecipient()
                {
                    Active = true,
                    Email  = contactRow.EMail,
                    Hidden = recSetup.Hidden,
                    Format = recSetup.Format
                };

                if (recipient != null)
                {
                    recipients.Add(recipient);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Add the Employee email that has assigned the salesperson as a recipient in the Email template generated by Appointment.
        /// </summary>
        private static void AddSalespersonRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            bool?appNotification            = false;

            PXResult <SalesPerson, EPEmployee, BAccount, Contact> bqlResult =
                (PXResult <SalesPerson, EPEmployee, BAccount, Contact>) PXSelectJoin <SalesPerson,
                                                                                      InnerJoin <EPEmployee,
                                                                                                 On <EPEmployee.salesPersonID, Equal <SalesPerson.salesPersonID> >,
                                                                                                 InnerJoin <BAccount,
                                                                                                            On <BAccount.bAccountID, Equal <EPEmployee.bAccountID> >,
                                                                                                            InnerJoin <Contact,
                                                                                                                       On <BAccount.parentBAccountID, Equal <Contact.bAccountID>,
                                                                                                                           And <BAccount.defContactID, Equal <Contact.contactID> > > > > >,
                                                                                      Where <
                                                                                          SalesPerson.salesPersonID, Equal <Required <FSAppointment.salesPersonID> > > >
                .Select(graphAppointmentEntry, graphAppointmentEntry.AppointmentRecords.Current.SalesPersonID);

            Contact     contactRow     = (Contact)bqlResult;
            BAccount    baccountRow    = (BAccount)bqlResult;
            EPEmployee  epEmployeeRow  = (EPEmployee)bqlResult;
            SalesPerson SalespersonRow = (SalesPerson)bqlResult;

            if (epEmployeeRow != null && SalespersonRow != null)
            {
                FSxEPEmployee fsxEpEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                appNotification = fsxEpEmployeeRow.SendAppNotification;

                if (appNotification == true)
                {
                    if (contactRow != null && contactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = contactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                        if (recipient != null)
                        {
                            recipients.Add(recipient);
                        }
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Add the Employee info defined in the Notification tab defined in the <c>SrvOrdType</c> as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddEmployeeRecipient(PXGraph graph, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            bool?appNotification            = false;

            PXResult <Contact, BAccount, EPEmployee> bqlResult =
                (PXResult <Contact, BAccount, EPEmployee>) PXSelectJoin <Contact,
                                                                         InnerJoin <BAccount,
                                                                                    On <Contact.bAccountID, Equal <BAccount.parentBAccountID>,
                                                                                        And <Contact.contactID, Equal <BAccount.defContactID> > >,
                                                                                    InnerJoin <EPEmployee,
                                                                                               On <EPEmployee.bAccountID, Equal <BAccount.bAccountID> > > >,
                                                                         Where <
                                                                             Contact.contactID, Equal <Required <Contact.contactID> >,
                                                                             And <BAccount.type, Equal <Required <BAccount.type> > > > >
                .Select(graph, recSetup.ContactID, BAccountType.EmployeeType);

            Contact    contactRow    = (Contact)bqlResult;
            BAccount   baccountRow   = (BAccount)bqlResult;
            EPEmployee epEmployeeRow = (EPEmployee)bqlResult;

            if (epEmployeeRow != null)
            {
                FSxEPEmployee fsxEpEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                appNotification = fsxEpEmployeeRow.SendAppNotification;

                if (appNotification == true)
                {
                    if (contactRow != null && contactRow.EMail != null)
                    {
                        recipient = new NotificationRecipient()
                        {
                            Active = true,
                            Email  = contactRow.EMail,
                            Hidden = recSetup.Hidden,
                            Format = recSetup.Format
                        };
                        if (recipient != null)
                        {
                            recipients.Add(recipient);
                        }
                    }
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Add the Billing Customer info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddBillingRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            NotificationRecipient recipient = null;

            if (graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID != null)
            {
                Customer customerRow = PXSelect <Customer,
                                                 Where <
                                                     Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                       .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID);

                if (customerRow == null)
                {
                    return;
                }

                Contact contactRow = PXSelectJoin <Contact,
                                                   InnerJoin <Customer,
                                                              On <
                                                                  Contact.bAccountID, Equal <Customer.bAccountID>,
                                                                  And <Contact.contactID, Equal <Customer.defBillContactID> > > >,
                                                   Where <
                                                       Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                     .Select(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.BillCustomerID);

                if (contactRow != null && contactRow.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = contactRow.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                }
            }

            if (recipient != null)
            {
                recipients.Add(recipient);
            }
        }
예제 #8
0
 public MailMessage(EmailAddress InFrom, EmailAddress InTo)
 {
     ConstructCommon( );
     mFrom = InFrom;
     mToRecipients.Add(InTo);
 }
예제 #9
0
        /// <summary>
        /// Add the Employee(s) info as a recipient(s) in the Email template generated by Appointment.
        /// </summary>
        private static void AddEmployeeStaffRecipient(
            AppointmentEntry graphAppointmentEntry,
            int?bAccountID,
            string type,
            NotificationRecipient recSetup,
            RecipientList recipients)
        {
            NotificationRecipient recipient = null;
            bool?   appNotification         = false;
            Contact contactRow = null;

            if (type == BAccountType.EmployeeType)
            {
                EPEmployee epEmployeeRow = PXSelect <EPEmployee,
                                                     Where <
                                                         EPEmployee.bAccountID, Equal <Required <EPEmployee.bAccountID> > > >
                                           .Select(graphAppointmentEntry, bAccountID);

                FSxEPEmployee fsxEpEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                appNotification = fsxEpEmployeeRow.SendAppNotification;

                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <BAccount.parentBAccountID, Equal <Contact.bAccountID>,
                                                          And <BAccount.defContactID, Equal <Contact.contactID> > > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }
            else if (type == BAccountType.VendorType)
            {
                Vendor vendorRow = PXSelect <Vendor,
                                             Where <
                                                 Vendor.bAccountID, Equal <Required <Vendor.bAccountID> > > >
                                   .Select(graphAppointmentEntry, bAccountID);

                FSxVendor fsxVendorRow = PXCache <Vendor> .GetExtension <FSxVendor>(vendorRow);

                appNotification = fsxVendorRow.SendAppNotification;

                contactRow = PXSelectJoin <Contact,
                                           InnerJoin <BAccount,
                                                      On <Contact.contactID, Equal <BAccount.defContactID> > >,
                                           Where <
                                               BAccount.bAccountID, Equal <Required <BAccount.bAccountID> >,
                                               And <BAccount.type, Equal <Required <BAccount.type> > > > >
                             .Select(graphAppointmentEntry, bAccountID, type);
            }

            if (appNotification == true)
            {
                if (contactRow != null && contactRow.EMail != null)
                {
                    recipient = new NotificationRecipient()
                    {
                        Active = true,
                        Email  = contactRow.EMail,
                        Hidden = recSetup.Hidden,
                        Format = recSetup.Format
                    };
                    if (recipient != null)
                    {
                        recipients.Add(recipient);
                    }
                }
            }
        }