public object[] queryComboMstDistricts(MST_DISTRICTS param) { log.Info("Start log INFO... queryComboMstDistricts"); MsgForm msgError = new MsgForm(); List <MST_DISTRICTS> resultList = new List <MST_DISTRICTS>(); try { using (var db = new PaknampoScaleDBEntities()) { resultList = (from row in db.MST_DISTRICTS where row.AMPHURE_ID == param.AMPHURE_ID select row).ToList(); db.Dispose(); msgError.statusFlag = MsgForm.STATUS_SUCCESS; } } catch (Exception ex) { log.Error(ex.ToString(), ex); msgError.statusFlag = MsgForm.STATUS_ERROR; msgError.messageDescription = ex.ToString(); } finally { log.Info("End log INFO... queryComboMstDistricts"); } return(new object[] { msgError, resultList }); }
public void queryComboMstDistricts() { MST003Controller mst003Ctrl = new MST003Controller(); MST_DISTRICTS form = new MST_DISTRICTS(); try { if (!formMstVendor.VENDOR_AMPHURE.Equals(0)) { form.AMPHURE_ID = formMstVendor.VENDOR_AMPHURE; } else { form.AMPHURE_ID = Int32.Parse(cboAmphure.SelectedValue.ToString()); } if (Util.isEmpty(form.AMPHURE_ID)) { return; } object[] result = mst003Ctrl.queryComboMstDistricts(form); MsgForm msgForm = (MsgForm)result[0]; //List<MST_DISTRICTS> lstdata = (List<MST_DISTRICTS>)result[1]; lstdataDistricts = (List <MST_DISTRICTS>)result[1]; if (msgForm.statusFlag.Equals(1)) { cboDistricts.DataSource = lstdataDistricts; cboDistricts.ValueMember = "DISTRICT_ID"; cboDistricts.DisplayMember = "NAME_TH"; cboDistricts.SelectedValue = ""; } else { MessageBox.Show("Error : " + msgForm.messageDescription); } } catch (Exception ex) { log.Error(ex.ToString(), ex); MessageBox.Show("Error : " + ex.ToString()); } }