using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using System.Configuration; /// /// Summary description for AdminDAL /// public class AdminDAL { public AdminDAL() { // // TODO: Add constructor logic here // } static SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ToString()); internal static int InsertAgentDetails(string FirstName, string LastName, string CenterID, string UserName, string Password, string EmailID, string PhoneNo, string Address) { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand("sp_Admin", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@FirstName", FirstName); cmd.Parameters.AddWithValue("@LastName", LastName); cmd.Parameters.AddWithValue("@CenterID", CenterID); cmd.Parameters.AddWithValue("@UserName", UserName); cmd.Parameters.AddWithValue("@Password", Password); cmd.Parameters.AddWithValue("@EmailID", EmailID); cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo); cmd.Parameters.AddWithValue("@Address", Address); cmd.Parameters.AddWithValue("@Type", "i"); try { return cmd.ExecuteNonQuery(); } catch { throw; } finally { con.Close(); cmd.Dispose(); } } public static bool AdminloginMethod(string username, string password) { try { bool status; SqlCommand cmd = new SqlCommand("Select username,password from AdminLogin where username='" + username + "' and password='" + password + "'", 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(); } } }