// Constructors
 public Appointment(Client client, Volunteer volunteer,DateTime date, string location)
 {
     this.client = client;
     this.volunteer = volunteer;
     this.date = date;
     this.location = location;
 }
 // Constructor
 public ClientHandler(Client activeuser)
 {
     questionhandler = new QuestionHandler();
     reviewhandler = new ReviewHandler();
     userhandler = new UserHandler();
     CurrentUser = activeuser;
 }
 public bool DeleteClient(Client client)
 {
     if (userhandler.DeleteUser(client))
         return true;
     else
         return false;
 }
示例#4
0
 // Constructor
 public Review(DateTime date, Client client,Volunteer targetuser,int rating, string content)
 {
     Rating = rating;
     Targetuser = targetuser;
     Client = client;
     Content = content;
     Date = date;
 }
示例#5
0
 public Question(Client client, int auteur, string location,string transport,string distance,string Discrepancy,string content,DateTime date,string solved)
 {
     this.Client = client;
     this.Auteur = auteur;
     this.Location = location;
     this.Transport = transport;
     this.Content = content;
     this.discrepancy = Discrepancy;
     this.Date = date;
     this.Solved = solved;
     this.Distance = distance;
 }
示例#6
0
 // Constructor
 public Question(Client client, int auteur, string location, string content, DateTime date)
 {
     this.Client = client;
     this.Auteur = auteur;
     this.Location = location;
     this.Transport = null;
     this.Content = content;
     this.discrepancy = null;
     this.Date = date;
     this.Solved = "NEE";
     this.Distance = null;
 }
        // Constructor
        public Form_QuestionDetails(Question questiontoshow, Client currentuser, Review reviewtoshow)
        {
            InitializeComponent();

            this.currentuser = currentuser;
            currentreview = reviewtoshow;
            this.currentreview = reviewtoshow;
            clienthandler = new ClientHandler(this.currentuser as Client);
            currentquestion = questiontoshow;
            RefreshInterface();
            this.ActiveControl = lbl_Info1;
            isChanged = false;
        }
 public List<Appointment> GetMyAppointments(Client client)
 {
     return DatabaseHandler.GetMyAppointments(client);
 }
 // TODO: NOT CORRECT
 public bool AddMeeting(Client client, Volunteer volunteer, DateTime date, string location)
 {
     Appointment meeting = new Appointment(client, volunteer, date, location);
     return false; ;
 }
 public List<Review> GetMyReviews(Client client)
 {
     return DatabaseHandler.GetMyReviews(client);
 }
        public static User GetUser(int ids)
        {
            User toadd = null;
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText = "SELECT USERID, NAAM, GEBOORTEDATUM, GESLACHT, WOONPLAATS, ADRES, EMAIL, WACHTWOORD, TYPE FROM TUSER WHERE USERID = " + ids; // QUERY
                cmd.CommandType = CommandType.Text;
                dr = cmd.ExecuteReader();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                Disconnect();
                return null;
            }

            try
            {
                while (dr.Read())
                {
                    // Read from DB
                    var id = dr.GetInt32(0);
                    var name = dr.GetString(1);
                    var dateOfBirth = dr.GetDateTime(2);
                    var gender = dr.GetString(3);
                    var city = dr.GetString(4);
                    var adress = dr.GetString(5);
                    var email = dr.GetString(6);
                    var password = dr.GetString(7);

                    var type = dr.GetString(8);

                    switch (type)
                    {
                        case "CLIENT":
                            Client newClient = new Client(name, dateOfBirth, gender, city, adress, email, password);
                            toadd = newClient;
                            toadd.UserID = id;
                            break;
                        case "VOLUNTEER":
                            toadd = null;
                            Volunteer newUser = new Volunteer(name, dateOfBirth, gender, city, adress, email, password, false, "Niet Opgegeven", "ONBEKEND", "ONBEKEND");
                            toadd = newUser;
                            toadd.UserID = id;
                            break;
                        case "ADMIN":
                            Admin newAdmin = new Admin(name, dateOfBirth, gender, city, adress, email, password);
                            toadd = newAdmin;
                            toadd.UserID = id;
                            break;
                        default:
                            toadd = null;
                            break;
                    }

                }
                Disconnect();
                return toadd;
            }
            catch (InvalidCastException ex)
            {
                Disconnect();
                MessageBox.Show(ex.ToString());
                return null;
            }
        }
        public static List<Review> GetMyReviews(Client client)
        {
            List<Review> returnlist = new List<Review>();
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText = "SELECT VOLUNTEER, DATUM, RATING, TEKST FROM TREVIEW WHERE CLIENT = :newUSERID";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("newUSERID", OracleDbType.Varchar2).Value = client.UserID;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    var volunid = dr.GetInt32(0);
                    var datetime = dr.GetDateTime(1);
                    var rating = dr.GetInt32(2);
                    var content = dr.GetString(3);

                    returnlist.Add(new Review(datetime, client, GetUserNoConnect(volunid) as Volunteer, rating, content));
                }
                return returnlist;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return returnlist;
            }
            finally
            {
                Disconnect();
            }
        }
        public static List<Appointment> GetMyAppointments(Client client)
        {
            List<Appointment> returnlist = new List<Appointment>();
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText = "SELECT VOLUNTEER, DATUMTIJD, LOCATIE FROM TAFSPRAAK WHERE CLIENT = :newUSERID";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("newUSERID", OracleDbType.Varchar2).Value = client.UserID;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    var volunid = dr.GetInt32(0);
                    var datetime = dr.GetString(1);
                    var location = dr.GetString(2);

                    returnlist.Add(new Appointment(client, GetUserNoConnect(volunid) as Volunteer, Convert.ToDateTime(datetime), location));
                }
                return returnlist;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return returnlist;
            }
            finally
            {
                Disconnect();
            }
        }
        public static List<Review> GetAllReviews()
        {
            List<Review> returnlist = new List<Review>();
            try
            {
                Connect();
                cmd = new OracleCommand();
                cmd.Connection = con;
                cmd.CommandText = "SELECT R.REVIEWID, R.RATING, R.TEKST, R.DATUM, C.USERID, C.NAAM, C.GEBOORTEDATUM, C.GESLACHT, C.WOONPLAATS, C.ADRES, C.EMAIL, C.WACHTWOORD, C.TYPE, "
               + "V.USERID, V.NAAM, V.GEBOORTEDATUM, V.GESLACHT, V.WOONPLAATS, V.ADRES, V.EMAIL, V.WACHTWOORD, V.TYPE FROM TUSER V, TUSER C, TREVIEW R WHERE V.USERID = R.VOLUNTEER AND C.USERID = R.CLIENT";
                cmd.CommandType = CommandType.Text;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    var id = dr.GetInt32(0);
                    var rating = dr.GetInt32(1);
                    var content = dr.GetString(2);
                    var date = dr.GetDateTime(3);

                    var clientid = dr.GetInt32(4);
                    var clientname = dr.GetString(5);
                    var clientdob = dr.GetDateTime(6);
                    var clientgender = dr.GetString(7);
                    var clientcity = dr.GetString(8);
                    var clientaddress = dr.GetString(9);
                    var clientemail = dr.GetString(10);
                    var clientpassword = dr.GetString(11);
                    var clientype = dr.GetString(12);

                    var volunid = dr.GetInt32(13);
                    var volunname = dr.GetString(14);
                    var volundob = dr.GetDateTime(15);
                    var volungender = dr.GetString(16);
                    var voluncity = dr.GetString(17);
                    var volunaddress = dr.GetString(18);
                    var volunemail = dr.GetString(19);
                    var volunpassword = dr.GetString(20);
                    var voluntype = dr.GetString(21);

                    Client someclient = new Client(clientname, clientdob, clientgender, clientcity, clientaddress, clientemail, clientpassword);
                    someclient.UserID = clientid;
                    Volunteer somevolun = new Volunteer(volunname, volundob, volungender, voluncity, volunaddress, volunemail, volunpassword, false, "", "", "");
                    somevolun.UserID = volunid;

                    returnlist.Add(new Review(date, someclient, somevolun, rating, content));

                    returnlist[returnlist.Count - 1].ReviewID = id;
                }

                return returnlist;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
            finally
            {
                Disconnect();
            }
        }
 public bool AddClient(Client newclient)
 {
     return false;
 }
        /// <summary>
        /// Checks and preocesses all form data.
        /// </summary>
        /// <returns>The volunteer or client if succesfull, otherwise null</returns>
        private User CheckAndReadEverything()
        {
            string email, password, name, gender, city, address;
            DateTime dateofbirth;

            // E-Mail
            email = tbox_Email.Text;
            if(!email.Contains('@'))
            {
                MessageBox.Show("Er is geen valide email ingevuld");
                return null;
            }
            // Password
            password = tbox_Password.Text;
            if(password.Length < 5)
            {
                MessageBox.Show("Lengte van wachtwoord moet minimaal 5 tekens zijn");
                return null;
            }
            // Name
            name = tbox_Name.Text;
            // TODO: Add checks?
            // Gender
            if(cbox_Gender.Text == "Man")
            {
                gender = "M";
            }
            else
            {
                gender = "V";
            }
            // City
            city = tbox_City.Text;
            // Address
            address = tbox_Address.Text;
            // Date of Birth
            dateofbirth = dtp_DateOfBirth.Value;
            if(rbtn_Volunteer.Checked)
            {
                if (vogpending)
                {
                    Volunteer newVolunteer = new Volunteer(name, dateofbirth, gender, city, address, email, password, false, "", vogpath, "");
                    return newVolunteer;
                }
                else
                {
                    MessageBox.Show("Upload eerst je VOG");
                    return null;
                }
            }
            else
            {
                Client newClient = new Client(name, dateofbirth, gender, city, address, email, password);
                return newClient;
            }
        }