public void LoadListsOrganization(string strPrtId, string strCsoId, RadComboBox cbPartner, RadComboBox cbCSO, string strLngId, DBConnection dbCon) { #region Variables utilLanguageTranslation utilLT = null; utilListTable uLT = null; DataTable dt = null; string strEmptySingleSelect = string.Empty; #endregion Variables utilLT = new utilLanguageTranslation(); utilLT.Language = strLngId; strEmptySingleSelect = utilLT.GetMessageTranslation(cMIDEmptyListSingleSelect, dbCon.dbCon); #region Get Parent Values if (strCsoId.Length != 0 && !strCsoId.Equals(cEmptyListValue)) { dt = GetCSOParent(strCsoId, dbCon); if (utilCollections.HasRows(dt)) { strPrtId = dt.Rows[0]["prt_id"].ToString(); } else { strCsoId = string.Empty; strPrtId = string.Empty; } } else if (strPrtId.Length != 0 && !strPrtId.Equals(cEmptyListValue)) { strCsoId = string.Empty; } #endregion Get Parent Values #region Load Lists uLT = new utilListTable(); dt = uLT.GetData("lst_partner", true, strPrtId, dbCon.dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbPartner, dt, "lt_id", "lt_name"); dt = GetCSOByParents(strPrtId, dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbCSO, dt, "lt_id", "lt_name"); #endregion Load Lists #region Set List Selection if (strPrtId.Length != 0) { cbPartner.SelectedValue = strPrtId; } else { cbPartner.SelectedIndex = 0; } if (strCsoId.Length != 0) { cbCSO.SelectedValue = strCsoId; } else { cbCSO.SelectedIndex = 0; } #endregion Set List Selection }
public void LoadListsArea(string strRgnId, string strDstId, string strSctId, string strWrdId, RadComboBox cbRegion, RadComboBox cbDistrict, RadComboBox cbSubCounty, RadComboBox cbWard, string strLngId, DBConnection dbCon) { #region Variables utilLanguageTranslation utilLT = null; utilListTable uLT = null; DataTable dt = null; string strEmptySingleSelect = string.Empty; #endregion Variables utilLT = new utilLanguageTranslation(); utilLT.Language = strLngId; strEmptySingleSelect = utilLT.GetMessageTranslation(cMIDEmptyListSingleSelect, dbCon.dbCon); #region Get Parent Values if (strWrdId.Length != 0 && !strWrdId.Equals(cEmptyListValue)) { dt = GetWardParents(strWrdId, dbCon); if (utilCollections.HasRows(dt)) { strSctId = dt.Rows[0]["sct_id"].ToString(); strDstId = dt.Rows[0]["dst_id"].ToString(); if (cbRegion != null) { strRgnId = dt.Rows[0]["rgn_id"].ToString(); } } else { strWrdId = string.Empty; strSctId = string.Empty; strDstId = string.Empty; strRgnId = string.Empty; } } else if (strSctId.Length != 0 && !strSctId.Equals(cEmptyListValue)) { dt = GetSubCountyParents(strSctId, dbCon); if (utilCollections.HasRows(dt)) { strDstId = dt.Rows[0]["dst_id"].ToString(); if (cbRegion != null) { strRgnId = dt.Rows[0]["rgn_id"].ToString(); } } else { strSctId = string.Empty; strDstId = string.Empty; strRgnId = string.Empty; } strWrdId = string.Empty; } else if (strDstId.Length != 0 && !strDstId.Equals(cEmptyListValue)) { dt = GetDistrictParents(strDstId, dbCon); if (utilCollections.HasRows(dt)) { if (cbRegion != null) { strRgnId = dt.Rows[0]["rgn_id"].ToString(); } } else { strDstId = string.Empty; strRgnId = string.Empty; } strWrdId = string.Empty; strSctId = string.Empty; } else if (strRgnId.Length != 0 && !strRgnId.Equals(cEmptyListValue)) { strWrdId = string.Empty; strSctId = string.Empty; strDstId = string.Empty; } else { strWrdId = string.Empty; strSctId = string.Empty; strDstId = string.Empty; strRgnId = string.Empty; } #endregion Get Parent Values #region Load Lists uLT = new utilListTable(); if (cbRegion != null) { dt = uLT.GetData("lst_region", true, strRgnId, false, strLngId, dbCon.dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbRegion, dt, "lt_id", "lt_name"); if (strRgnId.Length != 0) { cbRegion.SelectedValue = strRgnId; } else { cbRegion.SelectedIndex = 0; } } if (cbDistrict != null) { dt = GetDistrictByParents(strRgnId, strLngId, dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbDistrict, dt, "lt_id", "lt_name"); if (strDstId.Length != 0) { cbDistrict.SelectedValue = strDstId; } else { cbDistrict.SelectedIndex = 0; } } if (cbSubCounty != null) { dt = GetSubCountyByParents(strRgnId, strDstId, strLngId, dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbSubCounty, dt, "lt_id", "lt_name"); if (strSctId.Length != 0) { cbSubCounty.SelectedValue = strSctId; } else { cbSubCounty.SelectedIndex = 0; } } if (cbWard != null) { dt = GetWardByParents(strRgnId, strDstId, strSctId, strLngId, dbCon); dt = utilCollections.AddEmptyItemFront(dt, "lt_id", "lt_name", cEmptyListValue, strEmptySingleSelect); utilControls.RadComboBoxFill(cbWard, dt, "lt_id", "lt_name"); if (strWrdId.Length != 0) { cbWard.SelectedValue = strWrdId; } else { cbWard.SelectedIndex = 0; } } #endregion Load Lists }