Exemple #1
0
 /// <summary>
 /// Constructor with 2 parameters
 /// </summary>
 /// <param name="loginForm"></param>
 /// <param name="student"></param>
 public LibraryForm(LoginForm loginForm, Users.Student student)
 {
     InitializeComponent();
     this.loginForm = loginForm;
     this.student = student;
     InitializeGUI();
 }
Exemple #2
0
 /// <summary>
 /// adding new student
 /// </summary>
 /// <param name="student"></param>
 /// <returns></returns>
 public static bool addStudent(Student student)
 {
     if (!studentMap.ContainsKey(student.ContactData.UserName))
     {
         img = student.Image;
         studentMap.Add(student.ContactData.UserName, student);
         img.Save(student.ContactData.UserName);
         saveToXml();
         return true;
     }
     else return false;
 }
Exemple #3
0
 /// <summary>
 /// button register event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRegister_Click(object sender, EventArgs e)
 {
     String firstName, lastName, email, userName, password;
     Boolean ok = false;
     ok = validateInputs(out firstName, out lastName, out email, out userName, out password);
     if (ok)
     {
         if (img == null)
         {
             this.img = LibraryResource.NotAvailable;
         }
         student = new Student(new Contact(new Email(email), firstName, lastName, userName, password), img);
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
 /// <summary>
 /// adding new student
 /// </summary>
 /// <param name="student"></param>
 /// <returns></returns>
 public void addStudent(Student student)
 {
     DataBase.addStudent(student);
 }
Exemple #5
0
 /// <summary>
 /// returns students
 /// </summary>
 /// <param name="key"></param>
 /// <param name="student"></param>
 public static bool getUser(string key, out Student student)
 {
     if (studentMap.TryGetValue(key, out student))
         return true;
     else return false;
 }
Exemple #6
0
 /// <summary>
 /// Varifing the user
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 /// <param name="errFlagg"></param>
 /// <param name="student"></param>
 /// <returns></returns>
 public static bool varifyUser(string userName, string password, out bool errFlagg, out Student student)
 {
     if (DataBase.getUser(userName, out student))
     {
         if (student.ContactData.Password.Equals(password))
         {
             errFlagg = true;
             return true;
         }
         else
         {
             errFlagg = true;
             return false;
         }
     }
     else
     {
         errFlagg = false;
         return false;
     }
 }