Exemplo n.º 1
0
        private void LoadGasStationList()
        {
            cboGasStation.Items.Clear();
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMSaleGas_GetGasStationList(m_stGasStoreID));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    DataSet ds          = dataResponse.ResponseDataSet;
                    DataTable tblResult = ds.Tables[0];
                    if (tblResult.Rows.Count > 0)
                    {
                        ComboboxItem itemAll = new ComboboxItem();
                        itemAll.Text         = SGMText.REPORT_ALL;
                        itemAll.Value        = "";
                        cboGasStation.Items.Add(itemAll);
                        foreach (DataRow dr in tblResult.Rows)
                        {
                            ComboboxItem item = new ComboboxItem();
                            item.Text         = dr["GASSTATION_NAME"].ToString();
                            item.Value        = dr["GASSTATION_ID"].ToString();
                            cboGasStation.Items.Add(item);
                        }
                        cboGasStation.SelectedIndex = 0;
                    }
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }