예제 #1
0
        public static int deleteroom(RoomTypeMDL rt)
        {
            string sql = "delete from roomtype where rtid=@rtid";
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@rtid", rt.rtid));
            return(DBhelper.MyExecuteNonQuery(sql, list.ToArray()));
        }
예제 #2
0
        public static int insertroom(RoomTypeMDL rt)
        {
            string sql = "insert into roomtype(rtname,rtmount) values(@rtname,@rtmount)";
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@rtname", rt.rtname));
            list.Add(new SqlParameter("@rtmount", rt.rtmount));
            return(DBhelper.MyExecuteNonQuery(sql, list.ToArray()));
        }
예제 #3
0
        public static int updateroom(RoomTypeMDL rt)
        {
            string sql = "update roomtype set rtname=@rtname,rtmount=@rtmount where rtid=@rtid";
            List <SqlParameter> list = new List <SqlParameter>();

            list.Add(new SqlParameter("@rtname", rt.rtname));
            list.Add(new SqlParameter("@rtmount", rt.rtmount));
            list.Add(new SqlParameter("@rtid", rt.rtid));
            return(DBhelper.MyExecuteNonQuery(sql, list.ToArray()));
        }
예제 #4
0
        public static List <TablesMDL> getlist(RoomTypeMDL rt)
        {
            string sql = "select * from tables a join roomtype b on a.rtid=b.rtid where 1=1";
            List <SqlParameter> list1 = new List <SqlParameter>();

            if (rt != null)
            {
                if (rt.rtname != "")
                {
                    sql += " and b.rtname=@rtname";
                    list1.Add(new SqlParameter("@rtname", rt.rtname));
                }
            }
            List <TablesMDL> list = new List <TablesMDL>();

            using (SqlDataReader sda = DBhelper.MySqlDataReader(sql, list1.ToArray()))
            {
                while (sda.Read())
                {
                    TablesMDL tb = new TablesMDL();
                    tb.tablename = sda[1].ToString();
                    tb.tablearea = sda[3].ToString();
                    if (Convert.ToInt32(sda["tablestate"]) == 0)
                    {
                        tb.tablestate = "可用";
                    }
                    else if (Convert.ToInt32(sda["tablestate"]) == 1)
                    {
                        tb.tablestate = "占用";
                    }
                    else if (Convert.ToInt32(sda["tablestate"]) == 2)
                    {
                        tb.tablestate = "预订";
                    }
                    else if (Convert.ToInt32(sda["tablestate"]) == 3)
                    {
                        tb.tablestate = "停用";
                    }
                    tb.rtid    = sda[6].ToString();
                    tb.tableid = Convert.ToInt32(sda[0]);
                    list.Add(tb);
                }
            }
            return(list);
        }
예제 #5
0
        //梁晨煜
        public static List <RoomTypeMDL> getlist()
        {
            string             sql  = "select * from roomtype ";
            List <RoomTypeMDL> list = new List <RoomTypeMDL>();

            using (SqlDataReader sda = DBhelper.MySqlDataReader(sql, null))
            {
                while (sda.Read())
                {
                    RoomTypeMDL rt = new RoomTypeMDL();
                    rt.rtid    = Convert.ToInt32(sda["rtid"]);
                    rt.rtname  = sda[1].ToString();
                    rt.rtmount = Convert.ToInt32(sda[4]);
                    list.Add(rt);
                }
                return(list);
            }
        }
예제 #6
0
        /// <summary>
        /// 查询房间
        /// </summary>
        /// <returns>l房间对象集合</returns>
        public static List <RoomTypeMDL> selectRoom()
        {
            string sql = "select * from RoomType";

            SqlDataReader      dr   = DBhelper.MySqlDataReader(sql, null);
            List <RoomTypeMDL> list = new List <RoomTypeMDL>();

            while (dr.Read())
            {
                RoomTypeMDL rt = new RoomTypeMDL();
                rt.RTID      = Convert.ToInt32(dr[0]);
                rt.RTName    = dr[1].ToString();
                rt.RTConsume = Convert.ToDouble(dr[2]);
                //rt.RTIsDisCount = Convert.ToInt32(dr[3]);
                rt.RTMount = Convert.ToInt32(dr[4]);
                list.Add(rt);
            }
            dr.Close();
            return(list);
        }
예제 #7
0
파일: FrmEditRoom.cs 프로젝트: wrj0823/RMS
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         errorProvider1.SetError(textBox1, "房间名称不允许为空");
         return;
     }
     if (textBox2.Text == "")
     {
         errorProvider1.SetError(textBox2, "容纳人数不允许为空");
         return;
     }
     try
     {
         if (RoomTypeMDL.ui == 1)
         {
             RoomTypeMDL rt = new RoomTypeMDL();
             rt.rtname  = textBox1.Text;
             rt.rtmount = int.Parse(textBox2.Text);
             RoomTypeBLL.insertroom(rt);
             this.Close();
         }
         else
         {
             List <RoomTypeMDL> list = new List <RoomTypeMDL>();
             RoomTypeMDL        rt   = new RoomTypeMDL();
             rt.rtname  = textBox1.Text;
             rt.rtmount = int.Parse(textBox2.Text);
             rt.rtid    = RoomTypeMDL.tid;
             RoomTypeBLL.updateroom(rt);
             this.Close();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #8
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string combo = comboBox1.Text;

            if (combo == "全部")
            {
                combo = "";
            }
            RoomTypeMDL rt = new RoomTypeMDL();

            rt.rtname = combo;
            listView2.Items.Clear();
            List <TablesMDL> list1 = TablesBLL.getlist(rt);

            foreach (TablesMDL item in list1)
            {
                ListViewItem lv = new ListViewItem(item.tablename.ToString());
                lv.SubItems.Add(item.rtid);
                lv.SubItems.Add(item.tablestate.ToString());
                lv.SubItems.Add(item.tablearea.ToString());
                lv.SubItems.Add(item.tableid.ToString());
                listView2.Items.Add(lv);
            }
        }
예제 #9
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         //判断房间类型是否有桌子
         List <TablesMDL> list = TablesBLL.selectTable(Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text));
         //判断
         if (list.Count > 0)
         {
             new Warning("无法删除有餐桌的房间", 图标.Erro).Show();
             return;
         }
         RoomTypeMDL rt1 = new RoomTypeMDL();
         rt1.rtid = Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text);
         RoomTypeBLL.deleteroom(rt1);
         listView1.Items.Clear();
         listView2.Items.Clear();
         设置_Load(null, null);
     }
     else
     {
         MessageBox.Show("请选中一项数据");
     }
 }
예제 #10
0
파일: TablesBLL.cs 프로젝트: wrj0823/RMS
 //梁晨煜
 public static List <TablesMDL> getlist(RoomTypeMDL rt)
 {
     return(TablesDAL.getlist(rt));
 }
예제 #11
0
파일: RoomTypeBLL.cs 프로젝트: wrj0823/RMS
 public static int deleteroom(RoomTypeMDL rt)
 {
     return(RoomTypeDAL.deleteroom(rt));
 }
예제 #12
0
파일: RoomTypeBLL.cs 프로젝트: wrj0823/RMS
 public static int updateroom(RoomTypeMDL rt)
 {
     return(RoomTypeDAL.updateroom(rt));
 }
예제 #13
0
파일: RoomTypeBLL.cs 프로젝트: wrj0823/RMS
 public static int insertroom(RoomTypeMDL rt)
 {
     return(RoomTypeDAL.insertroom(rt));
 }