public bool AddUser(string name, string dayofbirth) { Regex regex = new Regex(@"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"); if (regex.IsMatch(dayofbirth) && name.Length > 0) { return(MemoryStorage.Add(new User(++User.count, name, dayofbirth, ""))); } else { throw new FormatException("Error in data format"); } }
public bool AddAward(string name, string discription) { if (name.Length > 0) { return(MemoryStorage.Add(new Award(++Award.count, name, discription))); } return(false); }
public bool Associate(int fr, int sc) { if (MemoryStorage.Find(sc) != null) { return(AsStorage.Add(new Association(fr, sc))); } else { throw new KeyNotFoundException("No such Award"); } }
public void AddUser(string name, string dayofbirth) { Regex regex = new Regex(@"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"); if (regex.IsMatch(dayofbirth)) { if (!MemoryStorage.Find(new User(0, name, dayofbirth))) { MemoryStorage.Add(new User(name, dayofbirth)); } else { throw new FormatException("This user already exists"); } } else { throw new FormatException("Error in data format"); } }
public bool Add(int id, string login, string password) { return(MemoryStorage.Add(new LoginData(id, login, GetHash(password)))); }