private void FillData() { if (queryStringId != 0) { FAQManager _FAQManager = new FAQManager(); var obj = _FAQManager.GetAllBySSAId(queryStringId).ToList(); if (obj != null) { rptData.DataSource = obj; } } rptData.DataBind(); }
private void FillData() { FAQManager _FAQManager = new FAQManager(); SSAManager _SSAManager = new SSAManager(); var user = AspNetSecurityHelper.currentAppUser; if (user != null) { var obj = _FAQManager.GetAllFAQ(); if (user.UserTypeId == 2) // Supervisor { if (user.UniversityId.HasValue) { var ssa = _SSAManager.GetSSAByUniversityId(user.UniversityId.Value); //var ssa = _SSAManager.GetSSAByAdministratorId(user.Id); if (ssa != null) { obj = _FAQManager.GetAllBySSAId(ssa.Id); } else { obj = null; } } } if (obj != null) { var data = from tbl in obj select new { tbl.Id, tbl.Question, tbl.Answer, SSA = tbl.SaudiStudentAssociation.University.Name + (tbl.SaudiStudentAssociation.State != null ? " - " + tbl.SaudiStudentAssociation.State.Name : "") + (tbl.SaudiStudentAssociation.City != null ? " - " + tbl.SaudiStudentAssociation.City.Name : "") + (String.IsNullOrEmpty(tbl.SaudiStudentAssociation.Name) ? "" : " - " + tbl.SaudiStudentAssociation.Name), ssaId = tbl.SaudiStudentAssociationId }; string ssa = ddlSSA.SelectedValue; int ssaId = 0; if (int.TryParse(ssa, out ssaId) && ssaId != 0) { data = data.Where(w => w.ssaId == ssaId).ToList(); } GridView1.DataSource = data.ToList(); } } GridView1.DataBind(); }