-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_freelance_pf.cs
More file actions
111 lines (85 loc) · 3.18 KB
/
Copy pathcreate_freelance_pf.cs
File metadata and controls
111 lines (85 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Freelance.Class;
namespace Freelance
{
public partial class create_freelance_pf : Form
{
public create_freelance_pf(string username)
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void pf_submit_Click(object sender, EventArgs e)
{
string name = name_txt.Text.Trim();
string skills = skills_txt.Text.Trim();
string expertise = expertise_txt.Text.Trim();
string pastWork = past_work_txt.Text.Trim();
string location = location_txt.Text.Trim();
string bio = bio_txt.Text.Trim();
if (string.IsNullOrEmpty(skills) || string.IsNullOrEmpty(expertise) ||
string.IsNullOrEmpty(pastWork) || string.IsNullOrEmpty(location) ||
string.IsNullOrEmpty(bio))
{
MessageBox.Show("Please fill out all required fields.");
return;
}
try
{
db_connection.Open_con();
string query = "INSERT INTO freelancer_pf (username, name , skills, expertise, past_work, location, bio) " +
"VALUES (@Username,@Name , @Skills, @Expertise, @PastWork, @Location , @Bio)";
using (MySqlCommand cmd = new MySqlCommand(query, db_connection.cn))
{
cmd.Parameters.AddWithValue("@Name", name);
cmd.Parameters.AddWithValue("@Username", Session_manage.Username);
cmd.Parameters.AddWithValue("@Skills", skills);
cmd.Parameters.AddWithValue("@Expertise", expertise);
cmd.Parameters.AddWithValue("@PastWork", pastWork);
cmd.Parameters.AddWithValue("@Location", location);
cmd.Parameters.AddWithValue("@Bio", bio);
cmd.ExecuteNonQuery();
}
MessageBox.Show("Profile created successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
freelance dashboardForm = new freelance();
dashboardForm.Show();
this.Close();
}
catch (Exception ex)
{
MessageBox.Show("An error occurred: " + ex.Message);
}
finally
{
db_connection.Close_con();
}
}
private void skills_TextChanged(object sender, EventArgs e)
{
}
private void create_freelance_pf_Load(object sender, EventArgs e)
{
}
private void past_work_txt_TextChanged(object sender, EventArgs e)
{
}
private void guna2Panel1_Paint(object sender, PaintEventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
}
}