Ejemplo n.º 1
0
        public AdminDetails adminname(string userid)
        {
            //string h = "hemanth";
            //List<AdminDetails> ad1 = new List<AdminDetails>();
            model.AdminDetails det     = new model.AdminDetails();
            SqlConnection      connect = ConnectionHandler.getConnection();

            connect.Open();
            SqlCommand cmd = new SqlCommand("select * from adminDetails where username=@userid", connect);

            cmd.Parameters.AddWithValue("@userid", userid);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds);
            connect.Close();
            DataTable dt = ds.Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                det.Userid   = dr["username"].ToString();
                det.Password = dr["password_admin"].ToString();
                //ad1.Add(new AdminDetails(dr["username"].ToString(), dr["password_admin"].ToString()));
                //string ad = ad;
            }
            return(det);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Details ad = new Details();

            model.AdminDetails det = new model.AdminDetails();
            det         = ad.adminname(Session["adminlogin"].ToString());
            Label1.Text = det.Userid;
            string s = Session["adminlogin"].ToString();

            if (s == null)
            {
                Response.Redirect("Login.aspx");
            }
        }