public List <CazDTO> getAllCazuriDTO() { List <CazDTO> rez = new List <CazDTO>(); List <CazCaritabil> cazCaritabilDTOS = (List <CazCaritabil>)cazuriDBRepository.findAll(); foreach (CazCaritabil c in cazCaritabilDTOS) { CazDTO cazCaritabilDTO = new CazDTO(c.description, getSumaAdunata(c).ToString()); rez.Add(cazCaritabilDTO); } return(rez); }
public int getCazId(CazDTO cazCaritabilDTO) { sendRequest(new GetCazIdRequest(cazCaritabilDTO)); Response response = readResponse(); if (response is ErrorResponse) { ErrorResponse err = (ErrorResponse)response; throw new TeledonException(err.Message); } GetCazIdResponse response1 = (GetCazIdResponse)response; return(response1.getId()); }
/* public void login(Angajat angajat, ITeledonObserver client) * { * if (angajat != null) * { * if (loggedClients.ContainsKey(angajat.username)) * throw new TeledonException("User already logged!"); * loggedClients.Add(angajat.username, client); * } * else throw new TeledonException("Authentication failed."); * }*/ public void donatieS(CazDTO caz, string numeDonator, string adresa, string nrTel, float sumaDonata) { lock (this) { handleDonatori(numeDonator, nrTel, adresa); Int32 id = getDonator(numeDonator, nrTel).Id; Int32 cazId = getCazId(caz); Donatie d = new Donatie(sumaDonata, id, cazId); try { validatorDonatii.valideaza(d); } catch (Exception e) { } donatiiDBRepository.save(d); float s = caz.SumaAdunata; s += sumaDonata; caz.SumaAdunata = s; notifyAllAngajatiDonatie(); } }
public GetCazIdRequest(CazDTO cazCaritabilDTO) { this.cazCaritabilDTO = cazCaritabilDTO; }
/* public void donatie(Int32 cazId, string numeDonator, string adresa, string nrTel, float suma) * { * int idDonator; * if (donatoriDBRepository.findDonatoriDupaNume(numeDonator).Count != 0) * { * idDonator = donatoriDBRepository.findDonatoriDupaNume(numeDonator)[0].Id; * Donator dd = new Donator(numeDonator, nrTel, adresa); * dd.Id = idDonator; * donatoriDBRepository.update(dd); * } * else * { * donatoriDBRepository.save(new Donator(numeDonator, nrTel, adresa)); * idDonator = donatoriDBRepository.findDonatoriDupaNume(numeDonator)[0].Id; * } * * * Donatie d = new Donatie(suma, idDonator, cazId); * validatorDonatii.valideaza(d); * donatiiDBRepository.save(d); * * } * * public List<Donator> cauta(string numeDonator) * { * return donatoriDBRepository.findDonatoriDupaNume(numeDonator).ToList(); * } * * * public Dictionary<string, string> getDataAutentificareAngajati() * { * Dictionary<string, string> for_return = new Dictionary<string, string>(); * List<Angajat> angajati = (List<Angajat>)angajatiDBRepository.findAll(); * foreach (Angajat a in angajati) * { * for_return.Add(a.username, a.password); * } * * return for_return; * } * * public string encode(string text) * { * return text; * //return BCrypt.hashpw(text, BCrypt.gensalt()); * }*/ /*public void updateAngajat(AngajatDTO i, String parola) * { * Angajat a = angajatiDBRepository.findAngajatiDupaNume(i.getNume()).get(0); * a.setPassword(parola); * a.setUsername(i.getUsername()); * angajatiDBRepository.update(a); * }*/ /*public List<AngajatDTO> getAllAngajati() * { * List<AngajatDTO> rez = new ArrayList<>(); * List<Angajat> angajatList = (List<Angajat>)angajatiDBRepository.findAll(); * for (Angajat a : angajatList) * { * AngajatDTO angajatDTO = new AngajatDTO(a.getName(), a.getUsername()); * rez.add(angajatDTO); * } * return rez; * }*/ /*public List<String> getListaNumeAngajati() * { * List<String> rez = new ArrayList<>(); * for (Angajat a : angajatiDBRepository.findAll()) * { * rez.add(a.getName()); * } * return rez; * }*/ public int getCazId(CazDTO caz) { return(cazuriDBRepository.findCazuriDupaDescriere(caz.Descriere)[0].Id); }
internal int getCazId(CazDTO cazDTO) { return(server.getCazId(cazDTO)); }
public void donatieS(CazDTO caz, string numeDonator, string adresa, string nrTel, double sumaDonata) { DomainRepoLibrary.entities.CazDTO cazz = new DomainRepoLibrary.entities.CazDTO(caz.Descriere, (float)caz.Suma); service.donatieS(cazz, numeDonator, adresa, nrTel, (float)sumaDonata); }