Esempio n. 1
0
        /// <summary>
        /// Adds the Employee(s) belonging to the Appointment's Service Area as recipients in the Email template generated by Appointment.
        /// </summary>
        private static void AddGeoZoneStaffRecipient(AppointmentEntry graphAppointmentEntry, NotificationRecipient recSetup, RecipientList recipients)
        {
            List <FSGeoZoneEmp> geoZoneEmpList = new List <FSGeoZoneEmp>();

            if (graphAppointmentEntry.ServiceOrderRelated.Current.PostalCode != null)
            {
                FSGeoZonePostalCode fsGeoZoneRow = StaffSelectionHelper.GetMatchingGeoZonePostalCode(graphAppointmentEntry, graphAppointmentEntry.ServiceOrderRelated.Current.PostalCode);

                if (fsGeoZoneRow != null)
                {
                    var fsGeoZonePostalCodeSet = PXSelectJoin <FSGeoZonePostalCode,
                                                               InnerJoin <FSGeoZoneEmp,
                                                                          On <FSGeoZoneEmp.geoZoneID, Equal <FSGeoZonePostalCode.geoZoneID> > >,
                                                               Where <
                                                                   FSGeoZonePostalCode.postalCode, Equal <Required <FSGeoZonePostalCode.postalCode> > > >
                                                 .Select(graphAppointmentEntry, fsGeoZoneRow.PostalCode);

                    foreach (PXResult <FSGeoZonePostalCode, FSGeoZoneEmp> bqlResult in fsGeoZonePostalCodeSet)
                    {
                        geoZoneEmpList.Add((FSGeoZoneEmp)bqlResult);
                    }
                }
            }

            List <FSGeoZoneEmp> fsGeoZoneEmpGroupByEmployeeID = geoZoneEmpList.GroupBy(x => x.EmployeeID).Select(grp => grp.First()).ToList();

            if (fsGeoZoneEmpGroupByEmployeeID.Count > 0)
            {
                foreach (FSGeoZoneEmp fsGeoZoneEmpRow in fsGeoZoneEmpGroupByEmployeeID)
                {
                    AddEmployeeStaffRecipient(graphAppointmentEntry, fsGeoZoneEmpRow.EmployeeID, BAccountType.EmployeeType, recSetup, recipients);
                }
            }
        }
Esempio n. 2
0
        public void LaunchStaffSelector(PXGraph graph, PXFilter <StaffSelectionFilter> filter)
        {
            if (filter.Current.PostalCode != null && filter.Current.GeoZoneID == null)
            {
                FSGeoZonePostalCode fsGeoZoneRow = GetMatchingGeoZonePostalCode(graph, filter.Current.PostalCode);
                if (fsGeoZoneRow != null)
                {
                    filter.Current.GeoZoneID = fsGeoZoneRow.GeoZoneID;
                }
            }

            filter.Current.ExistContractEmployees = this.ExistContractEmployees(filter.Cache.Graph, filter.Current.ProjectID);
            filter.AskExt();
        }
Esempio n. 3
0
 public virtual void EnableDisableGeoZonePostalCode(PXCache cache, FSGeoZonePostalCode fsGeoZonePostalCodeRow)
 {
     PXUIFieldAttribute.SetEnabled <FSGeoZonePostalCode.postalCode>
         (cache, fsGeoZonePostalCodeRow, string.IsNullOrEmpty(fsGeoZonePostalCodeRow.PostalCode));
 }