List <BindItem> GetBindItemList() { var entities = new Models.PriceCheckerEntities(); var arbo = new BO.AllotmentRecordBO(entities); var rtbo = new BO.AllotmentRoomTypeBO(entities); var hbo = new BO.HotelBO(entities); var rr = arbo.GetQueryable(); var rts = rtbo.GetQueryable(); var hh = hbo.GetQueryable(null); var qq = from r in rr join rt in rts on r.AllotmentRoomTypeId equals rt.RecordId join h in hh on rt.HotelId equals h.HotelId where h.CheckAllotment & r.CurrentAllotment < rt.DefaultAllotment && !r.Acknowledged & !rt.IgnoreThisRoomType select new BindItem { Acknowledged = r.Acknowledged, HotelId = h.HotelId, HotelName = h.HotelName, AllotmentDate = r.AllotmentDate, RecordId = r.RecordId, RoomName = rt.RoomName, // Allotment = r.CurrentAllotment }; var lst = qq.OrderBy(q => q.HotelName).ThenBy(q => q.RoomName).ToList(); return(lst); }
List <BindingItem> GetBindingItemList() { var entities = new Models.PriceCheckerEntities(); rtbo = new BO.AllotmentRoomTypeBO(entities); rbo = new BO.AllotmentRecordBO(entities); var rts = rtbo.GetQueryable(); var rr = rbo.GetQueryable(); var qq = from r in rr join rt in rts on r.AllotmentRoomTypeId equals rt.RecordId where rt.HotelId == _hotel.HotelId && r.CurrentAllotment < rt.DefaultAllotment & !rt.IgnoreThisRoomType select new { rt, r }; if (_currentRoomType != null && _currentRoomType.RecordId != 0) { qq = qq.Where(x => x.rt.RecordId == _currentRoomType.RecordId); } if (cxNotAcknowledgedOnly.Checked) { qq = qq.Where(q => !q.r.Acknowledged); } var items = qq.Select(x => new BindingItem { Acknowledged = x.r.Acknowledged, CurrentAllotment = x.r.CurrentAllotment, Date = x.r.AllotmentDate, RecordId = x.r.RecordId, RoomName = x.rt.RoomName }).OrderBy(x => x.Acknowledged).ThenBy(x => x.RoomName).ThenBy(x => x.Date).ToList(); return(items); }
void BindRoomTypes() { var rbo = new BO.AllotmentRoomTypeBO(); var rr = rbo.GetQueryable(_h.HotelId).ToList(); var bs = new BindingSource(); bs.DataSource = rr; dgAllotmentRoomTypes.DataSource = bs; }
private void FrmAllotmentRecordViewer_Load(object sender, EventArgs e) { cxNotAcknowledgedOnly.Checked = true; BindData(); this.Text = "View allotment for hotel \"" + _hotel.HotelName + "\""; var itemAll = new Models.AllotmentRoomType { RoomName = "All Rooms" }; cmbRoomTypes.Items.Add(itemAll); var rtbo = new BO.AllotmentRoomTypeBO(); var rts = rtbo.GetQueryable().Where(x => x.HotelId == _hotel.HotelId).ToList(); foreach (var rt in rts) { cmbRoomTypes.Items.Add(rt); } cmbRoomTypes.SelectedIndex = 0; }