Example #1
0
        public async Task JoinCustomerAsync(UserInfo user, CustomerPoolJoinRequest customerPoolJoinRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var customerInfos = Context.CustomerInfos.Where(a => customerPoolJoinRequest.CustomerIds.Contains(a.Id)).ToList();

            foreach (var item in customerInfos)
            {
                item.UserId       = "";
                item.DepartmentId = customerPoolJoinRequest.DepartmentId;
                var pool = new CustomerPool()
                {
                    CreateTime   = DateTime.Now,
                    CreateUser   = user.Id,
                    CustomerId   = item.Id,
                    IsDeleted    = false,
                    JoinDate     = DateTime.Now,
                    DepartmentId = customerPoolJoinRequest.DepartmentId
                };
                Context.Update(item);
                Context.Add(pool);
            }
            try
            {
                await Context.SaveChangesAsync(cancellationToken);
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }
        }
Example #2
0
    private void AddShopper()
    {
        Customer _newCustomer = CustomerPool.GetCustomer();

        _newCustomer.InitializeCustomer(UnityEngine.Random.Range(0, 20), UnityEngine.Random.Range(20, 40), ShopList);
        m_customerList.Add(_newCustomer);
    }
Example #3
0
    private void OnTriggerEnter(Collider other)
    {
        Customer customer = other.GetComponent <Customer>();

        if (customer != null)
        {
            CustomerPool.PlaceToPool(customer);
        }
    }
Example #4
0
 void Awake()
 {
     if (m_instance == null)
     {
         m_instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #5
0
        public async Task <CustomerPool> CreateAsync(CustomerPool customerPool, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (customerPool == null)
            {
                throw new ArgumentNullException(nameof(customerPool));
            }
            Context.Add(customerPool);
            await Context.SaveChangesAsync(cancellationToken);

            return(customerPool);
        }
Example #6
0
    public void RemoveShopper(Customer customer = null)
    {
        Customer _removable = customer;

        if (_removable == null)
        {
            int _lastIndex = m_customerList.Count - 1;
            _removable = m_customerList[m_customerList.Count - 1];
        }

        m_customerList.Remove(_removable);
        CustomerPool.AddCustomer(_removable);
    }
Example #7
0
 public async Task DeleteAsync(CustomerPool customerPool, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (customerPool == null)
     {
         throw new ArgumentNullException(nameof(customerPool));
     }
     Context.Remove(customerPool);
     try
     {
         await Context.SaveChangesAsync(cancellationToken);
     }
     catch (DbUpdateConcurrencyException)
     {
         throw;
     }
 }
Example #8
0
 private void Awake()
 {
     Instance = this;
 }