Beispiel #1
0
        private void InsertData(int index)
        {
            ConnectData.Connect();
            //
            //string user = "******";
            string user = usernamelink.Text;
            //
            string numRoom = danhsachphongtrong.Rows[index].Cells[5].Value.ToString();
            int    num;

            int.TryParse(numRoom, out num);
            DateTime dateIn  = DateTime.Parse(ngaynhanphongdt.Text);
            DateTime dateOut = dateIn.AddDays(int.Parse(ngayolai.Text));

            string sql = "sp_booking";

            int result;

            //+  user +"," + numRoom + "," + checkIn + "," + checkOut + "," + result
            result = ConnectData.ExcuteProcedure(sql, user, num, dateIn, dateOut);
            ConnectData.DisConnect();

            if (result == 1)
            {
                MessageBox.Show("Xin lỗi quý khách !! \nPhòng này đã có người sử dụng !", "Error");
                danhsachphongtrong.CancelEdit();
            }
            else
            {
                MessageBox.Show("Đặt phòng thành công !!");
            }
        }
Beispiel #2
0
        private void InsertData(int index)
        {
            ConnectData.Connect();
            //
            string user = "******";
            //string user = usernamelink.Name;
            //
            string numRoom = danhsachphongtrong.Rows[index].Cells[5].Value.ToString();
            int    num;

            int.TryParse(numRoom, out num);
            DateTime dateIn  = DateTime.Now;
            DateTime dateOut = dateIn.AddDays(3);

            string sql = "sp_booking";

            int result;

            //+  user +"," + numRoom + "," + checkIn + "," + checkOut + "," + result
            result = ConnectData.ExcuteProcedure(sql, user, num, dateIn, dateOut);
            if (result == 1)
            {
                MessageBox.Show("We're sorry about this !! \n This room is booked. Please try book the another!", "Error");
                danhsachphongtrong.CancelEdit();
            }
            else
            {
                MessageBox.Show("Successfull !!");
                ConnectData.Connect();
                Application.Restart();
            }
        }
Beispiel #3
0
        private void LoadData()
        {
            ConnectData.Connect();
            string    sql  = "SELECT ks.maKS ,ks.tenKS,ks.thanhPho,ks.soSao,ks.giaTB,ks.soNha,ks.duong,ks.quan,ks.mota FROM ((KhachSan ks JOIN LoaiPhong lp ON ks.maKS=lp.maKS) JOIN Phong p ON lp.maLoaiPhong=p.LoaiPhong) JOIN TrangThaiPhong tt ON p.maPhong=tt.maPhong";
            DataTable dsKS = new DataTable();

            dsKS = ConnectData.LoadData(string.Format(sql));
            for (int i = 0; i < dsKS.Rows.Count; i++)
            {
                danhsachkhachsan.Rows.Add(dsKS.Rows[i][0], dsKS.Rows[i][1], dsKS.Rows[i][3], dsKS.Rows[i][5], dsKS.Rows[i][6], dsKS.Rows[i][7], dsKS.Rows[i][2], dsKS.Rows[i][4], dsKS.Rows[i][8]);
            }
        }
Beispiel #4
0
        private void LoadData()
        {
            ConnectData.Connect();
            string    sql  = "SELECT ks.maKS as 'Mã khách sạn',ks.tenKS as 'Tên khách sạn',ks.thanhPho as 'Thành phố',ks.soSao as 'Số sao',ks.giaTB as 'Giá cả',tt.maPhong as 'Số phòng',tt.tinhTrang as 'Tình trạng' FROM ((KhachSan ks JOIN LoaiPhong lp ON ks.maKS=lp.maKS) JOIN Phong p ON lp.maLoaiPhong=p.LoaiPhong) JOIN TrangThaiPhong tt ON p.maPhong=tt.maPhong";
            DataTable dsKS = new DataTable();

            dsKS = ConnectData.LoadData(string.Format(sql));
            for (int i = 0; i < dsKS.Rows.Count; i++)
            {
                danhsachphongtrong.Rows.Add(dsKS.Rows[i][0], dsKS.Rows[i][1], dsKS.Rows[i][2], dsKS.Rows[i][3], dsKS.Rows[i][4], dsKS.Rows[i][5], dsKS.Rows[i][6]);
            }
        }
Beispiel #5
0
        private void LoadData()
        {
            ConnectData.Connect();
            string    sql  = "SELECT ks.maKS,ks.tenKS,ks.thanhPho,ks.soSao,ks.giaTB,tt.maPhong,tt.tinhTrang FROM ((KhachSan ks JOIN LoaiPhong lp ON ks.maKS = lp.maKS) JOIN Phong p ON lp.maLoaiPhong = p.LoaiPhong) JOIN TrangThaiPhong tt ON p.maPhong = tt.maPhong WHERE tt.ngay = (select max(tt1.ngay) from TrangThaiPhong tt1 where tt1.maPhong = tt.maPhong) AND tt.tinhTrang = 0";
            DataTable dsKS = new DataTable();

            dsKS = ConnectData.LoadData(string.Format(sql));
            for (int i = 0; i < dsKS.Rows.Count; i++)
            {
                danhsachphongtrong.Rows.Add(dsKS.Rows[i][0], dsKS.Rows[i][1], dsKS.Rows[i][2], dsKS.Rows[i][3], dsKS.Rows[i][4], dsKS.Rows[i][5], dsKS.Rows[i][6]);
            }

            ConnectData.DisConnect();
        }