Example #1
0
 private void loadControlToDTO()
 {
     person         = new DTO_Person_Notatry();
     person.Name    = txt_lastname.Text;
     person.Id_code = txt_CMND.Text;
     person.Address = txt_address.Text;
     person.Phone   = txt_phoneNumber.Text;
 }
Example #2
0
 private void load_GridView()
 {
     data   = new DataTable();
     bll    = new BLL_Person();
     person = new DTO_Person_Notatry();
     data   = bll.loadDataPersonToGrid(ref err);
     dt_customer.DataSource = data;
 }
Example #3
0
 private void dt_customer_Click(object sender, EventArgs e)
 {
     person         = new DTO_Person_Notatry();
     person.Name    = dt_customer.CurrentRow.Cells["col_name"].Value.ToString();
     person.Id_code = dt_customer.CurrentRow.Cells["col_id_code"].Value.ToString();
     person.Address = dt_customer.CurrentRow.Cells["col_address"].Value.ToString();
     person.Phone   = dt_customer.CurrentRow.Cells["col_phone"].Value.ToString();
     load_DTO_To_Control(person);
 }
Example #4
0
 private void load_DTO_To_Control(DTO_Person_Notatry dto)
 {
     if (dto != null)
     {
         txt_lastname.Text    = dto.Name;
         txt_CMND.Text        = dto.Id_code;
         txt_address.Text     = dto.Address;
         txt_phoneNumber.Text = dto.Phone;
     }
 }
Example #5
0
        private void btn_addInfo_Click(object sender, EventArgs e)
        {
            person         = new DTO_Person_Notatry();
            person.Name    = txt_lastname.Text.Trim();
            person.Id_code = txt_CMND.Text.Trim();
            person.Address = txt_address.Text.Trim();
            person.Phone   = txt_phoneNumber.Text.Trim();
            string data = bll.addPersonData(ref err, person.Name, person.Id_code, person.Address, person.Phone).ToString();

            load_GridView();
        }
        private void txt_address_Leave(object sender, EventArgs e)
        {
            person = new DTO_Person_Notatry();
            bool bo = check_id_code(ref err, txt_id_code.Text, ref person);

            if (!txt_address.Text.Equals(person.Address) && bo)
            {
                DialogResult dialog = MessageBox.Show("Bạn có muốn thay đổi địa chỉ?");
                if (dialog == DialogResult.OK)
                {
                    bll_contract.Update_Notary_Person(ref err, person.Address, person.Phone, person.Name);
                }
            }
        }
        // Auto add txt address when inputing in txt id_code finish
        private void txt_id_code_Leave(object sender, EventArgs e)
        {
            person = new DTO_Person_Notatry();
            bool bo = check_id_code(ref err, txt_id_code.Text, ref person);

            if (bo)
            {
                txt_name_p.Text  = person.Name;
                txt_address.Text = person.Address;
            }
            else
            {
                return;
            }
        }
        // check id_code exits in table person notary
        private bool check_id_code(ref string err, string id_code, ref DTO_Person_Notatry dto)
        {
            bll_contract = new BLL_Contract();
            DataTable dt = new DataTable();

            dt = bll_contract.Check_id_code(ref err, id_code);
            foreach (DataRow row in dt.Rows)
            {
                dto.Id      = (int)row["ID_NPerson"];
                dto.Id_code = (string)row["ID_Code"];
                dto.Name    = (string)row["LastName"];
                dto.Address = (string)row["NPerson_Address"];
                dto.Phone   = "";
            }
            return(dt.Rows.Count != 0 ? true : false);
        }
        //private bool LoadDatabaseDTO(ref List<DTO_Person_Notatry> ls_dto, string id_code)
        //{
        //    bll_contract = new BLL_Contract();
        //    SqlDataReader dataReader = null;
        //    if (dataReader != null)
        //    {
        //        while (dataReader.Read())
        //        {
        //            foreach (DTO_Person_Notatry item in ls_dto)
        //            {
        //                item.Id = (int)dataReader["ID_NPerson"];
        //                item.Id_code = (string)dataReader["ID_Code"];
        //                item.Name = (string)dataReader["LastName"];
        //                item.Address = (string)dataReader["NPerson_Address"];
        //                item.Phone = "";
        //            }

        //        }
        //        return true;
        //    }
        //    return false;
        //}
        private bool LoadDatabaseDTO(ref DTO_Person_Notatry dto, string id_code)
        {
            bll_contract = new BLL_Contract();
            SqlDataReader dataReader = null;

            if (dataReader != null)
            {
                while (dataReader.Read())
                {
                    dto.Id      = (int)dataReader["ID_NPerson"];
                    dto.Id_code = (string)dataReader["ID_Code"];
                    dto.Name    = (string)dataReader["LastName"];
                    dto.Address = (string)dataReader["NPerson_Address"];
                    dto.Phone   = "";
                }
                return(true);
            }
            return(false);
        }
 private void setControltoDTO(DTO_Person_Notatry dto)
 {
     txt_id_code.Text = dto.Id_code;
     txt_name_p.Text  = dto.Name;
     lbl_add.Text     = dto.Address;
 }