• 大小: 0.06M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2024-04-23
  • 语言: C#
  • 标签: 例子  酒店  管理  

资源简介

管理酒店房间

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsListView
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitOpertion();      
            Load += Form1_Load;  
        }

        private void Form1_Load(object sender EventArgs e)
        {
            listView1.LargeImageList = imageList1;
            //listView1.Margin = new Padding(4);
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    listView1.Items.Add($“{i+1}00{j+1}“ “空闲“);   
                }
            }
            InitEmptyRoom();
        }

        private void InitOpertion()
        {
            foreach (Control item in grpOpertion.Controls)
            {
                if (item is Button)
                {
                    item.Enabled = false;
                }
            }
        }
        private void InitEmptyRoom() 
        {
            comboBox1.Items.Clear();
            foreach (ListViewItem item in listView1.Items)
            {
                if (item.ImageKey==“空闲“)
                {
                    comboBox1.Items.Add(item.Text);
                }
            }
        }

        private void listView1_SelectedIndexChanged(object sender EventArgs e)
        {
            InitOpertion();
            InitEmptyRoom();
            if (listView1.SelectedItems.Count == 0)
            {                      
                return;
            }              
            var room = listView1.SelectedItems[0];        
            switch (room.ImageKey)
            {
                case “空闲“:
                    btnOpen.Enabled = true;
                    btnWaitRepair.Enabled = true;
                    break;
                case “占用“:
                    btnExit.Enabled = true;
                    btnChange.Enabled = true;     
                    break;
                case “待打扫“:
                    btnClear.Enabled = true;
                    btnWaitRepair.Enabled = true;
                    break;
                case “维修“:
                    btnRepari.Enabled = true;
                    break;    
                default:
                    break;
            }          
        }

        private void btnOpen_Click(object sender EventArgs e)
        {
            listView1.SelectedItems[0].ImageKey=“占用“;
            listView1_SelectedIndexChanged(null null);
        }

        private void btnExit_Click(object sender EventArgs e)
        {
            listView1.SelectedItems[0].ImageKey = “待打扫“;
            listView1_SelectedIndexChanged(null null);
        }

        private void btnClear_Click(object 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     26112  2021-02-05 11:02  WindowsFormsListView\.vs\WindowsFormsListView\v16\.suo

     文件        189  2021-02-05 08:41  WindowsFormsListView\App.config

     文件      44032  2021-02-05 11:01  WindowsFormsListView\bin\Debug\WindowsFormsListView.exe

     文件        189  2021-02-05 08:41  WindowsFormsListView\bin\Debug\WindowsFormsListView.exe.config

     文件      36352  2021-02-05 11:01  WindowsFormsListView\bin\Debug\WindowsFormsListView.pdb

     文件       4088  2021-02-05 11:01  WindowsFormsListView\Form1.cs

     文件       8998  2021-02-05 10:46  WindowsFormsListView\Form1.Designer.cs

     文件      52284  2021-02-05 10:46  WindowsFormsListView\Form1.resx

     文件       3102  2021-02-05 08:45  WindowsFormsListView\Images\占用.png

     文件       3114  2021-02-05 08:46  WindowsFormsListView\Images\待打扫.png

     文件       3086  2021-02-05 08:46  WindowsFormsListView\Images\空闲.png

     文件       2975  2021-02-05 08:45  WindowsFormsListView\Images\维修.png

     文件        214  2021-02-05 08:41  WindowsFormsListView\obj\Debug\.NETframeworkVersion=v4.7.2.AssemblyAttributes.cs

     文件        823  2021-02-05 08:41  WindowsFormsListView\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7152  2021-02-05 08:53  WindowsFormsListView\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件         42  2021-02-05 08:54  WindowsFormsListView\obj\Debug\WindowsFormsListView.csproj.CoreCompileInputs.cache

     文件        875  2021-02-05 08:54  WindowsFormsListView\obj\Debug\WindowsFormsListView.csproj.FileListAbsolute.txt

     文件       1012  2021-02-05 10:46  WindowsFormsListView\obj\Debug\WindowsFormsListView.csproj.GenerateResource.cache

     文件        424  2021-02-05 10:09  WindowsFormsListView\obj\Debug\WindowsFormsListView.csprojAssemblyReference.cache

     文件      44032  2021-02-05 11:01  WindowsFormsListView\obj\Debug\WindowsFormsListView.exe

     文件      30960  2021-02-05 10:46  WindowsFormsListView\obj\Debug\WindowsFormsListView.Form1.resources

     文件      36352  2021-02-05 11:01  WindowsFormsListView\obj\Debug\WindowsFormsListView.pdb

     文件        180  2021-02-05 08:54  WindowsFormsListView\obj\Debug\WindowsFormsListView.Properties.Resources.resources

     文件        532  2021-02-05 08:41  WindowsFormsListView\Program.cs

     文件       1332  2021-02-05 08:41  WindowsFormsListView\Properties\AssemblyInfo.cs

     文件       2853  2021-02-05 08:41  WindowsFormsListView\Properties\Resources.Designer.cs

     文件       5612  2021-02-05 08:41  WindowsFormsListView\Properties\Resources.resx

     文件       1107  2021-02-05 08:41  WindowsFormsListView\Properties\Settings.Designer.cs

     文件        249  2021-02-05 08:41  WindowsFormsListView\Properties\Settings.settings

     文件       3693  2021-02-05 08:54  WindowsFormsListView\WindowsFormsListView.csproj

............此处省略16个文件信息

评论

共有 条评论