示例#1
0
        private void FormPhieuDangKy_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < Chung.LayDSQuyenHan(Chung.loaiNhanVien).Count; i++)
            {
                if (Chung.LayDSQuyenHan(Chung.loaiNhanVien)[i].Equals("Xem thông tin"))
                {
                    btnXuatHoaDon.Enabled  = false;
                    btnXuatHopDong.Enabled = false;
                }
                if (Chung.LayDSQuyenHan(Chung.loaiNhanVien)[i].Contains("Chỉnh sửa"))
                {
                    break;
                }
                if (i == Chung.LayDSQuyenHan(Chung.loaiNhanVien).Count - 1)
                {
                    AnButton();
                }
            }
            if (MaDiaOcPoup == 0)
            {
                txtMaDiaOc.Visible        = false;
                dgvPhieuDangKy.DataSource = phieuDangKyBLL.LayDanhSachPhieuPhieuDangKyCoTen();
            }
            else
            {
                cbKhachHang.Visible       = false;
                btnThemDiaOc.Visible      = false;
                txtMaDiaOc.Text           = MaDiaOcPoup.ToString();
                dgvPhieuDangKy.DataSource = phieuDangKyBLL.LayDanhSachPhieuDangKyTheoMaDiaOc(MaDiaOcPoup);
            }
            cbKhachHang.DataSource    = khachHangBLL.LayDanhSachKhachHang();
            cbKhachHang.DisplayMember = "TenKhachHang";
            cbKhachHang.ValueMember   = "MaKhachHang";
            cbDiaOc.DataSource        = diaOcBLL.LayDanhSachDiaOcTheoMaKH(Int32.Parse(cbKhachHang.SelectedValue.ToString()));
            cbDiaOc.DisplayMember     = "MaDiaOc";
            cbDiaOc.ValueMember       = "MaDiaOc";
            cbNhanVien.DataSource     = nhanVienBLL.LayDanhSachNhanVien();
            cbNhanVien.DisplayMember  = "TenNhanVien";
            cbNhanVien.ValueMember    = "MaNhanVien";

            if (txtMaPhieuDangKy.Text != "" && txtMaPhieuDangKy.Text != null)
            {
                txtSoLuongQuangCao.Text = chiTietQuangCaoBLL.LayDanhSachChiTietQuangCaoTheoMaPhieuDangKy(Int32.Parse(txtMaPhieuDangKy.Text)).Rows.Count.ToString();
            }
            //if (rbChuaKiemDuyet.Checked)
            //{
            //    btnHuyDichVu.Enabled = btnGiaHanDichVu.Enabled = btnXuatHopDong.Enabled = btnXuatHoaDon.Enabled = false;
            //}
            LamMoiThongTin();
            cb = true;
        }
