private async Task LoadNumeration() { var numerations = await _repository.GetAllAsync(); var defaultNumeration = numerations.FirstOrDefault(n => n.Name == "default"); if (defaultNumeration != null) { Numeration = new NumerationWrapper(defaultNumeration); } else { var newNumeration = new Business.Numeration(); _repository.Add(newNumeration); Numeration = new NumerationWrapper(newNumeration); } Numeration.PropertyChanged += (o, a) => { if (_rBACManager?.LoggedUser?.FirstName != null && _rBACManager?.LoggedUser?.LastName != null) { var stringBuilder = new StringBuilder(); stringBuilder.Append(_rBACManager?.LoggedUser?.FirstName[0]); stringBuilder.Append(_rBACManager?.LoggedUser?.LastName[0]); var initials = stringBuilder.ToString(); NumerationExample = OrderNumberGenerator.GetNumberFromPattern(Numeration.Pattern, initials); return; } NumerationExample = OrderNumberGenerator.GetNumberFromPattern(Numeration.Pattern); }; }
public void CreateNumerationPivot(NumerationPivot Numeration) { GEN_Numeration numeration = Mapper.Map <NumerationPivot, GEN_Numeration>(Numeration); numerationRepository.Add(numeration); }