Exemplo n.º 1
0
        private void LoadUserType()
        {
            List <UserTypeDetails> list = bluser.GetAllUserType();
            UserTypeDetails        utd  = new UserTypeDetails();

            utd.UserType = "Choose UserType";
            list.Insert(0, utd);
            cboUserType.DataSource    = list;
            cboUserType.DisplayMember = "UserType";
            cboUserType.ValueMember   = "UserType";
            cboUserType.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        public List <UserTypeDetails> GetAllUserType()
        {
            List <UserTypeDetails> list = new List <UserTypeDetails>();
            SqlConnection          con  = new SqlConnection("Data Source=PRASHISH\\SQLEXPRESS; Integrated Security=true; Database=BroadwayDB;");
            SqlCommand             cmd  = new SqlCommand("SELECT tblUser.UserId, tblUser.Username, tblUser.Password, tblUserType.UserType FROM tblUser INNER JOIN tblUserType ON tblUser.UsertypeId = tblUserType.UserTypeId");
            SqlDataReader          dr   = null;

            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                UserTypeDetails ud = new UserTypeDetails();
                ud.UserTypeId = (int)dr["UserTypeId"];
                ud.UserType   = (string)dr["UserType"];
                list.Add(ud);
            }
            dr.Close();
            con.Close();
            return(list);
        }