private void LoadGridViewContract()
 {
     bll_contact              = new BLL_Contract();
     table_Contract           = new DataTable();
     table_Contract           = bll_contact.GetDataTableViewContract(ref err);
     dataGridView1.DataSource = table_Contract;
 }
        private void btn_change_Click(object sender, EventArgs e)
        {
            bll_contract = new BLL_Contract();
            _dtocontract = new DTO_Contract();
            setAllcontrolToDTO(ref _dtocontract);
            table = bll_contract.GetDataTableViewContract(ref err);
            string num_no = string.Empty;
            bool   stt    = false;

            foreach (DataRow row in table.Rows)
            {
                num_no = (string)row["Notary_Number"];
                stt    = _dtocontract.No_number.Equals(num_no) ? true : false;
            }
            if (stt)
            {
                dialog = MessageBox.Show("Dữ liệu đã tồn tại");
            }
            if (dialog == DialogResult.OK)
            {
                Update_Contract(_dtocontract, bll_contract);
            }
            else
            {
                Add_Contract(_dtocontract, bll_contract);
            }
            this.Close();
            Frm_detail_contract frm_Detail = new Frm_detail_contract();

            frm_Detail.Show();
        }
 private void Frm_Manage_Contract_Load(object sender, EventArgs e)
 {
     if (_dtocontract != null)
     {
         SetDTOToControl(_dtocontract);
     }
     else
     {
         DataTable dataTable = new DataTable();
         bll_contract = new BLL_Contract();
         dataTable    = bll_contract.GetDataTableViewContract(ref err);
         load_defaul_view(dataTable);
     }
 }
        private void tol_cbo_show_SelectedIndexChanged(object sender, EventArgs e)
        {
            table_Contract = new DataTable();


            bll_contact           = new BLL_Contract();
            tol_cbo_year.Enabled  = true;
            tol_cbo_month.Enabled = true;
            tol_cbo_day.Enabled   = true;
            if (tol_cbo_show.SelectedItem.Equals("Xem Tất Cả"))
            {
                tol_cbo_year.Enabled     = false;
                tol_cbo_month.Enabled    = false;
                tol_cbo_day.Enabled      = false;
                table_Contract           = bll_contact.GetDataTableViewContract(ref err);
                dataGridView1.DataSource = table_Contract;
            }


            if (tol_cbo_show.SelectedItem.Equals("Xem Theo Năm"))
            {
                tol_cbo_month.Enabled = false;
                tol_cbo_day.Enabled   = false;
                int year = (int)tol_cbo_year.SelectedItem;
                table_Contract           = bll_contact.Load_data_with_Year(ref err, year);
                dataGridView1.DataSource = table_Contract;
            }
            if (tol_cbo_show.SelectedItem.Equals("Xem Theo Tháng"))
            {
                tol_cbo_day.Enabled = false;
                int month = (int)tol_cbo_month.SelectedItem;
                table_Contract           = bll_contact.Load_data_with_Month(ref err, month);
                dataGridView1.DataSource = table_Contract;
            }
            if (tol_cbo_show.SelectedItem.Equals("Xem Theo Ngày"))
            {
                tol_cbo_day.Enabled = (tol_cbo_day.Enabled == false) ? true : true;
                int day = DateTime.Now.Day;
                if (tol_cbo_day.SelectedItem != null)
                {
                    day = (int)tol_cbo_day.SelectedItem;
                }
                table_Contract           = bll_contact.Load_data_with_Day(ref err, day);
                dataGridView1.DataSource = table_Contract;
            }
        }