public string FillServiceInfo() { string returnString = ""; ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager(); if (queryStringId != 0) { var data = _ServiceInfoManager.GetAllBySSAId(queryStringId); string ServiceCategoryValue = ddlServiceCategory.SelectedItem.Value; int ServiceCategoryId = 0; if (int.TryParse(ServiceCategoryValue, out ServiceCategoryId) && ServiceCategoryId != 0) { data = data.Where(w => w.ServiceCategoryId == ServiceCategoryId).ToList(); } var returnData = (from obj in data select new { Title = obj.Title, Longitude = obj.Longitude, Latitude = obj.Latitude, ServiceCategory = obj.ServiceCategory.Name }).ToList(); returnString = new JavaScriptSerializer().Serialize(returnData); } return(returnString); }
private void FillData() { ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager(); SSAManager _SSAManager = new SSAManager(); var user = AspNetSecurityHelper.currentAppUser; if (user != null) { var obj = _ServiceInfoManager.GetAllServiceInfo(); 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 = _ServiceInfoManager.GetAllBySSAId(ssa.Id); } else { obj = null; } } } if (obj != null) { var data = from tbl in obj select new { tbl.Id, tbl.Title, tbl.Description, tbl.Section, tbl.Address, ServiceCategory = tbl.ServiceCategory.Name, SSA = (String.IsNullOrEmpty(tbl.SaudiStudentAssociation.Name) ? "" : tbl.SaudiStudentAssociation.Name + " - ") + tbl.SaudiStudentAssociation.University.Name + (tbl.SaudiStudentAssociation.State != null ? " - " + tbl.SaudiStudentAssociation.State.Name : "") + (tbl.SaudiStudentAssociation.City != null ? " - " + tbl.SaudiStudentAssociation.City.Name : ""), ssaId = tbl.SaudiStudentAssociationId, ServiceDetailsCount = tbl.ServiceDetails.Where(w => w.DeletedFlag == false).Count() }; 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(); }
public void FillServiceInfo() { ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager(); if (queryStringId != 0) { var data = _ServiceInfoManager.GetAllBySSAId(queryStringId); string ServiceCategoryValue = ddlServiceCategory.SelectedItem.Value; int ServiceCategoryId = 0; if (int.TryParse(ServiceCategoryValue, out ServiceCategoryId) && ServiceCategoryId != 0) { data = data.Where(w => w.ServiceCategoryId == ServiceCategoryId).ToList(); } var returnData = (from obj in data select new { Id = obj.Id, Title = obj.Title, Description = obj.Description, Section = obj.Section, Address = obj.Address, Longitude = obj.Longitude, Latitude = obj.Latitude, ServiceCategory = obj.ServiceCategory.Name, ServiceDetailsCount = obj.ServiceDetails.Where(w => w.DeletedFlag == false).Count() }).ToList(); GridView1.DataSource = returnData; var locationData = (from obj in returnData select new { obj.Title, obj.Longitude, obj.Latitude, obj.ServiceCategory }).ToList(); ucLocationsMap.Locations = new JavaScriptSerializer().Serialize(locationData); } GridView1.DataBind(); }