private async Task AddAccountNumber(string oib) { Partner = await _partnersEndpoint.GetByOib(oib); string sifra = Partner.Id.ToString(); string kontoK = "12"; string kontoD = "22"; while (kontoK.Length + sifra.Length < 8) { kontoK += "0"; } kontoK += sifra; await _bookAccountsEndpoint.Insert(new BookAccountModel { Konto = kontoK, Opis = Partner.Naziv }); while (kontoD.Length + sifra.Length < 8) { kontoD += "0"; } kontoD += sifra; await _bookAccountsEndpoint.Insert(new BookAccountModel { Konto = kontoD, Opis = Partner.Naziv }); Partner.KontoK = kontoK; Partner.KontoD = kontoD; await _partnersEndpoint.PostPartner(Partner); }
private async Task AddAccountNumber(string oib) { Partner = await _partnersEndpoint.GetByOib(oib); if (IsBuyer) { Partner.KontoK = "12"; } if (IsSupplier) { Partner.KontoD = "22"; } string sifra = Partner.Id.ToString(); string kontoK = Partner.KontoK; string kontoD = Partner.KontoD; if (kontoK != null && kontoK.StartsWith("12")) { while (kontoK.Length + sifra.Length < 8) { kontoK += "0"; } kontoK += sifra; await _bookAccountsEndpoint.Insert(new BookAccountModel { Konto = kontoK, Opis = Partner.Naziv }); } if (kontoD != null && kontoD.StartsWith("22")) { while (kontoD.Length + sifra.Length < 8) { kontoD += "0"; } kontoD += sifra; await _bookAccountsEndpoint.Insert(new BookAccountModel { Konto = kontoD, Opis = Partner.Naziv }); } Partner.KontoK = kontoK; Partner.KontoD = kontoD; await _partnersEndpoint.PostPartner(Partner); }
private async void SaveAccount() { if (BookAccount != null && !BookAccount.HasErrors) { var result = await _bookAccountsEndpoint.Insert(BookAccount); if (result) { RequestClose?.Invoke(new DialogResult(ButtonResult.OK)); } } }