Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
 public bool AddAward(string name, string discription)
 {
     if (name.Length > 0)
     {
         return(MemoryStorage.Add(new Award(++Award.count, name, discription)));
     }
     return(false);
 }
Ejemplo n.º 3
0
 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");
     }
 }
Ejemplo n.º 4
0
        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");
            }
        }
Ejemplo n.º 5
0
 public bool Add(int id, string login, string password)
 {
     return(MemoryStorage.Add(new LoginData(id, login, GetHash(password))));
 }