Esempio n. 1
0
        void listview_DoubleClick(object sender, EventArgs e)
        {
            //得到双击的listview
            ListView listview = sender as ListView;
            //然后去设计窗口,给listview控件设置属性,MUltiSelect=false,(multiline)只允许选择一个,不许多选
            ListViewItem item    = listview.SelectedItems[0]; //拿到双击的项了,当项被双击后,被选择,这里注意:我们定义的item就可以拿到上面item存储的tag信息
            int          tableId = Convert.ToInt32(item.Tag); //获得餐桌编号,给业务逻辑层开单使用

            //如果当前餐桌是空闲状态,就进行开单操作
            if (item.ImageIndex == 0)
            {
                OrderInfoBll oiBll = new OrderInfoBll();
                if (oiBll.Kaidan(tableId))
                {
                    //打开开单界面
                    //当前餐桌的状态改为占用
                    //这里注意,点开了开单界面,并不代表下单了,可能并没有下单,
                    //使用委托事件,必须在开单界面点击了下单,才可以更换图片

                    //继续往下执行打开点菜窗体
                }
            }
            else
            {
                //如果不是空闲状态,就进行加菜操作,一样也是打开点菜窗体
            }
            OrderInfoList orderInfoList = OrderInfoList.Create();

            orderInfoList.Tag = tableId;//将餐桌编号传递过去,用于进行订单编号的查找,这样才能加菜点菜
            orderInfoList.GetTableFreeEvent += GetTableFree;
            orderInfoList.Show();
            orderInfoList.Focus();
        }
        private void listview_DoubleClick(object sender, EventArgs e)
        {
            //得到双击的listview
            ListView listView = sender as ListView;
            //当项被双击后,会被选择,得到当前选择的ListViewItem
            ListViewItem item    = listView.SelectedItems[0];
            int          tableId = Convert.ToInt32(item.Tag);

            //如果当前餐桌是空闲状态,则进行开单操作
            if (item.ImageIndex == 0)
            {
                OrderInfoBll oiBll = new OrderInfoBll();
                if (oiBll.KaiDan(tableId))
                {
                    //将当前餐桌的状态改为占用
                    item.ImageIndex = 1;
                }
            }
            else
            {
                //如果不是空闲状态,则进行加菜操作
            }
            //打开点菜窗体
            OrderInfoList orderInfoList = new OrderInfoList();

            orderInfoList.Tag = tableId;//将餐桌编号传递过去,用于进行订单编号的查找
            orderInfoList.Show();
        }
Esempio n. 3
0
        private void ListView_DoubleClick(object sender, EventArgs e)
        {
            ListView     listView     = sender as ListView;
            ListViewItem listViewItem = listView.SelectedItems[0];
            int          tId          = Convert.ToInt32(listViewItem.Tag);
            OrderInfoBll oiBll        = new OrderInfoBll();

            if (listViewItem.ImageIndex == 0)
            {
                if (oiBll.KaiDan(tId))
                {
                    listViewItem.ImageIndex = 1;
                }
            }
            else
            {
            }
            OrderInfoList oiList = new OrderInfoList();

            oiList.Tag = tId;
            oiList.Show();
        }