コード例 #1
0
        public static List <WaitingRoomNode> GetWaitingRoomNodes(GetCustomerWaitingRoomRequest request)
        {
            var customers = Exigo.OData().Customers
                            .Where(c => c.EnrollerID == request.EnrollerID)
                            .Where(c => c.SponsorID == null)
                            .Where(c => c.CustomerStatusID == (int)CustomerStatusTypes.Active)
                            .Where(c => c.CustomerTypeID == (int)CustomerTypes.Distributor)
                            .ToList();

            var nodes = new List <WaitingRoomNode>();

            foreach (var customer in customers)
            {
                var node = new WaitingRoomNode();
                node.CustomerID     = customer.CustomerID;
                node.Email          = customer.Email;
                node.EnrollerID     = customer.EnrollerID;
                node.EnrollmentDate = customer.CreatedDate;
                node.FirstName      = customer.FirstName;
                node.LastName       = customer.LastName;
                node.Phone          = customer.Phone;

                nodes.Add(node);
            }
            return(nodes);
        }
コード例 #2
0
        public static IEnumerable <WaitingRoomNode> GetCustomerWaitingRoom(GetCustomerWaitingRoomRequest request)
        {
            var customers = Exigo.OData().EnrollerTree
                            .Where(c => c.TopCustomerID == request.EnrollerID)
                            .Where(c => c.Customer.SponsorID == null)
                            .Where(c => c.Customer.CustomerStatusID == CustomerStatuses.Active)
                            .Where(c => c.Customer.Field1 == string.Empty)
                            .OrderByDescending(c => c.Customer.CreatedDate)
                            .Select(c => new WaitingRoomNode()
            {
                CustomerID     = c.CustomerID,
                FirstName      = c.Customer.FirstName,
                LastName       = c.Customer.LastName,
                EnrollerID     = c.EnrollerID,
                EnrollmentDate = c.Customer.CreatedDate,
                City           = c.Customer.MainCity,
                State          = c.Customer.MainState,
                Country        = c.Customer.MainCountry,
                Phone          = c.Customer.Phone,
                Email          = c.Customer.Email
            })
                            .ToList();

            // Filter out the customer that are no longer placeable
            customers = customers.Where(c => c.EnrollmentDate.AddDays(request.GracePeriod) > DateTime.Now).ToList();

            return(customers);
        }
コード例 #3
0
ファイル: Trees.cs プロジェクト: Webalap/W-ALAP
        public static IEnumerable <WaitingRoomNode> GetCustomerWaitingRoom(GetCustomerWaitingRoomRequest request)
        {
            #region ODATA Call
            //var customers = Exigo.OData().EnrollerTree
            //    .Where(c => c.TopCustomerID == request.EnrollerID)
            //    .Where(c => c.Customer.SponsorID == null)
            //    .Where(c => c.Customer.CustomerStatusID == CustomerStatuses.Active)
            //    .Where(c => c.Customer.Field1 == string.Empty)
            //    .OrderByDescending(c => c.Customer.CreatedDate)
            //    .Select(c => new WaitingRoomNode()
            //    {
            //        CustomerID = c.CustomerID,
            //        FirstName = c.Customer.FirstName,
            //        LastName = c.Customer.LastName,
            //        EnrollerID = c.EnrollerID,
            //        EnrollmentDate = c.Customer.CreatedDate,
            //        City = c.Customer.MainCity,
            //        State = c.Customer.MainState,
            //        Country = c.Customer.MainCountry,
            //        Phone = c.Customer.Phone,
            //        Email = c.Customer.Email
            //    })
            //    .ToList();

            //// Filter out the customer that are no longer placeable
            //customers = customers.Where(c => c.EnrollmentDate.AddDays(request.GracePeriod) > DateTime.Now).ToList();
            #endregion
            #region SQL Procedure
            var customers = new List <WaitingRoomNode>();
            using (var context = Exigo.Sql())
            {
                string sqlProcedure = string.Format("GetCustomerWaitingRoom {0},{1}", request.EnrollerID, request.GracePeriod);
                customers = context.Query <WaitingRoomNode>(sqlProcedure).ToList();
            }
            #endregion
            return(customers);
        }