Exemple #1
0
        private void ShowNewHouse()
        {
            DBHelper db = null;

            try
            {
                db = new DBHelper();
                string        sql = string.Format("select * from room where State='{0}'", "空净");
                SqlDataReader sdr = db.SelectAll(sql);

                while (sdr.Read())
                {
                    cboNewHouse.Items.Add(sdr["R_RoomId"].ToString() + " " + hh.GetHouseType(sdr["RoomType"].ToString()));
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
Exemple #2
0
        //根据类型显示房源信息
        public void ShowHouse(string type)
        {
            lvHouse.Items.Clear();
            string R_RoomId;
            string State;
            string Floot;
            string RoomType;
            string price;
            string R_Count;
            string fixing;
            string sql = "";

            DBHelper db = null;

            try
            {
                db = new DBHelper();

                if (type == "0" || type == "全部")
                {
                    sql = string.Format("select * from Room");
                }
                else if (type == "1" || type == "2" || type == "3" || type == "4" || type == "5" || type == "6")
                {
                    sql = string.Format("select * from Room where RoomType='{0}'", type);
                }
                else
                {
                    sql = string.Format("select * from Room where State='{0}'", type);
                }

                SqlDataReader sdr = db.SelectAll(sql);
                while (sdr.Read())
                {
                    R_RoomId = sdr["R_RoomId"].ToString();
                    State    = sdr["State"].ToString();
                    Floot    = sdr["Floot"].ToString();
                    RoomType = hh.GetHouseType(sdr["RoomType"].ToString());
                    price    = sdr["price"].ToString();
                    R_Count  = sdr["R_Count"].ToString();
                    fixing   = sdr["fixing"].ToString();

                    ListViewItem lviHouse = new ListViewItem(R_RoomId);
                    string[]     str      = { State, Floot, RoomType, price, R_Count, fixing };
                    lviHouse.SubItems.AddRange(str);
                    lvHouse.Items.Add(lviHouse);
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
Exemple #3
0
        //填充数据
        private void FillDate(string RoomId)
        {
            DBHelper db = null;

            try
            {
                db = new DBHelper();
                string        sql = string.Format("select * from Room where R_RoomId='{0}'", RoomId);
                SqlDataReader sdr = db.SelectAll(sql);
                string        type;

                double price;

                if (sdr.Read())
                {
                    HouseHelper hh = new HouseHelper();
                    type  = hh.GetHouseType(sdr["RoomType"].ToString());
                    price = Convert.ToDouble(sdr["price"]);
                    ListViewItem lviHosue = new ListViewItem(RoomId);

                    //if (sdr["State"].ToString()=="预订")
                    //{
                    //    if (hh.ValidateIsBook(tvHouse.SelectedNode.Text, dtpComeDate.Text))
                    //    {

                    //    }
                    //    else
                    //    {
                    //        MessageBox.Show("此房间这个时间段,已经预订", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //        return;
                    //    }
                    //}


                    string[] str = { type, price.ToString() };
                    lviHosue.Tag = tvHouse.SelectedNode.Tag;


                    lviHosue.SubItems.AddRange(str);
                    lvNeedHouse.Items.Add(lviHosue);
                    txtMainHouse.Text = lvNeedHouse.Items[0].SubItems[0].Text;

                    this.tvHouse.SelectedNode.Remove();
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
Exemple #4
0
        //显示可供房间信息
        private void Showhollow(int type)
        {
            lvHollowHouse.Items.Clear();
            string   R_RoomId;
            string   RoomTypeId;
            double   price;
            DBHelper db  = null;
            string   sql = "";

            try
            {
                db = new DBHelper();

                type++;
                sql = string.Format("select * from Room where (State='{0}') and RoomType='{1}'", "空净", type);



                SqlDataReader sdr = db.SelectAll(sql);
                while (sdr.Read())
                {
                    R_RoomId   = sdr["R_RoomId"].ToString();
                    RoomTypeId = sdr["RoomType"].ToString();
                    price      = Convert.ToDouble(sdr["price"]);

                    HouseHelper hh = new HouseHelper();
                    RoomTypeId = hh.GetHouseType(sdr["RoomType"].ToString());

                    ListViewItem lviHouse = new ListViewItem(R_RoomId);

                    lviHouse.Tag             = sdr["R_id"].ToString();
                    lviHouse.SubItems[0].Tag = sdr["State"].ToString();;
                    string[] strHouse = { RoomTypeId, price.ToString() };
                    lviHouse.SubItems.AddRange(strHouse);
                    lvHollowHouse.Items.Add(lviHouse);
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
Exemple #5
0
        //显示信息
        private void ShowHouseInfo()
        {
            lvHollowHouse.Items.Clear();
            lvSelectHouse.Items.Clear();
            string      Room_id;
            string      Type;
            string      Price;
            HouseHelper hh = new HouseHelper();
            DBHelper    db = null;

            try
            {
                string sql = string.Format("select * from Room where State='{0}'", "空净");

                db = new DBHelper();
                SqlDataReader sdr = db.SelectAll(sql);
                while (sdr.Read())
                {
                    Room_id = sdr["R_RoomId"].ToString();
                    Type    = hh.GetHouseType(sdr["RoomType"].ToString());
                    Price   = sdr["price"].ToString();

                    ListViewItem lviHouse = new ListViewItem(Room_id);
                    string[]     str      = { Type, Price };
                    lviHouse.SubItems.AddRange(str);
                    lvHollowHouse.Items.Add(lviHouse);
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
Exemple #6
0
 //加载事件
 private void AddHouseForm_Load(object sender, EventArgs e)
 {
     //显示房间类型
     ShowHouseType();
     //根据type判断操作
     if (type == "")
     {
     }
     else
     {
         btnAdd.Text = "保存";
         this.Text   = "修改";
         DBHelper db = null;
         try
         {
             db = new DBHelper();
             string        sql = string.Format("select * from Room where R_RoomId='{0}'", type);
             SqlDataReader sdr = db.SelectAll(sql);
             if (sdr.Read())
             {
                 txtRoom_id.Text  = sdr["R_RoomId"].ToString();
                 txtFloot.Text    = sdr["Floot"].ToString();
                 cboRoomType.Text = hh.GetHouseType(sdr["RoomType"].ToString());
                 txtPrice.Text    = sdr["price"].ToString();
                 txtfixing.Text   = sdr["fixing"].ToString();
             }
             sdr.Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             db.GetClose();
         }
     }
 }
Exemple #7
0
        //刷新
        public void ShowHouseState(int type)
        {
            HouseHelper hh = new HouseHelper();

            mf.lvConsole.Items.Clear();
            string R_RoomId        = "";
            string RoomType        = "";
            string state           = "";
            string floot           = "";
            string Uname           = "";
            string AdvanceForegift = "";
            string Underwrite      = "";
            string comeDate        = "";
            string Bookleave       = "";
            string R_price         = "";
            string Operator        = "";
            string remark          = "";

            string   sql = "";
            DBHelper db  = null;

            try
            {
                if (type == 0)
                {
                    sql = string.Format("select * from temp left join Book on temp.R_id=Book.R_id and Book.State !='解除预订'");
                }
                else if (type >= 1 && type <= 7)
                {
                    sql = string.Format("select * from temp left join Book on temp.R_id=Book.R_id where temp.RoomType={0}", type);
                }
                else
                {
                    string tempType = "";
                    if (type == 8)
                    {
                        tempType = "空净";
                    }
                    else if (type == 9)
                    {
                        tempType = "待客";
                    }
                    else if (type == 10)
                    {
                        tempType = "预订";
                    }
                    else if (type == 11)
                    {
                        tempType = "自用";
                    }
                    else if (type == 12)
                    {
                        tempType = "整理";
                    }

                    sql = string.Format("select * from temp left join Book on temp.R_id=Book.R_id where temp.state='{0}'", tempType);
                }
                db = new DBHelper();
                SqlDataReader sdr = db.SelectAll(sql);

                while (sdr.Read())
                {
                    R_RoomId        = sdr[1].ToString();
                    RoomType        = hh.GetHouseType(sdr[5].ToString());
                    state           = sdr[3].ToString();
                    floot           = sdr[4].ToString();
                    Uname           = sdr[9].ToString();
                    AdvanceForegift = sdr[10].ToString();
                    Underwrite      = sdr[11].ToString();
                    comeDate        = sdr[12].ToString();
                    Bookleave       = sdr[13].ToString();
                    R_price         = sdr[2].ToString();
                    Operator        = sdr[15].ToString();
                    remark          = sdr[16].ToString();



                    if (sdr[21].ToString() == "预订" || sdr[21].ToString() == "待客")
                    {
                        Uname = sdr[27].ToString();
                        //MessageBox.Show(Uname);
                        AdvanceForegift = sdr[22].ToString();
                        Underwrite      = sdr[23].ToString();
                        comeDate        = sdr[24].ToString();
                        Bookleave       = sdr[25].ToString();
                        Operator        = sdr[26].ToString();
                        remark          = sdr[33].ToString();
                    }


                    if (state == "空净")
                    {
                        Uname           = "";
                        AdvanceForegift = "";
                        comeDate        = "";
                        Bookleave       = "";
                        Operator        = "";
                        remark          = "";
                    }


                    ListViewItem lviHouse = new ListViewItem(R_RoomId);
                    lviHouse.Tag = sdr["G_GuestId"].ToString();
                    // MessageBox.Show(lviHouse.Tag.ToString());
                    string[] strRoom = { RoomType, state, floot, Uname, AdvanceForegift, Underwrite, comeDate, Bookleave, R_price, Operator, remark };
                    lviHouse.SubItems.AddRange(strRoom);
                    mf.lvConsole.Items.Add(lviHouse);
                }
                sdr.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }