/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.sql.*;

/**
 *
 * @author frostnoxia
 */
public class Art {
    
    private String url;
    private String price;
    private String title;
    private String id;
    private String userId;
    private String desc;
    private String upload_date;

    public Art(Connection conn, String image_id) {
        try {
            PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM usami.Image WHERE image_id = ?");
            pstmt.setString(1, image_id);
            
            ResultSet rs = pstmt.executeQuery();
            if (rs.next()) {
                this.id = image_id;
                this.title = rs.getString("image_name");
                this.url = rs.getString("image_url");
                this.desc = rs.getString("desc");
                this.upload_date = rs.getString("upload_date");
                this.userId = rs.getString("user_id");
            }
            
            
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public String getUpload_date() {
        return upload_date;
    }

    public void setUpload_date(String upload_date) {
        this.upload_date = upload_date;
    }
    
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    
    
    
    
}

@@ -453,16 +453,45 @@
 ad_date;
+%0A    private String fullname;
 %0A%0A    pu
@@ -531,24 +531,33 @@
 image_id) %7B%0A
+        %0A
         try 
@@ -558,16 +558,29 @@
   try %7B%0A
+            %0A
         
@@ -601,16 +601,74 @@
 atement 
+pstmt;%0A            ResultSet rs;%0A            %0A            
 pstmt = 
@@ -805,26 +805,16 @@
         
-ResultSet 
 rs = pst
@@ -1220,26 +1220,834 @@
     
-%0A        %7D catch (
+pstmt = conn.prepareStatement(%22SELECT * FROM usami.Profile WHERE user_id = ?%22);%0A            pstmt.setString(1, this.userId);%0A            %0A            rs = pstmt.executeQuery();%0A            if (rs.next()) %7B%0A                this.fullname = rs.getString(%22first_name%22) + %22 %22 + rs.getString(%22last_name%22);%0A            %7D%0A            %0A        %7D catch (Exception ex) %7B%0A            ex.printStackTrace();%0A        %7D%0A    %7D%0A    %0A    public void updateArts(Connection conn, String image_id) %7B%0A        try %7B%0A            PreparedStatement pstmt = conn.prepareStatement(%22UPDATE usami.Image SET image_name = ?, Image.desc = ? WHERE image_id = ?%22);%0A            pstmt.setString(1, this.title);%0A            pstmt.setString(2, this.desc);%0A            pstmt.setString(3, image_id);%0A            pstmt.executeUpdate();%0A            %0A        %7D catch (SQL
 Exce
@@ -3075,24 +3075,182 @@
 %0A    %7D%0A    %0A
+    public String getFullname() %7B%0A        return fullname;%0A    %7D%0A%0A    public void setFullname(String fullname) %7B%0A        this.fullname = fullname;%0A    %7D%0A    %0A
     %0A    %0A  

update art class