示例#1
0
        private void gridviewTranha_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string ma = gridviewTranha.CurrentRow.Cells["Masothue"].Value.ToString();

            cmbMasothue.Text = DAO.GetFieldValues("select Masothue from tblThuTienNha where Masothue = '" + ma + "'");
            dtpNgaytra.Text  = gridviewTranha.CurrentRow.Cells["Ngaytra"].Value.ToString();
            txtTongtien.Text = gridviewTranha.CurrentRow.Cells["Tongtien"].Value.ToString();
        }
示例#2
0
        private void gridviewNha_taisan_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string sql1;

            cmbManha.Text     = gridviewNha_taisan.CurrentRow.Cells["Manha"].Value.ToString();
            sql1              = "Select Tentaisan From tblTaiSan Where Mataisan = N'" + gridviewNha_taisan.CurrentRow.Cells["Mataisan"].Value.ToString() + "'";
            cmbTaisan.Text    = DAO.GetFieldValues(sql1);
            txtSoluong.Text   = gridviewNha_taisan.CurrentRow.Cells["Soluong"].Value.ToString();
            txtGiatri.Text    = gridviewNha_taisan.CurrentRow.Cells["Giatri"].Value.ToString();
            txtTinhtrang.Text = gridviewNha_taisan.CurrentRow.Cells["Tinhtrang"].Value.ToString();
        }
