Exemplo n.º 1
0
        private void btnxoa_Click(object sender, EventArgs e)
        {
            bool del = false;

            foreach (ListViewItem item in lvthongtinhopdong.Items)
            {
                if (item.Selected)
                {
                    DTO_HopDong hd = new DTO_HopDong();
                    hd.ma_hop_dong = item.SubItems[3].Text.ToString();
                    DialogResult kq = MessageBox.Show("Bạn Muốn Xóa Hợp Đồng Có Mã : " + hd.ma_hop_dong, "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (kq == DialogResult.OK)
                    {
                        del = new BLL_HopDong()._Xoa_Hop_Dong(hd);
                    }
                    if (del == true)
                    {
                        item.Remove();
                    }
                }
            }
            if (del == true)
            {
                MessageBox.Show("Xóa Thành Công", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (del == false)
            {
                MessageBox.Show("Không Xóa Được Hợp Đồng Này", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
 public frmHopDong()
 {
     bll_hd = new BLL_HopDong();
     InitializeComponent();
     _AUTO_COMPLE_MA_KHACH_HANG();
     _ma_hop_dong();
     _combobox_ten_khach_hang();
 }
Exemplo n.º 3
0
 public txt_mabaogia()
 {
     bll_bg = new BLL_BangBaoGia();
     bll_hd = new BLL_HopDong();
     bll_dv = new BLL_DichVu();
     InitializeComponent();
     txt_ma_bao_gia.Text = bll_bg.Ma_BG();
 }
Exemplo n.º 4
0
        private void _AUTO_COMPLE_MA_KHACH_HANG()
        {
            DataTable dt = new BLL_HopDong()._Bang_Ma_Khach_Hang();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    auto.Add(dr["ma_khach_hang"].ToString());
                }
            }
            txtmakhachhang.AutoCompleteMode         = AutoCompleteMode.Suggest;
            txtmakhachhang.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            txtmakhachhang.AutoCompleteCustomSource = auto;
        }
Exemplo n.º 5
0
        private void btncapnhat_Click(object sender, EventArgs e)
        {
            DTO_HopDong dto = new DTO_HopDong();

            dto.ma_hop_dong         = txtmahopdong.Text;
            dto.ma_khach_hang       = txtmakhachhang.Text;
            dto.ngay_bat_dau        = dtpngaybatdau.Value;
            dto.ngay_ket_thuc       = dtpngayketthuc.Value;
            dto.loaihanghoa         = txtloaihanghoa.Text.Trim();
            dto.lotrinhvanchuyen    = txtlotrinhvanchuyen.Text;
            dto.phuongthucvanchuyen = txtphuongthucvanchuyen.Text.Trim();
            dto.giatrihopdong       = txtgiatrihopdong.Text.Trim();
            dto.phuongthucthanhtoan = txtphuongthucthanhtoan.Text.Trim();
            if (txtmahopdong.Text.Trim() != new BLL_HopDong()._Ma_Hop_Dong().ToString())
            {
                DialogResult kq = MessageBox.Show("Bạn Muốn Cập Nhật Hợp Đồng : " + txtmahopdong.Text, "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                bool         kt = true;
                if (kq == DialogResult.OK)
                {
                    kt = new BLL_HopDong()._Update_Hop_Dong(dto);
                }
                if (kt == true)
                {
                    MessageBox.Show("Cập Nhật Thành Công", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    foreach (ListViewItem item in lvthongtinhopdong.Items)
                    {
                        if (item.Selected)
                        {
                            item.SubItems[1].Text  = txtmakhachhang.Text;
                            item.SubItems[3].Text  = txtmahopdong.Text;
                            item.SubItems[4].Text  = dtpngaybatdau.Value.ToShortDateString();
                            item.SubItems[5].Text  = dtpngayketthuc.Value.ToShortDateString();
                            item.SubItems[6].Text  = txtloaihanghoa.Text;
                            item.SubItems[7].Text  = txtlotrinhvanchuyen.Text;
                            item.SubItems[8].Text  = txtphuongthucvanchuyen.Text;
                            item.SubItems[9].Text  = txtgiatrihopdong.Text;
                            item.SubItems[10].Text = txtphuongthucthanhtoan.Text;
                        }
                    }
                }
            }
        }