Skip to content

Commit 6ecf485

Browse files
author
Ankit-Er
committed
commit now
0 parents  commit 6ecf485

File tree

108 files changed

+46040
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+46040
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace Sql_Inject
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}

Sql_Inject/Classes/BussLayer.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Linq;
5+
using System.Web;
6+
7+
namespace Sql_Inject.Classes
8+
{
9+
public class BussLayer
10+
{
11+
private DBLayer db;
12+
13+
public BussLayer() {
14+
db = new DBLayer();
15+
}
16+
17+
public String getRecords(String employeeId, String Pswd)
18+
{
19+
//String q = "select * from temp where empid = @EmpId and Passwd= @Pswd";
20+
//DataTable dt = db.executeQuery(q, employeeId,Pswd);
21+
22+
DataTable dt = db.executeQuery(employeeId,Pswd);
23+
24+
if (dt != null && dt.Rows.Count > 0)
25+
{
26+
return dt.Rows[0][1].ToString();
27+
}
28+
else
29+
{
30+
return null;
31+
}
32+
}
33+
}
34+
}

Sql_Inject/Classes/DBLayer.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Data;
6+
using System.Data.SqlClient;
7+
using System.Configuration;
8+
9+
namespace Sql_Inject.Classes
10+
{
11+
public class DBLayer
12+
{
13+
SqlConnection con;
14+
SqlCommand cmd;
15+
16+
public DataTable executeQuery(String query, String Uid, String Passwd)
17+
{
18+
DataTable dt = null;
19+
using (con = new SqlConnection(ConfigurationManager.AppSettings["ConString"] + ""))
20+
{
21+
if (ConnectionState.Closed == con.State)
22+
con.Open();
23+
cmd = new SqlCommand(query, con);
24+
cmd.Parameters.AddWithValue("@EmpId", Uid);
25+
cmd.Parameters.AddWithValue("@Pswd", Passwd);
26+
SqlDataAdapter sda = new SqlDataAdapter(cmd);
27+
//sda.SelectCommand = cmd;
28+
dt = new DataTable();
29+
30+
sda.Fill(dt);
31+
return dt;
32+
33+
}
34+
}
35+
36+
public DataTable executeQuery(String Uid, String Passwd)
37+
{
38+
DataTable dt = null;
39+
using (con = new SqlConnection(ConfigurationManager.AppSettings["ConString"] + ""))
40+
{
41+
if (ConnectionState.Closed == con.State)
42+
con.Open();
43+
cmd = new SqlCommand("proc_", con);
44+
cmd.CommandType = CommandType.StoredProcedure;
45+
cmd.Parameters.AddWithValue("@EmpId", Uid);
46+
cmd.Parameters.AddWithValue("@Pswd", Passwd);
47+
SqlDataAdapter sda = new SqlDataAdapter(cmd);
48+
//sda.SelectCommand = cmd;
49+
dt = new DataTable();
50+
51+
sda.Fill(dt);
52+
return dt;
53+
54+
}
55+
}
56+
57+
}
58+
}

Sql_Inject/Content/Site.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
body {
2+
padding-top: 50px;
3+
padding-bottom: 20px;
4+
}
5+
6+
/* Set padding to keep content from hitting the edges */
7+
.body-content {
8+
padding-left: 15px;
9+
padding-right: 15px;
10+
}
11+
12+
/* Set width on the form input elements since they're 100% wide by default */
13+
input,
14+
select,
15+
textarea {
16+
max-width: 280px;
17+
}
18+

0 commit comments

Comments
 (0)