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; } }
private void AddShopper() { Customer _newCustomer = CustomerPool.GetCustomer(); _newCustomer.InitializeCustomer(UnityEngine.Random.Range(0, 20), UnityEngine.Random.Range(20, 40), ShopList); m_customerList.Add(_newCustomer); }
private void OnTriggerEnter(Collider other) { Customer customer = other.GetComponent <Customer>(); if (customer != null) { CustomerPool.PlaceToPool(customer); } }
void Awake() { if (m_instance == null) { m_instance = this; } else { Destroy(gameObject); } }
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); }
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); }
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; } }
private void Awake() { Instance = this; }