示例#1
0
        private void cbo_Type_SelectedIndexChanged(object sender, EventArgs e)
        {
            AccountDAL adal = new AccountDAL();
            string     tid  = cbo_Type.SelectedValue.ToString();

            if (tid == "0")
            {
                grid_account.DataSource = adal.GetAllAccount();
            }
            else
            {
                grid_account.DataSource = adal.GetAccountByTypeId(tid);
            }
        }
示例#2
0
        public void BindData()
        {
            //绑定列表数据
            AccountDAL dal = new AccountDAL();

            grid_account.DataSource = dal.GetAllAccount();

            //绑定下拉列表框数据
            TypesDAL tdal = new TypesDAL();

            cbo_Type.ValueMember   = "Id";
            cbo_Type.DisplayMember = "Name";
            List <Type> list = new List <Type>()
            {
                new Type {
                    Id = 0, Name = "-全部-"
                }
            };

            list.AddRange(tdal.GetAllType());

            cbo_Type.DataSource = list;
        }