コード例 #1
0
        void LoadRoom()
        {
            List <Room> LoadRoom()
            {
                List <Room> listRoom = new List <Room>();

                conn = ConnectionDatabase.getInstance();
                ConnectionDatabase.openConnectionStage();

                string         sql1      = "SELECT * from Phong ";
                SqlDataAdapter adapter   = new SqlDataAdapter(sql1, conn);
                DataTable      dataTable = new DataTable();

                adapter.Fill(dataTable);

                foreach (DataRow item in dataTable.Rows)
                {
                    Room Room = new Room(item);
                    listRoom.Add(Room);
                }
                ConnectionDatabase.closeConnectionStage();
                return(listRoom);
            }

            List <Room> dsRoom = LoadRoom();

            foreach (Room item in dsRoom)
            {
                string TT;
                Button btn = new Button()
                {
                    Width = 130, Height = 130
                };
                PanelRoom.Controls.Add(btn);
                if (item.Trangthai == "0")
                {
                    TT             = "Trống";
                    btn.BackColor  = Color.Tomato;
                    btn.Click     += Button_Click1;
                    btn.ImageAlign = ContentAlignment.MiddleCenter;
                    btn.Image      = Image.FromFile(@"C:\Phong\QuanLyKhachSan\QuanLyKhachSan\Resources\home.png");
                }
                else
                {
                    TT            = "Đã đặt";
                    btn.BackColor = Color.Pink;
                    btn.Click    += Button_Click2;
                    btn.Image     = Image.FromFile(@"C:\Phong\QuanLyKhachSan\QuanLyKhachSan\Resources\home1.png");
                }
                btn.Text = item.Maphong + Environment.NewLine + TT;
            }
        }
コード例 #2
0
        private void frmService_Load(object sender, EventArgs e)
        {
            string masddv = "";

            conn = ConnectionDatabase.getInstance();
            ConnectionDatabase.openConnectionStage();

            //Đưa data vào dich vụ
            string sql = "SELECT MADV, TENDV, GIA FROM DICHVU";

            ConnectionDatabase.FillCombo(sql, lkedMaDV, "MADV", "TENDV");

            //Lấy mathuephong can su dung dv
            string sqlMaTP = "select mathuephong from thuephong inner join phong on phong.maphong = thuephong.maphong " +
                             "where trangthai='1'";
            SqlCommand    commandMaTP = new SqlCommand(sqlMaTP, conn);
            SqlDataReader readerMaTP  = commandMaTP.ExecuteReader();

            while (readerMaTP.Read())
            {
                edtMaTP.Properties.Items.Add(readerMaTP.GetString(0));
            }
            readerMaTP.Close();

            loadData();
            if (!mMathuephong.Equals(""))
            {
                string        sqlMaSDDV = "Select top 1 maSDDV from sudungdv order by masddv desc";
                SqlCommand    command   = new SqlCommand(sqlMaSDDV, conn);
                SqlDataReader reader    = command.ExecuteReader();
                while (reader.Read())
                {
                    masddv = reader.GetString(0);
                }
                reader.Close();
                if (masddv.Equals(""))
                {
                    edtMaSD.Text = "SD001";
                }
                else
                {
                    edtMaSD.Text = laychuoitudong(masddv);
                }
                edtMaTP.Text    = mMathuephong;
                edtSoLuong.Text = "";
                edtMaDV.Text    = "";
                dtpNgaySD.Text  = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
            }
        }
コード例 #3
0
        private void frmSearch_Load(object sender, EventArgs e)
        {
            conn = ConnectionDatabase.getInstance();
            ConnectionDatabase.openConnectionStage();
            string        sqlMaPhong = "select maphong from phong";
            SqlCommand    command    = new SqlCommand(sqlMaPhong, conn);
            SqlDataReader reader     = command.ExecuteReader();

            edtMaPhong.Properties.Items.Add("");
            while (reader.Read())
            {
                edtMaPhong.Properties.Items.Add(reader.GetString(0));
            }
            reader.Close();
        }
