Ejemplo n.º 1
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            UserType identity = CurrentUser.UserType;

            switch (cmbQuery.SelectedIndex)
            {
            case 0:     // 全部
                if (identity == UserType.Resident)
                {
                    TravelBindingSource.DataSource = TravelRecordService.QueryByUserID(CurrentUser.UserId);
                }
                else if (identity == UserType.Administrator)
                {
                    TravelBindingSource.DataSource = TravelRecordService.GetAll();
                }
                break;

            case 1:     // 根据ID查询
                TravelBindingSource.DataSource = TravelRecordService.QueryByResidentID(txtQuery.Text);
                break;

            case 2:     // 根据日期查询
                DateTime dt = Convert.ToDateTime(txtQuery.Text);
                TravelBindingSource.DataSource = TravelRecordService.QuerydByDateLeave(dt);
                break;
            }
            TravelBindingSource.ResetBindings(true);
        }
Ejemplo n.º 2
0
 private void QueryAll(User user)
 {
     TravelBindingSource.DataSource = ResidentMissionService.QueryByUserId(user.UserId);
     TravelBindingSource.ResetBindings(false);
 }