private void BindGridViewDegree(string search) { FiltersModel fm = Session["FiltersModel"] as FiltersModel; List <HR_Emp_Qualification> _View = new List <HR_Emp_Qualification>(); List <HR_Emp_Qualification> _TempView = new List <HR_Emp_Qualification>(); ViewUserEmp LoggedInUser = HttpContext.Current.Session["LoggedUser"] as ViewUserEmp; QueryBuilder qb = new QueryBuilder(); string query = qb.QueryForReportsDepartment(LoggedInUser); DataTable dt = new DataTable(); if (query != "where") { dt = qb.GetValuesfromDB("select distinct Degree from HR_Emp_Qualification where isnull(Deleted,0)=0 and isnull(Degree,'') <> ''"); } _View = dt.ToList <HR_Emp_Qualification>(); GridViewDegree.DataSource = _View.Where(aa => aa.Degree.ToUpper().Contains(search.ToUpper())).OrderBy(aa => aa.Degree).ToList(); GridViewDegree.DataBind(); }
/// <summary> /// If there is an existing PI in the request, the pop-out form will populate with /// the PI information already stored into the database. /// /// Otherwise, a brand new, blank form will be presented to the user. /// </summary> /// <param name="piId"></param> private void BindControl(string piId) { using (ProjectTrackerContainer db = new ProjectTrackerContainer()) { IDictionary <int, string> dropDownSource = new Dictionary <int, string>(); int id = 0; Int32.TryParse(piId, out id); if (id > 0) { var query1 = db.Invests .Join(db.InvestStatus, i => i.InvestStatusId, s => s.Id, (i, s) => new { i.Id, i.FirstName, i.LastName, i.Email, i.Phone, s.StatusValue }) .Where(d => d.Id == id) .OrderBy(d => d.Id); //GridView1.DataSource = query1.ToList(); //GridView1.DataBind(); rptPI.DataSource = query1.ToList(); rptPI.DataBind(); } else { var query = db.Invests .Join(db.InvestStatus, i => i.InvestStatusId, s => s.Id, (i, s) => new { i.Id, i.FirstName, i.LastName, i.Email, i.Phone, s.StatusValue }) .Where(d => d.Id > 0) .OrderBy(d => d.Id); //GridView1.DataSource = query.ToList(); //GridView1.DataBind(); rptPI.DataSource = query.ToList(); rptPI.DataBind(); } var statusQuery = db.InvestStatus .OrderBy(d => d.DisplayOrder); ddlStatus.DataSource = statusQuery.ToList(); ddlStatus.DataValueField = "Id"; ddlStatus.DataTextField = "StatusValue"; ddlStatus.DataBind(); //uhfaculty var uhfacultyQuery = db.JabsomAffils .Where(d => d.Type == "UHFaculty") .OrderBy(d => d.Id); ddlUHFaculty.DataSource = uhfacultyQuery.ToList(); ddlUHFaculty.DataValueField = "Id"; ddlUHFaculty.DataTextField = "Name"; ddlUHFaculty.DataBind(); ddlUHFaculty.Items.Insert(0, new ListItem(String.Empty, String.Empty)); //degree var queryDegree = db.JabsomAffils .Where(d => d.Type == "Degree"); GridViewDegree.DataSource = queryDegree.ToList(); GridViewDegree.DataBind(); //department var queryDept = db.JabsomAffils .Where(d => d.Type == "Department"); GridViewDept.DataSource = queryDept.ToList(); GridViewDept.DataBind(); var queryOffice = db.JabsomAffils .Where(d => d.Type == "Office"); GridViewOffice.DataSource = queryOffice.ToList(); GridViewOffice.DataBind(); //ddlJabsomOther dropDownSource = db.JabsomAffils .Where(d => d.Type == "College") .ToDictionary(c => c.Id, c => c.Name); PageUtility.BindDropDownList(ddlJabsomOther, dropDownSource, string.Empty); var queryUHDept = db.JabsomAffils .Where(d => d.Type == "UHSchool"); GridViewUHDept.DataSource = queryUHDept.ToList(); GridViewUHDept.DataBind(); //GridViewCommunityCollege var queryCommunityCollege = db.JabsomAffils .Where(d => d.Type == "CommunityCollege"); GridViewCommunityCollege.DataSource = queryCommunityCollege.ToList(); GridViewCommunityCollege.DataBind(); //GridViewCommunityPartner var queryCommunityPartner = db.JabsomAffils .Where(d => d.Type == "CommunityPartner"); GridViewCommunityPartner.DataSource = queryCommunityPartner.ToList(); GridViewCommunityPartner.DataBind(); //ddlHospital dropDownSource = db.JabsomAffils .Where(d => d.Type == "MajorHospital") .ToDictionary(c => c.Id, c => c.Name); //PageUtility.BindDropDownList(ddlHospital, dropDownSource, String.Empty); ////GridViewHph //var queryHph = db.JabsomAffils // .Where(d => d.Type == "HawaiiPacificHealth"); //GridViewHph.DataSource = queryHph.ToList(); //GridViewHph.DataBind(); //GridViewNonUH var queryNonUH = db.JabsomAffils .Where(d => d.Type == "MajorHospital"); GridViewNonUH.DataSource = queryNonUH.ToList(); GridViewNonUH.DataBind(); //if (!Page.User.IsInRole("Admin")) //{ // btnAdd.Visible = false; // btnSave.Visible = false; //} //var principleI = db.Invests.Where(i => i.Id > 0) // .Select(x => new { FullName = x.FirstName + " " + x.LastName }); //textAreaPI.Value = Newtonsoft.Json.JsonConvert.SerializeObject(principleI); } }