Beispiel #1
0
        protected virtual void EPEmployee_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            if (e.Operation != PXDBOperation.Delete)
            {
                LicenseHelper.CheckStaffMembersLicense(cache.Graph, epEmployeeRow.BAccountID, fsxEPEmployeeRow.SDEnabled, epEmployeeRow.Status);
            }

            fsxEPEmployeeRow.IsDriver = EmployeeDriverSkills.Select().Count > 0;

            Contact contactRow = Base.Contact.Current;

            if (contactRow != null)
            {
                if (fsxEPEmployeeRow.SendAppNotification == true && contactRow.EMail == null)
                {
                    if (Base.Contact.Cache.RaiseExceptionHandling <Contact.eMail>(contactRow, contactRow.EMail, new PXException(TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE)))
                    {
                        throw new PXRowPersistingException(typeof(Contact.eMail).Name, contactRow.EMail, TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE, typeof(Contact.eMail).Name);
                    }
                }
            }
        }
        public static IEnumerable DriverRecordsDelegate(PXGraph graph, SharedClasses.RouteSelected_view routeSelected, PXFilter <DriverSelectionFilter> filter)
        {
            if (routeSelected.Current == null)
            {
                yield break;
            }

            List <object>             args          = new List <object>();
            PXSelectBase <EPEmployee> commandFilter = new PXSelectJoinGroupBy <EPEmployee,
                                                                               InnerJoin <FSRouteEmployee,
                                                                                          On <
                                                                                              FSRouteEmployee.employeeID, Equal <EPEmployee.bAccountID> >,
                                                                                          LeftJoin <FSRouteDocument,
                                                                                                    On <
                                                                                                        FSRouteDocument.driverID, Equal <FSRouteEmployee.employeeID>,
                                                                                                        And <
                                                                                                            FSRouteDocument.date, Equal <Required <FSRouteDocument.date> > > > > >,
                                                                               Where <
                                                                                   FSRouteEmployee.routeID, Equal <Required <FSRouteEmployee.routeID> >,
                                                                                   And <
                                                                                       FSxEPEmployee.sDEnabled, Equal <True>,
                                                                                       And <
                                                                                           FSxEPEmployee.isDriver, Equal <True> > > >,
                                                                               Aggregate <
                                                                                   GroupBy <
                                                                                       EPEmployee.bAccountID> >,
                                                                               OrderBy <
                                                                                   Asc <FSRouteEmployee.priorityPreference> > >(graph);

            args.Add(routeSelected.Current.Date);
            args.Add(routeSelected.Current.RouteID);

            if (filter.Current.ShowUnassignedDrivers == true)
            {
                commandFilter.WhereAnd <Where <FSRouteDocument.routeID, IsNull> >();
            }

            var bqlResultSet = commandFilter.Select(args.ToArray());

            foreach (PXResult <EPEmployee, FSRouteEmployee, FSRouteDocument> bqlResult in bqlResultSet)
            {
                EPEmployee      epEmployeeRow      = (EPEmployee)bqlResult;
                FSRouteEmployee fsRouteEmployeeRow = (FSRouteEmployee)bqlResult;
                FSRouteDocument fsRouteDocumentRow = (FSRouteDocument)bqlResult;

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

                if (fsRouteDocumentRow != null && fsRouteDocumentRow.RouteID != null)
                {
                    fsxEPEmployeeRow.Mem_UnassignedDriver = true;
                }

                yield return(bqlResult);
            }
        }
Beispiel #3
0
        public virtual void EPEmployee_RowSelecting(PXCache cache, PXRowSelectingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            EmployeeSchedule.SetEnabled(fsxEPEmployeeRow.SDEnabled == true);
        }
Beispiel #4
0
        protected virtual void _(Events.RowSelected <EPEmployee> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            EnableDisableGrids((bool)fsxEPEmployeeRow.SDEnabled);
        }
Beispiel #5
0
        protected virtual void _(Events.RowSelecting <EPEmployee> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            EmployeeSchedule.SetEnabled(fsxEPEmployeeRow.SDEnabled == true);
        }
Beispiel #6
0
        public virtual void EPEmployee_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            EnableDisableGrids((bool)fsxEPEmployeeRow.SDEnabled);
            PXUIFieldAttribute.SetEnabled <FSxEPEmployee.sendAppNotification>(cache, epEmployeeRow, fsxEPEmployeeRow.SDEnabled == true);
        }
Beispiel #7
0
        public virtual void EPEmployee_SDEnabled_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            if (fsxEPEmployeeRow.SDEnabled == false)
            {
                fsxEPEmployeeRow.SendAppNotification = false;
            }
        }
        public virtual void addEmployee()
        {
            var graphEmployeeMaint = PXGraph.CreateInstance <EmployeeMaint>();

            graphEmployeeMaint.Insert.Press();

            FSxEPEmployee fsxEPEmployeeRow = graphEmployeeMaint.Employee.Cache.GetExtension <FSxEPEmployee>(graphEmployeeMaint.Employee.Current);

            fsxEPEmployeeRow.SDEnabled = true;

            throw new PXRedirectRequiredException(graphEmployeeMaint, null)
                  {
                      Mode = PXBaseRedirectException.WindowMode.NewWindow
                  };
        }
Beispiel #9
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);
                        }
                    }
                }
            }
        }
Beispiel #10
0
        protected virtual void _(Events.RowPersisting <EPEmployee> e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            if (e.Operation != PXDBOperation.Delete)
            {
                LicenseHelper.CheckStaffMembersLicense(e.Cache.Graph, epEmployeeRow.BAccountID, fsxEPEmployeeRow.SDEnabled, epEmployeeRow.Status);
            }

            fsxEPEmployeeRow.IsDriver = EmployeeDriverSkills.Select().Count > 0;
        }
Beispiel #11
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);
                        }
                    }
                }
            }
        }
Beispiel #12
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);
                    }
                }
            }
        }