Example #1
0
        private void LoadCustomerList()
        {
            cboRechargeCardCustomer.Items.Clear();
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMSaleGas_GetCustomerList());
            });

            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;
                    if (ds != null)
                    {
                        DataTable tblResult = ds.Tables[0];
                        if (tblResult.Rows.Count > 0)
                        {
                            ComboboxItem itemAll = new ComboboxItem();
                            itemAll.Text         = SGMText.REPORT_ALL;
                            itemAll.Value        = "";
                            cboRechargeCardCustomer.Items.Add(itemAll);
                            foreach (DataRow dr in tblResult.Rows)
                            {
                                ComboboxItem item = new ComboboxItem();
                                item.Text         = dr["CUS_NAME"].ToString();
                                item.Value        = dr["CUS_ID"].ToString();
                                cboRechargeCardCustomer.Items.Add(item);
                            }
                            cboRechargeCardCustomer.SelectedIndex = 0;
                        }
                    }
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }