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); }
void BindAllotmentHotels() { var hbo = new BO.HotelBO(); var hh = hbo.GetQueryable(null).Where(h => h.CheckAllotment).OrderBy(h => h.HotelName).ToList(); dgAllotmentHotels.DataSource = hh; }
public frmHotelEditor(int hotelId) { ctbo = new BO.CityBO(); InitializeComponent(); hbo = new BO.HotelBO(); _hotel = hbo.GetHotel(hotelId); InitializeDataView(); }
public frmHotelEditor() { InitializeComponent(); hbo = new BO.HotelBO(); _hotel = new Models.Hotel(); InitializeDataView(); ctbo = new BO.CityBO(); }
void BindHotels() { hbo = new BO.HotelBO(); var hh = hbo.GetQueryable(null).Where(h => h.CheckAllotment).OrderBy(h => h.HotelName).ToList(); lstHotelList.DataSource = hh; lstHotelList.ClearSelected(); }
void BindHotels() { var star = string.IsNullOrEmpty(txtStar.Text) ? 0 : int.Parse(txtStar.Text); var hbo = new BO.HotelBO(); var ihotels = hbo.GetQueryable(null).Where(h => h.StarRating >= star); if (cxActiveOnly.Checked) { ihotels = ihotels.Where(h => !h.IsDuplicated); } var bs = new BindingSource(); bs.DataSource = ihotels.OrderBy(x => x.HotelName).ToList(); dgHotels.DataSource = bs; }
private void frmAllotmentRoomTypeEditor_Load(object sender, EventArgs e) { if (_rt.RecordId != 0) { txtDefaultAllotment.Text = _rt.DefaultAllotment.ToString(); txtRoomName.Text = _rt.RoomName; cxIgnoreThis.Checked = _rt.IgnoreThisRoomType; btnAction.Text = "Update"; } else { btnAction.Text = "Add"; btnDelete.Enabled = false; txtDefaultAllotment.Text = "1"; } var hbo = new BO.HotelBO(); _hotel = hbo.GetHotel(_rt.HotelId); lblHotelName.Text = _hotel.HotelName; }
private void btnImport_Click(object sender, EventArgs e) { var dlg = new OpenFileDialog(); dlg.ShowDialog(); var path = dlg.FileName; if (string.IsNullOrEmpty(path)) { return; } var dicColumns = new Dictionary <string, int>(); var csv = new CsvReader(File.OpenText(path)); csv.Read(); csv.ReadHeader(); var headerRow = csv.Context.HeaderRecord; for (var i = 0; i < headerRow.Count(); i++) { var name = headerRow[i]; dicColumns.Add(name, i); } var records = csv.GetRecords <CsvRow>(); foreach (var record in records) { var hbo = new BO.HotelBO(); var hotel = hbo.GetHotel(record.HotelName); if (hotel == null) { hotel = hbo.GetQueryable(null).SingleOrDefault(h => h.HMSID == record.Id); } if (hotel == null) { hotel = new Models.Hotel(); hotel.CheckAllotment = true; } hotel.HotelName = record.HotelName; hotel.HMSID = record.Id; hotel.StarRating = decimal.Parse(record.StarRating); if (hotel.CityId == 43 || hotel.CityId == 0)//43 is unknown { var cbo = new BO.CityBO(); var c = cbo.GetQueryable().FirstOrDefault(f => f.CityCode == record.CityCode); if (c == null) { c = new Models.City(); c.CityCode = record.CityCode; c.CityName = record.CityCode; c.HasAirport = false; cbo.Add(c); } hotel.CityId = c.CityId; } if (hotel.HotelId == 0) { hbo.Add(hotel); } else { hbo.Save(); } } MessageBox.Show("Done"); }