示例#3
0
 private void cmbMakhach_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbMakhach.SelectedIndex != -1)
     {
         txtSoCMND.Text            = DAO.GetFieldValues("select b.SoCMND from tblThueNha as a join tblKhachThue as b on a.Makhach=b.Makhach where a.Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtTenkhach.Text          = DAO.GetFieldValues("select b.Tenkhach from tblThueNha as a join tblKhachThue as b on a.Makhach=b.Makhach where a.Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtDiachithuongtru.Text   = DAO.GetFieldValues("select b.Diachithuongtru from tblThueNha as a join tblKhachThue as b on a.Makhach=b.Makhach where a.Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtMucdichsudung.Text     = DAO.GetFieldValues("select b.TenmucdichSD from tblThueNha as a join tblMucDichSuDung as b on a.MamucdichSD=b.MamucdichSD where Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtNgayBD.Text            = DAO.GetFieldValues("select NgayBD from tblThueNha  where Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtNgayKT.Text            = DAO.GetFieldValues("select NgayKT from tblThueNha  where Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
         txtHinhthucthanhtoan.Text = DAO.GetFieldValues("select a.TenhinhthucTT from tblThueNha as b join tblHinhThucThanhToan as a on a.MahinhthucTT=b.MahinhthucTT where b.Makhach = '" + cmbMakhach.SelectedValue.ToString() + "'");
     }
 }
示例#4
0
        private void gridviewThuenha_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtMasothue.Text = gridviewThuenha.CurrentRow.Cells["Masothue"].Value.ToString();
            string sql, sql1, sql2;

            sql                       = "Select Tenkhach From tblKhachThue Where Makhach = N'" + gridviewThuenha.CurrentRow.Cells["Makhach"].Value.ToString() + "'";
            cmbKhach.Text             = DAO.GetFieldValues(sql);
            cmbNha.Text               = gridviewThuenha.CurrentRow.Cells["Manha"].Value.ToString();
            sql1                      = "Select TenmucdichSD From tblMucDichSuDung Where MamucdichSD = N'" + gridviewThuenha.CurrentRow.Cells["MamucdichSD"].Value.ToString() + "'";
            cmbMucdich.Text           = DAO.GetFieldValues(sql1);
            dtpNgaybatdau.Text        = gridviewThuenha.CurrentRow.Cells["NgayBD"].Value.ToString();
            dtpNgayketthuc.Text       = gridviewThuenha.CurrentRow.Cells["NgayKT"].Value.ToString();
            txtTiendatcoc.Text        = gridviewThuenha.CurrentRow.Cells["Tiendatcoc"].Value.ToString();
            sql2                      = "Select TenhinhthucTT From tblHinhThucThanhToan Where MahinhthucTT = N'" + gridviewThuenha.CurrentRow.Cells["MahinhthucTT"].Value.ToString() + "'";
            cmbHinhthucthanhtoan.Text = DAO.GetFieldValues(sql2);
        }
示例#5
0
 private void cmbManha_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbManha.SelectedIndex != -1)
     {
         string str;
         str = "select distinct Makhach from tblThueNha where Manha = '" + cmbManha.SelectedValue + "' ";
         // MessageBox.Show(str);
         DAO.FillDataToCombo(str, cmbMakhach, "MaKhach", "MaKhach");
         txtDienthoai.Text      = DAO.GetFieldValues("select Dienthoai from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
         txtTenchunha.Text      = DAO.GetFieldValues("select Tenchunha from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
         txtDiachinha.Text      = DAO.GetFieldValues("select Diachi from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
         txtLoainha.Text        = DAO.GetFieldValues("select b.Tenloai from tblDanhMucNha as a join tblLoainha as b on a.Maloai=b.Maloai where a.Manha = '" + cmbManha.SelectedValue + "'");
         txtDongiathue.Text     = DAO.GetFieldValues("select Dongiathue from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
         txtDoituongsudung.Text = DAO.GetFieldValues("select b.TenDTSD from tblDanhMucNha as a join tblDoiTuongSuDung as b on a.MaDTSD=b.MaDTSD where a.Manha = '" + cmbManha.SelectedValue + "'");
         txtTinhtrang.Text      = DAO.GetFieldValues("select Tinhtrang from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
         txtGhichu.Text         = DAO.GetFieldValues("select Ghichu from tblDanhMucNha where Manha = '" + cmbManha.SelectedValue + "'");
     }
 }
示例#6
0
        private void cmbMasothue_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sql, sql1;

            if (cmbMasothue.SelectedIndex != -1)
            {
                txtNgaybatdau.Text = DAO.GetFieldValues("select NgayBD from tblThueNha where Masothue = '" + cmbMasothue.SelectedValue.ToString() + "'");
            }

            if (cmbMasothue.Text == "")
            {
                txtDongiathue.Text = "";
                return;
            }
            sql = "SELECT Tiendatcoc FROM tblThueNha WHERE Masothue = '" + cmbMasothue.Text + "'";
            DataTable table = DAO.DocBang(sql);

            if (table.Rows.Count > 0)
            {
                txtDongiathue.Text = table.Rows[0][0].ToString();
            }
            if (cmbMasothue.SelectedIndex != -1)
            {
                if (cmbMasothue.Text == "")
                {
                    txtHinhThuc.Text = "";
                    return;
                }
                sql1 = "SELECT b.TenhinhthucTT FROM tblThueNha as a join tblHinhThucThanhToan as b on a.MahinhthucTT=b.MahinhthucTT WHERE a.Masothue = '" + cmbMasothue.Text + "'";
                DataTable tbl = DAO.DocBang(sql1);
                if (tbl.Rows.Count > 0)
                {
                    txtHinhThuc.Text = tbl.Rows[0][0].ToString();
                }

                double dg, ht, tt;
                dg = Convert.ToDouble(txtDongiathue.Text);
                ht = Convert.ToDouble(txtHinhThuc.Text);
                tt = dg * ht;
                txtTongtien.Text = tt.ToString();
            }
        }
示例#7
0
        private void gridviewKhachthue_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtMakhach.Text  = gridviewKhachthue.CurrentRow.Cells["Makhach"].Value.ToString();
            txtTenkhach.Text = gridviewKhachthue.CurrentRow.Cells["Tenkhach"].Value.ToString();
            dtpNgaysinh.Text = gridviewKhachthue.CurrentRow.Cells["Ngaysinh"].Value.ToString();
            if (gridviewKhachthue.CurrentRow.Cells["Gioitinh"].Value.ToString() == "Nam")
            {
                chkGioitinh.Checked = true;
            }
            else
            {
                chkGioitinh.Checked = false;
            }
            txtSoCMND.Text          = gridviewKhachthue.CurrentRow.Cells["SoCMND"].Value.ToString();
            txtDiachithuongtru.Text = gridviewKhachthue.CurrentRow.Cells["Diachithuongtru"].Value.ToString();
            string sql, sq;

            sql            = "Select Tennghe From tblNgheNghiep Where Manghe = N'" + gridviewKhachthue.CurrentRow.Cells["Manghe"].Value.ToString() + "'";
            cmbManghe.Text = DAO.GetFieldValues(sql);
            sq             = "Select TenCQ From tblCoQuan Where MaCQ = N'" + gridviewKhachthue.CurrentRow.Cells["MaCQ"].Value.ToString() + "'";
            cmbMaCQ.Text   = DAO.GetFieldValues(sq);
        }
示例#8
0
        private void gridviewDanhmucnha_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtManha.Text     = gridviewDanhmucnha.CurrentRow.Cells["Manha"].Value.ToString();
            txtTenchunha.Text = gridviewDanhmucnha.CurrentRow.Cells["Tenchunha"].Value.ToString();
            txtDienthoai.Text = gridviewDanhmucnha.CurrentRow.Cells["Dienthoai"].Value.ToString();
            string sql1, sql2;

            sql1                   = "Select Tenloai From tblLoaiNha Where Maloai = N'" + gridviewDanhmucnha.CurrentRow.Cells["Maloai"].Value.ToString() + "'";
            cmbLoainha.Text        = DAO.GetFieldValues(sql1);
            sql2                   = "Select TenDTSD From tblDoiTuongSudung Where MaDTSD = N'" + gridviewDanhmucnha.CurrentRow.Cells["MaDTSD"].Value.ToString() + "'";
            cmbDoituongsudung.Text = DAO.GetFieldValues(sql2);
            txtDiachi.Text         = gridviewDanhmucnha.CurrentRow.Cells["Diachi"].Value.ToString();
            txtDongiathue.Text     = gridviewDanhmucnha.CurrentRow.Cells["Dongiathue"].Value.ToString();
            txtTinhtrang.Text      = gridviewDanhmucnha.CurrentRow.Cells["Tinhtrang"].Value.ToString();
            if (gridviewDanhmucnha.CurrentRow.Cells["Dathue"].Value.ToString() == "Chưa cho thuê")
            {
                chkDathue.Checked = true;
            }
            else
            {
                chkDathue.Checked = false;
            }
            txtGhichu.Text = gridviewDanhmucnha.CurrentRow.Cells["Ghichu"].Value.ToString();
        }
示例#9
0
        private void cmbMasothue_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbMasothue.SelectedIndex != -1)
            {
                txtNgayketthuc.Text = DAO.GetFieldValues("select NgayKT from tblThueNha where Masothue = '" + cmbMasothue.SelectedValue.ToString() + "'");
            }

            string sql, sql1;

            if (cmbMasothue.Text == "")
            {
                txtBoithuong.Text = "";
                return;
            }
            sql = "select sum(Thanhtien) from tblTraNha_MatTaiSan where Masothue='" + cmbMasothue.SelectedValue + "'";
            DataTable table = DAO.DocBang(sql);

            if (table.Rows.Count > 0)
            {
                txtBoithuong.Text = table.Rows[0][0].ToString();
            }


            if (cmbMasothue.Text == "")
            {
                txtTiendatcoc.Text = "";
                return;
            }
            sql1 = "SELECT Tiendatcoc FROM tblThueNha WHERE Masothue = '" + cmbMasothue.Text + "'";
            DataTable tbl = DAO.DocBang(sql1);

            if (tbl.Rows.Count > 0)
            {
                txtTiendatcoc.Text = tbl.Rows[0][0].ToString();
            }
        }
