-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCounter.aspx.cs
More file actions
89 lines (70 loc) · 2.5 KB
/
Copy pathCounter.aspx.cs
File metadata and controls
89 lines (70 loc) · 2.5 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
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Counter : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (System.Web.HttpContext.Current.Session["Seller"] as string == null)
{
Response.Redirect("Login.aspx");
}
}
protected void Button13_Click(object sender, EventArgs e)
{
try{
SqlCommand cmd = new SqlCommand("Insertcounter", new SqlConnection(ConfigurationManager.AppSettings["ConnString"]));
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Counter_code", textcode.Text);
cmd.Parameters.AddWithValue("@Name", txtname.Text);
cmd.Parameters.AddWithValue("@Location", txtlocation.Text);
cmd.Parameters.AddWithValue("@Telephone", txtphone.Text);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('The Record has been saved succefull');", true);
}
catch (Exception ex)
{
Response.Write("Error occured : " + ex.ToString());
}
}
protected void Button12_Click(object sender, EventArgs e)
{
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=JOHN-PC;Initial Catalog=Skyminerals;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from Counter where Counter_code like'" + TextBox7.Text + "%'";
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView2.DataSource = ds;
GridView2.DataBind();
SqlDataReader dr;
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
GridView1.Visible = false;
GridView2.Visible = true;
Panel1.Visible = false;
Label17.Visible = false;
}
else
{
GridView2.Visible = false;
Response.Write("<script>alert('the search term is not available in the Records');</script>");
}
}
}