//check validate data private bool check_ma_qd() { DS_GD_QUYET_DINH v_ds = new DS_GD_QUYET_DINH(); US_GD_QUYET_DINH v_us = new US_GD_QUYET_DINH(); v_us.FillDataset(v_ds); string v_str_filter = ""; v_str_filter = "MA_QUYET_DINH = '" + m_txt_ma_qd.Text + "'"; DataRow[] v_dr = v_ds.GD_QUYET_DINH.Select(v_str_filter); if (v_dr.Count() != 0) { m_txt_ma_qd.BackColor = Color.Bisque; m_lbl_kiem_tra_ma_qd.Visible = true; m_lbl_kiem_tra_ma_qd.Text = "Đã có mã này rồi..."; return true; } else { m_txt_ma_qd.BackColor = Color.White; m_lbl_kiem_tra_ma_qd.Visible = false; return false; } }
private bool check_ma_qd() { DS_GD_QUYET_DINH v_ds = new DS_GD_QUYET_DINH(); US_GD_QUYET_DINH v_us = new US_GD_QUYET_DINH(); v_us.FillDataset(v_ds); string v_str_filter = ""; v_str_filter = "MA_QUYET_DINH = '" + m_txt_ma_qd.Text + "'"; DataRow[] v_dr = v_ds.GD_QUYET_DINH.Select(v_str_filter); if (v_dr.Count() != 0) { return true; } else { return false; } }
private void focus_new_row_created() { int v_row_index = 0; decimal v_id_qd_moi_lap = 0; US_GD_QUYET_DINH v_us = new US_GD_QUYET_DINH(); DS_GD_QUYET_DINH v_ds = new DS_GD_QUYET_DINH(); v_id_qd_moi_lap = find_id_qd_moi_lap(CIPConvert.ToDecimal(m_sle_loai_quyet_dinh.EditValue), m_txt_ma_qd.Text.Trim()); v_us.FillDataset(v_ds); for (v_row_index = 0; v_row_index < v_ds.Tables[0].Rows.Count; v_row_index++) { var v_id_gd_qd = CIPConvert.ToDecimal(m_grv_quyet_dinh.GetDataRow(v_row_index)["ID"].ToString()); if (v_id_gd_qd == v_id_qd_moi_lap) { break; } } m_grv_quyet_dinh.FocusedRowHandle = v_row_index; }
//Insert, update, delete private decimal find_id_qd_moi_lap(decimal ip_dc_id_loai_qd, string ip_str_ma_qd) { try { US_GD_QUYET_DINH v_us = new US_GD_QUYET_DINH(); DS_GD_QUYET_DINH v_ds = new DS_GD_QUYET_DINH(); v_us.FillDataset(v_ds); string v_str_filter = "ID_LOAI_QD = " + ip_dc_id_loai_qd + " AND MA_QUYET_DINH = '" + ip_str_ma_qd + "'"; DataRow[] v_dr = v_ds.GD_QUYET_DINH.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; } }