示例#10
0
        private void gridviewThutiennha_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            txtMasothu.Text  = gridviewThutiennha.CurrentRow.Cells["Masothu"].Value.ToString();
            txtNam.Text      = gridviewThutiennha.CurrentRow.Cells["Nam"].Value.ToString();
            txtTongtien.Text = gridviewThutiennha.CurrentRow.Cells["Tongtien"].Value.ToString();
            txtNguoithu.Text = gridviewThutiennha.CurrentRow.Cells["Nguoithu"].Value.ToString();
            txtGhichu.Text   = gridviewThutiennha.CurrentRow.Cells["Ghichu"].Value.ToString();
            string ma = gridviewThutiennha.CurrentRow.Cells["Masothue"].Value.ToString();

            cmbMasothue.Text = DAO.GetFieldValues("select Masothue from tblThuTienNha where Masothue = '" + ma + "'");

            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "1_")
            {
                chk1.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "2_")
            {
                chk2.Checked  = true;
                chk1.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "3_")
            {
                chk3.Checked  = true;
                chk2.Checked  = false;
                chk1.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "4_")
            {
                chk4.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk1.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "5_")
            {
                chk5.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk1.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "6_")
            {
                chk6.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk1.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "7_")
            {
                chk7.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk1.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "8_")
            {
                chk8.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk1.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "9_")
            {
                chk9.Checked  = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk1.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "10_")
            {
                chk10.Checked = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk1.Checked  = false;
                chk9.Checked  = false;
                chk8.Checked  = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "11_")
            {
                chk11.Checked = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk1.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk8.Checked  = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "12_")
            {
                chk12.Checked = true;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk1.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk8.Checked  = false;
            }
            ;

            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "1_2_3_")
            {
                chk1.Checked  = true;
                chk2.Checked  = true;
                chk3.Checked  = true;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "4_5_6_")
            {
                chk4.Checked  = true;
                chk5.Checked  = true;
                chk6.Checked  = true;
                chk1.Checked  = false;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "7_8_9_")
            {
                chk7.Checked  = true;
                chk8.Checked  = true;
                chk9.Checked  = true;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk1.Checked  = false;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "10_11_12_")
            {
                chk10.Checked = true;
                chk11.Checked = true;
                chk12.Checked = true;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk1.Checked  = false;
                chk2.Checked  = false;
                chk3.Checked  = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "1_2_3_4_5_6_")
            {
                chk1.Checked  = true;
                chk2.Checked  = true;
                chk3.Checked  = true;
                chk4.Checked  = true;
                chk5.Checked  = true;
                chk6.Checked  = true;
                chk7.Checked  = false;
                chk8.Checked  = false;
                chk9.Checked  = false;
                chk10.Checked = false;
                chk11.Checked = false;
                chk12.Checked = false;
            }
            ;
            if (gridviewThutiennha.CurrentRow.Cells["Thang"].Value.ToString() == "7_8_9_10_11_12_")
            {
                chk1.Checked  = false;
                chk2.Checked  = false;
                chk3.Checked  = false;
                chk4.Checked  = false;
                chk5.Checked  = false;
                chk6.Checked  = false;
                chk7.Checked  = true;
                chk8.Checked  = true;
                chk9.Checked  = true;
                chk10.Checked = true;
                chk11.Checked = true;
                chk12.Checked = true;
            }
            ;
        }