using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.SqlClient; using System.Data; using System.Configuration; /// /// Summary description for AgentDAL /// public class AgentDAL { public AgentDAL() { // // TODO: Add constructor logic here // } static SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ToString()); SqlCommand cmd; SqlDataReader dr; internal static System.Data.DataSet GetCenterID(string CenterID) { SqlDataAdapter da = new SqlDataAdapter("sp_Agent", con); DataSet ds=new DataSet(); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@Type", "s"); da.Fill(ds); return ds; } internal static bool AgentLoginMethod(string username,string password,string Role) { try { bool status; SqlCommand cmd = new SqlCommand("Select UserName,Password,Role from Registration where UserName='" + username + "' and Password='" + password + "'and Role='" + Role + "'", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { username = dr[0].ToString(); password = dr[1].ToString(); status = true; } else status = false; return status; } catch (Exception ex) { throw ex; } finally { con.Close(); } } internal static DataSet GetAgentID(string AgentID) { SqlDataAdapter da = new SqlDataAdapter("sp_Agent", con); DataSet ds = new DataSet(); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@Type", "a"); da.Fill(ds); return ds; } internal static bool EmpLoginMethod(string p, string p_2) { try { bool status; SqlCommand cmd = new SqlCommand("Select UserName,Password from emplogin where UserName='" + p + "' and Password='" + p_2 + "'", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { p = dr[0].ToString(); p_2 = dr[1].ToString(); status = true; } else status = false; return status; } catch (Exception ex) { throw ex; } finally { con.Close(); } } internal static DataSet validateuser(string UserName, string Password, string CenterID) { SqlDataAdapter da = new SqlDataAdapter("sp_Reg", con); DataSet ds = new DataSet(); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@UserName", UserName); da.SelectCommand.Parameters.AddWithValue("@Password", Password); da.SelectCommand.Parameters.AddWithValue("@CenterId", CenterID); da.SelectCommand.Parameters.AddWithValue("@Type", "v"); da.Fill(ds); return ds; } }