protected void bindQuarter() { drpQuarter.DataSource = changeReuestId > 0 ? Quarters.GetQuartersByChangeRequestId(changeReuestId) : Quarters.GetAllVacantQuarters(Convert.ToInt64(drpQuarterCatergory.SelectedValue)); drpQuarter.DataBind(); drpQuarter.Items.Insert(0, new ListItem("-select--", "-1")); }
private void BindPriorityListGrid() { List <AllotementApplication> lstAllottmentApplication = AllotementApplications.GetPendingApplications(ApplicationStatus.Verified, Convert.ToInt64(drpQuarterCatergory.SelectedValue)); //lstAllottmentApplication = lstAllottmentApplication.OrderBy(x => x.UserName).ToList(); //Order by name long floor = 2; //First floor if (!string.IsNullOrEmpty(Request["type"]) && Convert.ToString(Request["type"]) == "medical") { floor = 1; //Ground floor } List <Quarerinfo> lstQuarterInfo = Quarters.GetAllVacantQuarters(Convert.ToInt64(drpQuarterCatergory.SelectedValue)); if (floor == 2) { lstQuarterInfo = lstQuarterInfo.Where(quarter => quarter.QuarterNumber.Contains('A') || quarter.QuarterNumber.Contains('B') || quarter.QuarterNumber.Contains('C') || quarter.QuarterNumber.Contains('D')).ToList(); } else if (floor == 1) { lstQuarterInfo = lstQuarterInfo.Where(quarter => !(quarter.QuarterNumber.Contains('A') || quarter.QuarterNumber.Contains('B') || quarter.QuarterNumber.Contains('C') || quarter.QuarterNumber.Contains('D'))).ToList(); if (lstAllottmentApplication != null) { //Filter allotment applications as per medical conditions lstAllottmentApplication = lstAllottmentApplication.Where(x => x.MedicalCategory).ToList(); } } lstQuarterInfo = lstQuarterInfo.Take(lstAllottmentApplication.Count).ToList(); //Taking as many records there int totalApplications = Math.Min(lstAllottmentApplication.Count, lstQuarterInfo.Count); for (int count = 0; count < totalApplications; count++) { string quarterNumber = "N/A"; if (lstQuarterInfo.Any() && lstQuarterInfo[count] != null && !string.IsNullOrEmpty(lstQuarterInfo[count].QuarterNumber)) { quarterNumber = lstQuarterInfo[count].QuarterNumber; } lstAllottmentApplication[count].QuarterNumber = quarterNumber; } grdQuarters.DataSource = lstAllottmentApplication; grdQuarters.DataBind(); }