private bool check_lns_dang_su_dung(decimal ip_id_lns)
 {
     US_GD_HE_SO_LNS v_us = new US_GD_HE_SO_LNS();
     DS_GD_HE_SO_LNS v_ds = new DS_GD_HE_SO_LNS();
     v_us.FillDataset(v_ds, "where id_he_so_lns =" + ip_id_lns);
     if (v_ds.Tables[0].Rows.Count == 0)
         return false;
     return true;
 }
 private void delete_gd_he_so_lns(decimal v_id_hop_dong)
 {
     US_GD_HE_SO_LNS v_us = new US_GD_HE_SO_LNS();
     DS_GD_HE_SO_LNS v_ds = new DS_GD_HE_SO_LNS();
     v_us.FillDataset(v_ds, "where id_hop_dong = " + v_id_hop_dong);
     for (int i = 0; i < v_ds.Tables[0].Rows.Count; i++)
     {
         decimal v_id_gd_lns = Convert.ToDecimal(v_ds.Tables[0].Rows[i]["ID"]);
         v_us = new US_GD_HE_SO_LNS(v_id_gd_lns);
         v_us.Delete();
     }
 }
        private decimal find_id_gd_hs_lns(decimal ip_dc_id_gd_hd)
        {
            try
            {
                US_GD_HE_SO_LNS v_us = new US_GD_HE_SO_LNS();
                DS_GD_HE_SO_LNS v_ds = new DS_GD_HE_SO_LNS();

                v_us.FillDataset(v_ds);

                string v_str_filter = "ID_HOP_DONG = " + ip_dc_id_gd_hd + " AND DA_XOA = 'N'";
                DataRow[] v_dr = v_ds.GD_HE_SO_LNS.Select(v_str_filter);

                if (v_dr.Count() == 0)
                {
                    return -1;
                }
                else
                {
                    return CIPConvert.ToDecimal(v_dr.First()["ID"].ToString());
                }
            }
            catch (Exception v_e)
            {
                throw v_e;
            }
        }