private void RoomForm_Load(object sender, EventArgs e) { List <RoomType> roomList = new List <RoomType>(); roomList.Add(new RoomType(0, "全部")); roomList.AddRange(rm.GetRoomType()); combType.DataSource = roomList; combType.DisplayMember = "TypeName"; ShowAllInfo(); cbxState.SelectedIndex = 0; }
private void RoomDetailForm_Load(object sender, EventArgs e) { txtPrice.Enabled = false; cboTypeName.DataSource = rm.GetRoomType(); cboTypeName.DisplayMember = "TypeName"; if (thisRoomID != 0) { txtRoomNumberDown.Text = thisRoom.Number.ToString(); txtGuestNumber.Text = thisRoom.GuestNumber.ToString(); txtBedNumber.Text = thisRoom.BedNumber.ToString(); cboState.Text = thisRoom.State.ToString(); txtDescription.Text = thisRoom.Description; cboTypeName.Text = rm.GetTypeNameByTypeID(Convert.ToInt32(thisRoom.TypeID)).ToString(); txtPrice.Text = rm.GetTypePriceByTypeID(Convert.ToInt32(thisRoom.TypeID)).ToString(); } else { cboState.SelectedIndex = cboTypeName.SelectedIndex = -1; } }