예제 #1
0
        //public SaleLead RegisterSaleLead(int stateId, int customerId, int saleId)
        //{
        //    var lead = new SaleLead { StateId = stateId, CustomerId = customerId, SaleId = saleId };
        //    _repoSaleLead.Add(lead);
        //    return lead;
        //}

        public SalePositionLead AssignSalesEmployee(int employeeInSalesPositionId, int leadId)
        {
            var eip = _repoEmployeeInPosition.Get(employeeInSalesPositionId);
            var lead = _repoSaleLead.Get(leadId);
            var salesPositionLead = new SalePositionLead { EmployeeInSalePosition = (eip as EmployeeInSalePosition), SaleLead = lead };
            _repoSalePositionLead.Add(salesPositionLead);
            return salesPositionLead;
        }
예제 #2
0
        public SalePositionLead FindOrCreateSalePositionLead(Sale sale, CustomerDTO cus)
        {
            var empSaleSpec = new Specification <SalePositionLead>(s => s.SaleLead.Sale.Id == sale.Id);
            var emp         = _repoSalePositionLead.Find(empSaleSpec);

            if (emp == null)
            {
                var sa     = FindOrCreateSaleLead(cus, sale.OrderNumber, sale.Date, false);
                var sl     = _repoSaleLead.AsQueryable().FirstOrDefault(s => s.Sale.Id == sale.Id);
                var empPos = _repoEmployeeInPosition.GetEmployeeInSalePosition().FirstOrDefault(s => s.Position.Name == "Sales");
                emp = new SalePositionLead {
                    FinalisedSale = false, SaleLead = sl, SaleLeadId = sl.Id, EmployeeInSalePosition = empPos, EmployeeInSalePostionId = empPos.Id
                };
                _repoSalePositionLead.Add(emp);
            }
            return(emp);
        }