예제 #1
0
        /// <summary>
        /// Gets a list of Staff Members related to <c>filter.ServiceLineRef</c>.
        /// </summary>
        /// <param name="filter">Instance of the filter.</param>
        /// <param name="staffView">Current list of Staff Members in the grid.</param>
        /// <returns>A list of EPEmployee ready to be shown in the smartpanel.</returns>
        private static IEnumerable <BAccountStaffMember> GetStaffAvailableForSelect(PXFilter <StaffSelectionFilter> filter, object staffView)
        {
            PXResultset <BAccountStaffMember> bqlResultSet;

            List <int?> staffIDList = GetStaffByLineRefTab(staffView, filter.Current.ServiceLineRef);
            PXSelectBase <BAccountStaffMember> cmd = new StaffSelectionHelper.StaffRecords_View(filter.Cache.Graph);

            bqlResultSet = cmd.Select();

            var bAccountStaffMemberRowsGrouped = bqlResultSet.AsEnumerable().GroupBy(
                p => ((BAccountStaffMember)p).BAccountID,
                (key, group) => new
            {
                Group = (BAccountStaffMember)group.First()
            })
                                                 .Select(g => g.Group).ToList();

            foreach (BAccountStaffMember staffMemberRow in bAccountStaffMemberRowsGrouped)
            {
                if (staffIDList.Exists(delegate(int?staffMemberID) { return(staffMemberID == staffMemberRow.BAccountID); }) == true)
                {
                    staffMemberRow.Selected = true;
                }
                else
                {
                    staffMemberRow.Selected = false;
                }

                yield return(staffMemberRow);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets a list of Staff Members related to <c>filter.ServiceLineRef</c>.
        /// </summary>
        /// <param name="filter">Instance of the filter.</param>
        /// <param name="staffView">Current list of Staff Members in the grid.</param>
        /// <returns>A list of EPEmployee ready to be shown in the smartpanel.</returns>
        private static IEnumerable <BAccountStaffMember> GetStaffAvailableForSelect(PXFilter <StaffSelectionFilter> filter, object staffView)
        {
            PXResultset <BAccountStaffMember> bqlResultSet;

            List <int?> staffIDList = GetStaffByLineRefTab(staffView, filter.Current.ServiceLineRef);
            PXSelectBase <BAccountStaffMember> cmd = new StaffSelectionHelper.StaffRecords_View(filter.Cache.Graph);

            if (filter.Current.ExistContractEmployees == true)
            {
                cmd.Join <LeftJoin <EPEmployeeContract, On <EPEmployeeContract.employeeID, Equal <EPEmployee.bAccountID> > > >();
                cmd.WhereAnd <Where <EPEmployeeContract.contractID, Equal <Required <StaffSelectionFilter.projectID> > > >();
                bqlResultSet = cmd.Select(filter.Current.ProjectID);
            }
            else
            {
                bqlResultSet = cmd.Select();
            }

            var bAccountStaffMemberRowsGrouped = bqlResultSet.GroupBy(
                p => ((BAccountStaffMember)p).BAccountID,
                (key, group) => new
            {
                Group = (BAccountStaffMember)group.First()
            })
                                                 .Select(g => g.Group).ToList();

            foreach (BAccountStaffMember staffMemberRow in bAccountStaffMemberRowsGrouped)
            {
                if (staffIDList.Exists(delegate(int?staffMemberID) { return(staffMemberID == staffMemberRow.BAccountID); }) == true)
                {
                    staffMemberRow.Selected = true;
                }
                else
                {
                    staffMemberRow.Selected = false;
                }

                yield return(staffMemberRow);
            }
        }