public int DeleteUser(User user)
        {
            try
            {
                con.Open();
                string query = "DELETE FROM Users "
                                     + "WHERE UserID = @UserID OR Email = @Email";

                SqlCommand cmd = new SqlCommand(query, con);
                cmd.Parameters.AddWithValue("@UserID", user.UserID);
                cmd.Parameters.AddWithValue("@Email", user.Email);

                return cmd.ExecuteNonQuery();
            }
            catch (SqlException i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return 0;
            }
            catch (Exception i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return 0;
            }
            finally
            {
                con.Close();
            }
        }
        public int InsertUser(User user)
        {
            try
            {
                con.Open();
                string query = "INSERT Users " +
                                       "(Name, " +
                                        "GroupID, " +
                                        "Email, " +
                                        "Password, " +
                                        "Avatar, " +
                                        "UserTypeId, " +
                                        "GenderID, " +
                                        "AuthenticationTypeID)" +
                                    "VALUES " +
                                       "(@Name, " +
                                        "@GroupID, " +
                                        "@Email, " +
                                        "@Password, " +
                                        "@Avatar, " +
                                        "@UserTypeId, " +
                                        "@GenderID, " +
                                        "@AuthenticationTypeID)";

                SqlCommand cmd = new SqlCommand(query, con);
                cmd.Parameters.AddWithValue("@UserID", user.UserID);
                cmd.Parameters.AddWithValue("@Name", user.Name);
                cmd.Parameters.AddWithValue("@GroupID", user.GroupID);
                cmd.Parameters.AddWithValue("@Email", user.Email);
                cmd.Parameters.AddWithValue("@Password", user.Password);
                cmd.Parameters.AddWithValue("@Avatar", user.Avatar);
                cmd.Parameters.AddWithValue("@UserTypeID", user.UserTypeID);
                cmd.Parameters.AddWithValue("@AuthenticationTypeID", user.AuthenticationTypeID);

                return cmd.ExecuteNonQuery();
            }
            catch (SqlException i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return 0;
            }
            catch (Exception i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return 0;
            }
            finally
            {
                con.Close();
            }
        }
 public int SignUp(User user)
 {
     throw new NotImplementedException();
 }
        public DataTable SelectUser(User user)
        {
            try
            {
                con = new SqlConnection(connectionString);
                con.Open();
                string query = "SELECT * " +
                               "FROM USers " +
                               "WHERE UserID = @UserID OR Name = @Name OR GroupID = @GroupID OR " +
                               "Email = @Email OR Password = @Password";
                cmd = new SqlCommand(query, con);
                cmd.Parameters.AddWithValue("@UserID", user.UserID);
                cmd.Parameters.AddWithValue("@Name", user.Name);
                cmd.Parameters.AddWithValue("@GroupID", user.GroupID);
                cmd.Parameters.AddWithValue("@Email", user.Email);
                cmd.Parameters.AddWithValue("@Password", user.Password);

                da = new SqlDataAdapter(cmd);
                ds = new DataSet();
                da.Fill(ds, "Users");
                DataTable dt = ds.Tables["Users"];
                return dt;

            }
            catch (SqlException i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return null;
            }
            catch (Exception i)
            {
                Logs logging = new Logs();
                logging.InsertLog(new Log());
                return null;
            }
            finally
            {
                con.Close();
            }
        }
 public User Login(User user)
 {
     throw new NotImplementedException();
 }