-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubmitComplaints.aspx.cs
More file actions
54 lines (45 loc) · 1.52 KB
/
SubmitComplaints.aspx.cs
File metadata and controls
54 lines (45 loc) · 1.52 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
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace HotelManagement
{
public partial class WebForm12 : System.Web.UI.Page
{
string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
submitComplaint();
}
void submitComplaint()
{
try
{
SqlConnection con = new SqlConnection(strcon);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("INSERT INTO Complaints(UserId,Details) values(@UserId,@Details)", con);
cmd.Parameters.AddWithValue("@UserId", Session["Id"]);
cmd.Parameters.AddWithValue("@Details", TextBox2.Text.Trim());
cmd.ExecuteNonQuery();
con.Close();
Response.Write("<script>alert('Complaint Registered!');</script>");
//GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write("<script>alert('" + ex.Message + "');</script>");
}
}
}
}