示例#2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (KiemTraThongTinTrong())
            {
                MessageBox.Show("Làm ơn điền đầy đủ thông tin địa ốc");
            }
            else
            {
                if (KiemTraThongTinHopLe())
                {
                    int trangThaiMuaBan    = 0;
                    int trangThaiKiemDuyet = 0;
                    if (rbDaKiemDuyet.Checked)
                    {
                        trangThaiKiemDuyet = 1;
                    }
                    if (chkTrangThaiMuaBan.Checked)
                    {
                        trangThaiMuaBan = 1;
                    }
                    int maKH = 0;
                    if (MaKhachHangPoup == 0)
                    {
                        maKH = Int32.Parse(cbKhachHang.SelectedValue.ToString());
                    }
                    else
                    {
                        maKH = MaKhachHangPoup;
                    }
                    DiaOcDTO diaOcDTO = new DiaOcDTO(
                        maKH,
                        Int32.Parse(cbLoaiDiaOc.SelectedValue.ToString()),
                        Int32.Parse(cbLoaiNha.SelectedValue.ToString()),
                        txtDiaChi.Text.ToString(),
                        Double.Parse(txtDienTichKhuonVien.Text.ToString()),
                        Double.Parse(txtDienTichSuDung.Text.ToString()),
                        txtHuongNha.Text.ToString(),
                        Double.Parse(txtChieuDaiDat.Text.ToString()),
                        Double.Parse(txtChieuRongDat.Text.ToString()),
                        Double.Parse(txtChieuDaiNha.Text.ToString()),
                        Double.Parse(txtChieuRongNha.Text.ToString()),
                        Int32.Parse(txtSoTang.Text.ToString()),
                        txtMoTaChiTiet.Text.ToString(),
                        Double.Parse(txtGiaBan.Text.ToString()),
                        trangThaiKiemDuyet, trangThaiMuaBan, "");

                    try
                    {
                        if (diaOcBLL.ThemDiaOc(diaOcDTO))
                        {
                            MessageBox.Show("Thêm địa ốc thành công");
                            if (MaKhachHangPoup == 0)
                            {
                                dgvDiaOc.DataSource = diaOcBLL.LayDanhSachDiaOcTheoTenLoai();
                            }
                            else
                            {
                                dgvDiaOc.DataSource = diaOcBLL.LayDanhSachDiaOcTheoMaKH(MaKhachHangPoup);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Thêm địa ốc thất bại");
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
示例#3
0
        private void dgvKhachHang_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    DataGridViewRow row         = dgvKhachHang.Rows[e.RowIndex];
                    int             columnIndex = dgvKhachHang.CurrentCell.ColumnIndex;
                    string          columnName  = dgvKhachHang.Columns[columnIndex].Name;
                    maKhachHang      = Int32.Parse(row.Cells["MaKhachHang"].Value.ToString());
                    lbKhachHang.Text = "Thông tin địa ốc của khách hàng " + row.Cells["TenKhachHang"].Value.ToString();

                    dgvDiaOcTabKhachHang.DataSource = diaOcBLL.LayDanhSachDiaOcTheoMaKH(maKhachHang);
                    if (diaOcBLL.LayDanhSachDiaOcTheoMaKH(maKhachHang).Rows.Count > 0)
                    {
                        DataGridViewRow rowDiaOc = this.dgvDiaOcTabKhachHang.Rows[0];
                        txtMaDiaOc.Text           = rowDiaOc.Cells["MaDiaOcTab1"].Value.ToString();
                        txtMaKhachHang.Text       = rowDiaOc.Cells["TenKhachHangTab1"].Value.ToString();
                        txtLoaiDiaOc.Text         = rowDiaOc.Cells["TenLoaiDiaOcTab1"].Value.ToString();
                        txtLoaiNha.Text           = rowDiaOc.Cells["TenLoaiNhaTab1"].Value.ToString();
                        txtDiaChi.Text            = rowDiaOc.Cells["DiaChiTab1"].Value.ToString();
                        txtDienTichKhuonVien.Text = rowDiaOc.Cells["DienTichKhuonVienTab1"].Value.ToString();
                        txtDienTichSuDung.Text    = rowDiaOc.Cells["DienTichSuDungTab1"].Value.ToString();
                        txtCMND.Text = rowDiaOc.Cells["CMNDTab1"].Value.ToString();
                        if (rowDiaOc.Cells["TrangThaiKiemDuyetTab1"].Value.ToString().Equals("True"))
                        {
                            chkTrangThaiKiemDuyet.Checked = true;
                        }
                        else
                        {
                            chkTrangThaiKiemDuyet.Checked = false;
                        }

                        if (rowDiaOc.Cells["TrangThaiMuaBanTab1"].Value.ToString().Equals("True"))
                        {
                            chkTrangThaiMuaBan.Checked = true;
                        }
                        else
                        {
                            chkTrangThaiMuaBan.Checked = false;
                        }

                        txtHuongNha.Text     = rowDiaOc.Cells["HuongNhaTab1"].Value.ToString();
                        txtChieuDaiDat.Text  = rowDiaOc.Cells["ChieuDaiDatTab1"].Value.ToString();
                        txtChieuRongDat.Text = rowDiaOc.Cells["ChieuRongDatTab1"].Value.ToString();
                        txtChieuDaiNha.Text  = rowDiaOc.Cells["ChieuDaiNhaTab1"].Value.ToString();
                        txtChieuRongNha.Text = rowDiaOc.Cells["ChieuRongNhaTab1"].Value.ToString();
                        txtSoTang.Text       = rowDiaOc.Cells["SoTangTab1"].Value.ToString();
                        txtMoTaChiTiet.Text  = rowDiaOc.Cells["MoTaChiTietTab1"].Value.ToString();
                        txtGiaBan.Text       = String.Format("{0:#,###0}", double.Parse(rowDiaOc.Cells["GiaBanTab1"].Value.ToString()));
                    }
                    else
                    {
                        chkTrangThaiKiemDuyet.Checked = chkTrangThaiMuaBan.Checked = false;
                        txtMoTaChiTiet.Text           = txtDiaChi.Text = txtChieuDaiDat.Text = txtChieuDaiNha.Text = txtChieuRongDat.Text = txtChieuRongNha.Text = txtDienTichKhuonVien.Text = txtDienTichSuDung.Text = txtLoaiDiaOc.Text = txtLoaiNha.Text = txtHuongNha.Text = txtGiaBan.Text = txtMaDiaOc.Text = txtMaKhachHang.Text = txtSoTang.Text = txtCMND.Text = "";
                    }
                }
                catch
                {
                }
            }
        }