Example #1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            List <FriendType> AllType = FriendTypeOp.GetAllFridens();

            FriendType type1 = new FriendType();

            type1.Fid      = 0;
            type1.Typename = "所有";
            AllType.Insert(0, type1);

            cboType.DataSource    = AllType;
            cboType.DisplayMember = "Typename";
            cboType.ValueMember   = "Fid";
        }
Example #2
0
        public static List <FriendType> GetAllFridens()
        {
            List <FriendType> friendtypes = new List <FriendType>();
            string            strsql      = "select * from FriendType";

            DataTable  dt = DBHelper.GetTable(strsql);
            FriendType friendtype;

            foreach (DataRow row in dt.Rows)
            {
                friendtype          = new FriendType();
                friendtype.Fid      = Convert.ToInt32(row[0]);
                friendtype.Typename = row[1].ToString();

                friendtypes.Add(friendtype);
            }
            return(friendtypes);
        }