コード例 #4
0
ファイル: frmRoom.cs プロジェクト: phongkeoyb/QLKS
        private void frmRoom_Load(object sender, EventArgs e)
        {
            conn = ConnectionDatabase.getInstance();
            ConnectionDatabase.openConnectionStage();
            string        sql     = "select tenloai from loaiphong";
            SqlCommand    command = new SqlCommand(sql, conn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                cbLoaiPhong.Properties.Items.Add(reader.GetString(0));
            }
            reader.Close();
            loadData();
            lblHinhAnh.Enabled = false;
        }
コード例 #5
0
ファイル: frmAccounts.cs プロジェクト: phongkeoyb/QLKS
        private void frmAccounts_Load(object sender, EventArgs e)
        {
            conn = ConnectionDatabase.getInstance();
            ConnectionDatabase.openConnectionStage();
            string        sql     = "select distinct loaiTK from taikhoan";
            SqlCommand    command = new SqlCommand(sql, conn);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                edtLoaiTK.Properties.Items.Add(reader.GetString(0));
            }
            reader.Close();

            loadData();
        }
コード例 #6
0
 private void frmRoomType_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
     loadData();
 }
コード例 #7
0
ファイル: frmStatistic.cs プロジェクト: phongkeoyb/QLKS
 private void frmStatistic_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
 }
コード例 #8
0
ファイル: frmCheckIn.cs プロジェクト: phongkeoyb/QLKS
        private void frmCheckIn_Load(object sender, EventArgs e)
        {
            conn = ConnectionDatabase.getInstance();
            ConnectionDatabase.openConnectionStage();
            layPhongTrong();

            //Lấy dữ liệu MaNV đưa vào cột Mã NV
            string        sqlMaNV     = "Select manv from nhanvien";
            SqlCommand    commandMaNV = new SqlCommand(sqlMaNV, conn);
            SqlDataReader readerMaNV  = commandMaNV.ExecuteReader();

            while (readerMaNV.Read())
            {
                edtMaNV.Properties.Items.Add(readerMaNV.GetString(0));
            }
            readerMaNV.Close();
            loadData();

            //Nếu như được gọi từ form tìm phòng trống thì xóa dữ liệu các field hiện tại, tạo dữ liệu mới
            if (mMaPhong != "")
            {
                string mathuephong = "";
                string makh        = "";
                //Lấy mã thuê phòng cuối +1 để đưa vô textedit mathuephong
                string        sqlMaThuePhong = "Select top 1 mathuephong from thuephong order by mathuephong desc";
                SqlCommand    command        = new SqlCommand(sqlMaThuePhong, conn);
                SqlDataReader reader         = command.ExecuteReader();
                while (reader.Read())
                {
                    mathuephong = reader.GetString(0);
                }
                reader.Close();

                //Lấy mã KH cuối +1 để đưa vô textedit mathuephong
                string        sqlMaKH     = "Select top 1 makh from khachhang order by makh desc";
                SqlCommand    commandMaKH = new SqlCommand(sqlMaKH, conn);
                SqlDataReader readerKH    = commandMaKH.ExecuteReader();
                while (readerKH.Read())
                {
                    makh = readerKH.GetString(0);
                }

                readerKH.Close();
                if (makh.Equals(""))
                {
                    edtMaKH.Text = "KH001";
                }
                else
                {
                    edtMaKH.Text = laychuoitudong(makh);
                }

                if (mathuephong.Equals(""))
                {
                    edtMaThuePhong.Text = "TP001";
                }
                else
                {
                    edtMaThuePhong.Text = laychuoitudong(mathuephong);
                }
                //Lấy ngày giờ hiện tại đưa vào ngày thuê
                edtNgayThue.Text = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
                edtTenKH.Text    = "";
                edtCMND.Text     = "";
                edtSDT.Text      = "";
                edtEmail.Text    = "";
                edtDiaChi.Text   = "";
                edtNgayTra.Text  = "";

                edtMaPhong.Text = mMaPhong;
                edtMaNV.Text    = "";
                edtNguoi.Text   = "";
            }
        }
コード例 #9
0
 private void frmCheckOut_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
     getPhongThue();
 }
コード例 #10
0
ファイル: frmLogin.cs プロジェクト: phongkeoyb/QLKS
 public frmLogin()
 {
     InitializeComponent();
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
 }