public FinishedState(Customer customer, CustomerEvents customerEvents, Spawner spawner, float point) { _customer = customer; _customerEvents = customerEvents; _point = point; _spawner = spawner; }
void Awake() { _spawner = GetComponentInParent <Spawner>(); _customerEvents = GetComponent <CustomerEvents>(); var waitingState = new WaitingState(this, _customerEvents); var buyingState = new BuyingState(_buyTime, this, _customerEvents); var finishedState = new FinishedState(this, _customerEvents, _spawner, point); var deadState = new DeadState(this, _spawner); _stateMachine = new StateMachine(); At(waitingState, buyingState, IsCustomerCanBuy()); At(buyingState, waitingState, NotIsCustomerCanBuy()); At(waitingState, deadState, IsDead()); At(buyingState, deadState, IsDead()); At(buyingState, finishedState, IsFinishedBuying()); _stateMachine.SetState(waitingState); void At(IState from, IState to, Func <bool> condition) => _stateMachine.AddTransition(from, to, condition); Func <bool> IsCustomerCanBuy() => () => _canBuy; Func <bool> NotIsCustomerCanBuy() => () => !_canBuy; Func <bool> IsFinishedBuying() => () => _finishedBuying; Func <bool> IsDead() => () => _isDead; }
public override void Handle(CustomerEvents.Created message) { CustomerDto dto = this.Load(message.CustomerId); if (dto != null) throw new Exception("Item with the same Id already created!"); dto = new CustomerDto(); dto.CustomerId = message.CustomerId; this.Save(dto); }
void Awake() { _customer = GetComponentInParent <Customer>(); _customerEvents = GetComponentInParent <CustomerEvents>(); _textMeshPro = GetComponentInChildren <TextMeshProUGUI>(); _slider = GetComponentInChildren <Slider>(); _rectTransform = GetComponent <RectTransform>(); }
public CustomerEvents Execute(GetCustomerById query) { var result = new CustomerEvents() { Events = CustomerRepository.GetCustomers(query.Id) }; return(result); }
public void Post([FromBody] delCustEvent cusEvent) { if (cusEvent != null) { CustomerEvents sub = new CustomerEvents { Title = cusEvent.Title, Description = cusEvent.Description, Date = cusEvent.Date }; customerMediator.InsertEvent(sub, cusEvent.cusId); } }
/// <summary> /// Inserts an Event for a specified customer /// </summary> /// <param name="cusEvent">The event to be inserted</param> /// <param name="cusId">The unique customer ID</param> /// <returns>An event</returns> public async Task <CustomerEvents> InsertEvent(CustomerEvents cusEvent, int cusId) { using (var connection = new SqlConnection(this.connectionString)) { var cmd = new SqlCommand("INSERT INTO [dbo].[CustomerEvents] (Title, EventDescription, EventDate, customerId) " + "VALUES (@title, @eventDescription, @eventDate, @customerId)", connection); cmd.Parameters.AddWithValue("@title", SqlDbType.VarChar).Value = cusEvent.Title; cmd.Parameters.AddWithValue("@eventDescription", SqlDbType.VarChar).Value = cusEvent.Description; cmd.Parameters.AddWithValue("@eventDate", SqlDbType.Date).Value = cusEvent.Date; cmd.Parameters.AddWithValue("@customerId", SqlDbType.Int).Value = cusId; await connection.OpenAsync(); int result = await cmd.ExecuteNonQueryAsync(); } return(cusEvent); }
public async Task <CustomerEvents> InsertEvent(CustomerEvents cusEvent, int cusId) { return(await customerDataAccess.InsertEvent(cusEvent, cusId)); }
void Awake() { _customerEvents = GetComponent <CustomerEvents>(); _audioSource = GetComponent <AudioSource>(); _audioSource.clip = _soldSound; }
public BuyingState(float buyTime, Customer customer, CustomerEvents customerEvents) { _buyTime = buyTime; _customer = customer; _customerEvents = customerEvents; }
public override void Handle(CustomerEvents.PaymentTypeRemoved message) { CustomerDto dto = this.Load(message.CustomerId); dto.PaymentTypeIdList.Remove(message.PaymentTypeId); this.Save(dto); }
public override void Handle(CustomerEvents.BankAccountRemoved message) { CustomerDto dto = this.Load(message.CustomerId); dto.BankAccountList.Remove(message.BankAccount); this.Save(dto); }
public override void Handle(CustomerEvents.NoteChanged message) { CustomerDto dto = this.Load(message.CustomerId); dto.Note = message.Note; this.Save(dto); }
public void When(CustomerEvents.NameChanged e) { this.Name = e.Name; }
public async Task <CustomerEvents> InsertEvent(CustomerEvents cusEvent, int cusId) { return(await customerRepository.InsertEvent(cusEvent, cusId)); }
public void When(CustomerEvents.PaymentTypeRemoved e) { this.PaymentTypeIdList.Remove(e.PaymentTypeId); }
public WaitingState(Customer customer, CustomerEvents customerEvents) { _customer = customer; _customerEvents = customerEvents; }
public void When(CustomerEvents.BankAccountRemoved e) { this.BankAccountList.Remove(e.BankAccount); }
public void When(CustomerEvents.BankAccountAdded e) { this.BankAccountList.Add(e.BankAccount); }
public void When(CustomerEvents.NoteChanged e) { this.Note = e.Note; }
public void When(CustomerEvents.CompanyRemoved e) { this.CompanyId = e.CompanyId; }
public override void Handle(CustomerEvents.CompanyRemoved message) { CustomerDto dto = this.Load(message.CustomerId); dto.CompanyId = message.CompanyId; this.Save(dto); }
public void When(CustomerEvents.PaymentTypeAdded e) { this.PaymentTypeIdList.Add(e.PaymentTypeId); }
public void When(CustomerEvents.Created e) { this.CustomerId = e.CustomerId; }