public bool AssignUserToServiceRequestHdr(string serviceRequestHdrId) { UserId.IsNullOrWhiteSpaceThrowException("Not logged in"); serviceRequestHdrId.IsNullOrWhiteSpaceThrowArgumentException(); ServiceRequestHdr srh = ServiceRequestHdrBiz.Find(serviceRequestHdrId); srh.IsNullThrowException(); if (srh.ServiceRequestStatusEnum == ServiceRequestStatusENUM.Open) { //Person userPerson = PersonBiz.GetPersonForUserId(UserId); //userPerson.IsNullThrowException(); srh.PersonToId = CurrentUserParameter.PersonId; srh.ServiceRequestStatusEnum = ServiceRequestStatusENUM.Closed; ServiceRequestHdrBiz.Update(srh); PenaltyHeader ph = setupPenaltyHeaderForServiceRequestDetail(srh); } else { throw new Exception("This item is not open"); } return(true); }
public void CreateAnIWantToBeASalesmanEntry(string UserId) { //get the person if (CurrentUserParameter.IsSalesman) { throw new Exception("You are already a salesman!"); } decimal costToBecomeASalesman = SuperBiz.GetCostToBecomeASalesman(); ServiceRequestHdrBiz.CreateAnIWantToBeASalesmanEntry( CurrentUserParameter.PersonId, CurrentUserParameter.SystemPersonId, costToBecomeASalesman); }
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); }