int main() {
    AgendaService agenda;
    Storage *ptr = Storage::getInstance();
    agenda.userLogIn("f**k","aaa");
    agenda.userRegister("huangweiping", "caonima","xxx","333");
    agenda.userRegister("weiping2", "caonima","xxx","333");
    agenda.userRegister("Bill", "123456","*****@*****.**","18819473330");
    agenda.userRegister("weiping", "123456","*****@*****.**","8888888888");
    agenda.userLogIn("huangweiping","aaa");
    agenda.userLogIn("huangweiping","caonima");
    Date d1(2005, 3, 15, 20, 33);
    Date d2(2013, 10, 30, 5, 22);
    agenda.createMeeting("huangweiping","fuccccc", "SB","2014-06-01/12:00","2014-06-05/12:00"
);
    agenda.createMeeting("weiping", "fu", "Bill", "2014-06-01/12:00","2014-06-05/12:00");
    agenda.createMeeting("weiping", "ssssssssss", "Bill", "2014-06-01/12:00","2014-06-05/12:00");
    //agenda.deleteMeeting("Bill","fu");
    //agenda.deleteAllMeetings("weiping");
    list<Meeting> a = agenda.listAllSponsorMeetings("weiping");
    for (list<Meeting>::iterator i = a.begin(); i != a.end(); i++) {
        cout << "Sponsor:" << (*i).getSponsor() << "  Title:" << (*i).getTitle() << endl;
    }
    list<User> b = agenda.listAllUsers();
    for (list<User>::iterator i = b.begin(); i != b.end(); i++) {
        cout << "User:"******"  Password:" << (*i).getPassword() << endl;
    }
    getchar();
    return 0;
}
Esempio n. 2
0
int main() {
  AgendaService agenda;
  agenda.startAgenda();
  if (agenda.userRegister("William", "17881243", "*****@*****.**", "8130770")) cout << "Regist sucessfully!" << endl;
  if (agenda.userRegister("Smartmoon", "love", "asdas", "1243")) cout << "success!"  << endl;
  string userName, password;
  cout << "name:" << endl;
  cin >> userName;
  cout << "password:"******"Login sucessfully!" << endl;
  if (agenda.deleteUser(userName, password)) cout << "Logout successfully!" << endl;
  if (agenda.createMeeting("William", "Love", "Smartmoon", "2014-11-02/08:40", "2014-11-02/23:00")) cout << "Create successfully!" << endl;
  else cout << "??" << endl;
  if (agenda.createMeeting("William", "Love1", "Smartmoon", "2014-11-02/08:40", "2014-11-02/23:00")) cout << "Create successfully!" << endl;
  else cout << "Have no time" << endl;
  if (agenda.createMeeting("William", "Love2", "Smartmoon", "2014-11-03/08:40", "2014-11-02/23:00")) cout << "Create successfully!" << endl;
  else cout << "Time < 0" << endl;
  if (agenda.createMeeting("William", "Love", "Smartmoon", "2014-11-03/08:40", "2014-11-03/23:00")) cout << "Create successfully!" << endl;
  else cout << "Repeat name" << endl;
  if (agenda.createMeeting("William", "Love", "Smartmoon", "2014-11-99/08:40", "2014-11-02/23:00")) cout << "Create successfully!" << endl;
  else cout << "Invalid Time" << endl;
  agenda.quitAgenda();
  return 0;
}