public String addProgramare(String date, String name, String telefon, String services, String ora) { Type obj = Type.GetType(ConfigurationManager.AppSettings["DefaultRepositoryServicii"]); ConstructorInfo constructor = obj.GetConstructor(new Type[] { }); IServiciiDAO serviciiRepository = (IServiciiDAO)constructor.Invoke(null); String[] s = services.Split(','); int cost = 0; foreach (String w in s) { if (verifIfTaken(w, date, ora)) { return("ERROR! Service: " + w + " is taken. Choose another!"); } Serviciu u = serviciiRepository.getService(w); if (u == null) { return(null); } else { cost += u.getPrice(); } } String result = _repository.addProgramare(date, ora, name, telefon, services, cost); return(result); }
public Serviciu getService(String numeServiciu) { return(_repository.getService(numeServiciu)); }