public void Paste() { var effectedRows = new SeatBox[_occupationClipboard.Length + 1]; effectedRows[effectedRows.Length - 1] = SelectedSeat; Action applyChanges = () => { }; for (var i = 0; i < _occupationClipboard.Length; i++) { var index = i; var occupation = _occupationClipboard[i]; _seatBoxes[occupation.Seat.Id.ToString()].SaftyInvoke <SeatBox>(o => { if (o.RemoveOccupation(occupation) && SelectedSeat.AddOccupation(occupation)) { occupation.Seat = SelectedSeat.Seat; applyChanges = occupation.Is <SeatArrangement>() ? (() => TrySubmitChanged(false, ((SeatArrangement)occupation).Agent)) : new Action(() => { _seatDispatcherModel.SubmitChanges(); _occupationClipboard = null; }); } effectedRows[index] = o; }); } applyChanges.Invoke(); Reload(effectedRows); OccupationsReloaded(null); }
public void Delete() { SelectedSeat.RemoveOccupation((Occupation)SelectedBlock); _seatDispatcherModel.SubmitChanges(); //IsDirty = true; Reload(new[] { SelectedSeat }); }
public void serveDrink() { sellDrink(); CheckForDrinkBuff(); SelectedSeat.ConsumeBeverage(); bartendersMug.ClearIngredientInMug(); theBarsTaps.lockTapSystem(); }
private async void SaveSeatEdit() { try { SelectedSeat.CopyFrom(EditableSeat); await _service.UpdateSeatAsync((SeatDto)SelectedSeat); } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } FinishingSeatEdit?.Invoke(this, EventArgs.Empty); }
private void areControlsActive(bool yesNo) { for (int i = 0; i < Seats.Length; i++) { Seats[i].barToken.GetComponent <Button>().enabled = yesNo; if (!yesNo) { Seats[i].setBarTokensToPauseGrey(); } else { Seats[i].setBarTokensToUnPauseColor(); } } SelectedSeat.setBarTokensToUnPauseColor(); }
private async void SellSeat() { try { if (!EditableSeat.IsValid()) { OnMessageApplication("Minden mezőt ki kell tölteni."); return; } SelectedSeat.CopyFrom(EditableSeat); SelectedSeat.Status = 2; await _service.UpdateSeatAsync((SeatDto)SelectedSeat); } catch (Exception ex) when(ex is NetworkException || ex is HttpRequestException) { OnMessageApplication($"Unexpected error occured! ({ex.Message})"); } FinishingSeatEdit?.Invoke(this, EventArgs.Empty); }
private void StartEditSeat() { EditableSeat = SelectedSeat.ShallowClone(); StartingSeatEdit?.Invoke(this, EventArgs.Empty); }
public void AssignSeat(Term shift, IWorkingAgent selectedAgent) { var affectedRows = new[] { SelectedSeat }; if (!shift.SeatIsEmpty()) { var removeDelegates = new Action(() => { }); affectedRows = selectedAgent.Schedule.GetCoveredTermsWithAbsent(shift).Add(shift) .Where(o => !o.SeatIsEmpty() && _seatBoxes.ContainsKey(o.Seat)) .Select(o => { var seatBox = (SeatBox)_seatBoxes[o.Seat]; foreach (var c in seatBox.Occupations.Where(c => c.If <SeatArrangement>(a => a.Source.Equals(o)))) { var occupation = c; removeDelegates += () => { seatBox.RemoveOccupation(occupation); selectedAgent.Occupations.Remove(occupation); }; } return(seatBox); }) .ToArray(); removeDelegates(); //var originalSeat = (SeatBox)_seatBoxes[shift.Seat]; //var seatArrangement = originalSeat.Occupations.OfType<SeatArrangement>().FirstOrDefault(o => o.Source == shift && o.TimeEquals(shift)); //if (seatArrangement != null) // originalSeat.RemoveOccupation(seatArrangement); //affectedRows = new[] { SelectedSeat, originalSeat }; } var prv = default(Term); var seatId = SelectedSeat.Id.ToString(); shift.Seat = seatId; var coveredTerms = selectedAgent.Schedule.GetCoveredTermsWithAbsent(shift); coveredTerms.ForEach(o => o.Seat = null).Add(shift) .SliceOccupied((dateRange, term) => { if (!term.IsNeedSeat) { term.Seat = seatId; prv = term; return(default(SeatArrangement)); } if (prv != null && !ReferenceEquals(prv, term) && prv.Level == 0 && term.Level == 0) { prv = null; } var source = default(Term); TermExt.X(prv, term, ref source); var instance = new SeatArrangement(selectedAgent.Profile, dateRange.Start, dateRange.End, SelectedSeat.Seat) { Source = source }; source.Seat = seatId; SelectedSeat.AddOccupation(instance); selectedAgent.Occupations.Add(instance); prv = term; return(instance); }, t => t.IsNeedSeat); //shift.SaftyInvoke<AssignmentBase>(o => { o.OccupyStatus = "C"; }); Reload(affectedRows); OccupationsChanged(-1); }