-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patha_manage_vendors.aspx.cs
75 lines (67 loc) · 2.93 KB
/
a_manage_vendors.aspx.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Configuration;
using System.Data;
public partial class Default2 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from login where username='" + Session["username"] + "'";
//str = "SELECT tbl_faculty.f_id,tbl_faculty.f_username,tbl_faculty.dob,tbl_faculty.gender,tbl_fac_info.profession, tbl_fac_info.work_experience,tbl_fac_info.cat_name,tbl_fac_info.course_name,tbl_fac_info.state,tbl_fac_info.city,tbl_fac_info.area,tbl_fac_info.address,tbl_fac_info.fee,tbl_fac_info.phone_no FROM tbl_faculty INNER JOIN tbl_fac_info ON tbl_faculty.f_username=tbl_fac_info.f_username where f_id ='" + Session["l_id"] + "'";
com = new SqlCommand(str, con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
Label100.Text = ds.Tables[0].Rows[0]["username"].ToString();
Label100.Visible = false;
}
catch
{
Response.Write("<script>alert('First you have to login');window.location.href='Default.aspx';</Script>");
}
}
protected void Search_Click(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand("select photo,name,email,username from vendor_signup where category='" + DropDownList2.SelectedItem.Text + "' AND subcategory='" + DropDownList3.SelectedItem.Text + "' AND CITY='" + DropDownList4.SelectedItem.Text + "' ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
con.Open();
cmd.ExecuteScalar();
da.Fill(ds);
Repeater1.DataSource = ds.Tables[0];
Repeater1.DataBind();
con.Close();
}
catch
{
Response.Write("<script>alert('No Vendor Found Under This Category')</Script>");
}
}
public void Button1_click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cd = new SqlCommand("delete from vendor_signup where username='"+Label1.Text+"' ",con);
SqlCommand cnd = new SqlCommand("delete from login where username='" + Label1.Text + "' ", con);
con.Open();
cd.ExecuteNonQuery();
cnd.ExecuteNonQuery();
con.Close();
}
}