示例#1
0
        public List <ServiceRequestVM> GetListOfPeopleWantingJobs()
        {
            //just get those jobs that are withing the users expertise.
            List <ServiceRequestHdr> allServiceHeaders    = new List <ServiceRequestHdr>();
            List <ServiceRequestHdr> salesmenRequestsOnly = new List <ServiceRequestHdr>();
            List <ServiceRequestHdr> mailerRequestsOnly   = new List <ServiceRequestHdr>();
            List <ServiceRequestHdr> sellerRequestsOnly   = new List <ServiceRequestHdr>();
            List <ServiceRequestHdr> customerRequestsOnly = new List <ServiceRequestHdr>();

            IQueryable <ServiceRequestHdr> allIq       = ServiceRequestHdrBiz.FindAll().Where(x => x.ServiceRequestStatusEnum == ServiceRequestStatusENUM.Open);
            List <ServiceRequestHdr>       allIq_DEBUG = allIq.ToList();

            sellerRequestsOnly   = allIq.Where(x => x.RequestTypeEnum == ServiceRequestTypeENUM.BecomeSeller).ToList();
            customerRequestsOnly = allIq.Where(x => x.RequestTypeEnum == ServiceRequestTypeENUM.BecomeCustomer).ToList();

            if (CurrentUserParameter.IsSuperSalesman || CurrentUserParameter.IsAdmin)
            {
                salesmenRequestsOnly = allIq.Where(x => x.RequestTypeEnum == ServiceRequestTypeENUM.BecomeSalesman).ToList();
            }

            if (CurrentUserParameter.IsMailer || CurrentUserParameter.IsAdmin)
            {
                mailerRequestsOnly = allIq.Where(x => x.RequestTypeEnum == ServiceRequestTypeENUM.BecomeMailer).ToList();
            }

            //Concat

            if (!salesmenRequestsOnly.IsNullOrEmpty())
            {
                allServiceHeaders = allServiceHeaders.Concat(salesmenRequestsOnly).ToList();
            }

            if (!mailerRequestsOnly.IsNullOrEmpty())
            {
                allServiceHeaders = allServiceHeaders.Concat(mailerRequestsOnly).ToList();
            }

            if (!sellerRequestsOnly.IsNullOrEmpty())
            {
                allServiceHeaders = allServiceHeaders.Concat(sellerRequestsOnly).ToList();
            }

            if (!customerRequestsOnly.IsNullOrEmpty())
            {
                allServiceHeaders = allServiceHeaders.Concat(customerRequestsOnly).ToList();
            }

            if (allServiceHeaders.IsNullOrEmpty())
            {
                return(new List <ServiceRequestVM>());
            }

            List <ServiceRequestVM> lstOfPplWantingJobs = new List <ServiceRequestVM>();

            foreach (ServiceRequestHdr srh in allServiceHeaders)
            {
                ServiceRequestVM srvm = new ServiceRequestVM(
                    srh.Id,
                    srh.MetaData.Created.Date_NotNull_Min,
                    srh.PersonFrom.FullName(),
                    srh.RequestTypeEnum);

                lstOfPplWantingJobs.Add(srvm);
            }
            return(lstOfPplWantingJobs);
        }
示例#2
0
 public FrmServiceRequest()
 {
     InitializeComponent();
     BindingContext = vm = new ServiceRequestVM();
 }