コード例 #1
0
        private void btnDRoom_Click(object sender, EventArgs e)
        {
            if (dgvRoom.SelectedRows.Count <= 0)
            {
                md.MsgDivShow("请选中要删除的房间", 1);
                return;
            }
            if (MessageBox.Show("确认删除该房间吗?", "删除房间", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                int id = ((RoomInfo)dgvRoom.SelectedRows[0].DataBoundItem).RoomId;

                //判断该房间下是否有餐桌,有餐桌就不删除该房间
                DeskInfoBLL dkBll = new DeskInfoBLL();
                if (dkBll.GetDeskInfoCountByRoomId(id)>0)
                {
                    md.MsgDivShow("对不起,该房间下有餐桌", 1);
                    return;
                }
                //该房间下没有餐桌--可以删除选中的房间
                RoomInfoBLL rBll = new RoomInfoBLL();
                md.MsgDivShow(rBll.SoftDeleteRoomInfoByRoomId(id) ? "操作成功" : "操作失败", 1);
                LoadAllRoomInfoByDelFlag(0);//刷新
                return;
            }
            md.MsgDivShow("您已经取消了删除该房间");
        }
コード例 #2
0
 //加载房间
 private void LoadAllRoomInfoByDelFlag(int p)
 {
     RoomInfoBLL rBll = new RoomInfoBLL();
     dgvRoom.AutoGenerateColumns = false;//禁止自动生成列
     dgvRoom.DataSource = rBll.GetAllRoomInfoByDelFlag(p);
     dgvRoom.ClearSelection();//清楚默认选中的行
 }
コード例 #3
0
ファイル: FrmMain.cs プロジェクト: GannicusJiaYufeng/Study
 //动态加载所有的房间
 private void LoadRoomInfoByDelFlag(int p)
 {
     //坑==========================================
     //加载所有的房间
     RoomInfoBLL rBll = new RoomInfoBLL();
     List<RoomInfo> listRoom = rBll.GetAllRoomInfoByDelFlag(p);
     for (int i = listRoom.Count - 1; i >= 0; i--)
     {
         TabPage tp = new TabPage();
         tp.Text = listRoom[i].RoomName;//显示房间的名字
         tp.Tag = listRoom[i];//把房间对象存储到每个tabpage控件的tag属性
         ListView lv = new ListView();//餐桌 listview这个控件可以放图片也可以放文字                lv.LargeImageList = imageList1;//设置该控件中显示图片控件
         lv.LargeImageList = imageList1;//设置该控件中显示图片控件
         lv.View = View.LargeIcon;//设置控件中的图片显示的方式
         lv.Dock = DockStyle.Fill;//设置该控件的显示方式
         lv.BackColor = Color.SeaGreen;//设置该控件的背景颜色
         lv.MultiSelect = false;//禁止多选
         //把lv添加到tabpage控件中
         tp.Controls.Add(lv);
         tabMain.TabPages.Add(tp);
     }
 }
コード例 #4
0
 private void LoadRoomInfoByDelFlag(int p)
 {
     RoomInfoBLL rBll = new RoomInfoBLL();
     List<RoomInfo> list = rBll.GetAllRoomInfoByDelFlag(p);
     list.Insert(0, new RoomInfo() { RoomName = "请选择", RoomId = -1 });
     cmbRoom.DataSource = list;
     cmbRoom.DisplayMember = "RoomName";
     cmbRoom.ValueMember = "RoomId";
 }
コード例 #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (CheckEmpty())
            {
                RoomInfo r = new RoomInfo();
                r.IsDefault = txtIsDefault.Text;//默认的编号
                r.RoomMaxNum = Convert.ToInt32(txtRPerNum.Text);//容纳人数
                r.RoomMinMoney = Convert.ToDouble(txtRMinMoney.Text);//最低消费
                r.RoomName = txtRName.Text;//名字
                r.RoomType = Convert.ToInt32(txtRType.Text);

                //增加或者修改
                if (Temp == 1)//新增
                {
                    r.DelFlag = 0;
                    r.SubBy = 1;
                    r.SubTime = System.DateTime.Now;//当前的时间
                }
                else if (Temp == 2)//修改
                {
                    r.RoomId = Convert.ToInt32(labId.Text);
                }
                RoomInfoBLL rBll = new RoomInfoBLL();
                string msg = rBll.AddOrUpdateRoomInfo(r, Temp) ? "操作成功" : "操作失败";
                md.MsgDivShow(msg, 1, Bind);
            }
        }