Traditional Culture Encyclopedia - Hotel reservation - A hotel management system is built using C#.NET and SQL. I want to use BUTTON colors to visually reflect the status of hotel rooms. How should I write the code?
A hotel management system is built using C#.NET and SQL. I want to use BUTTON colors to visually reflect the status of hotel rooms. How should I write the code?
Make a corresponding relationship between the button and the room, and then change the background color of the button according to the status retrieved from the database
struct BtnRoom
{
p>
public Button button;
public string value;
public bool state;
public BtnRoom(Button btn, string room)
{
button = btn;
value = room;
state = false;
}
}
BtnRoom[] btnroom = { new BtnRoom(this.Button0, "r3008"), new BtnRoom(Button1, "r3008"), new BtnRoom(Button2, "r3008"), new BtnRoom(Button3, "r3008"), new BtnRoom(Button4, "r3008"), new BtnRoom(Button5, "r3008") };
//Replace the following with the statement to get the room status from the database , just set it according to the status
for (int i = 0; i < 6; i++)
{
if (i % 2 == 0)
{
btnroom[i].state = true;
btnroom[i].button.BackColor = Color.Green;
}
}
- Previous article:Where is Cai Feng Road Community?
- Next article:How is employment in Haid?
- Related articles
- Guangzhou parking lot hotel
- The glorious history of Mingfa Group Co., Ltd.
- How to get from the South Square of Ningbo Railway Station to the North Square of Ningbo Railway Station?
- Customer networking event planning plan
- Which is the cheapest hotel near shenzhen huaqiang Seg Square, which is more cost-effective than Seven Days Hotel and Home Inn?
- What resettlement houses are there in Dagang, Zhenjiang New District?
- Hotel nurse seal
- How about Conghua Wanggu Hot Spring Resort?
- Hotel hug
- Is Dibao Kingdom Hotel in Disney?