Example #1
0
 private void frmStatistic_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
 }
Example #2
0
 private void frmCustomer_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
     loadData();
 }
Example #3
0
 private void frmCheckOut_Load(object sender, EventArgs e)
 {
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
     getPhongThue();
 }
Example #4
0
        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   = "";
            }
        }
Example #5
0
 public frmLogin()
 {
     InitializeComponent();
     conn = ConnectionDatabase.getInstance();
     ConnectionDatabase.openConnectionStage();
 }