Exemplo n.º 1
0
        private void LoadCustomerList()
        {
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_GetCustomer(m_stSearchValue, false));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse     = task.Result as String;
                DataTransfer response = JSonHelper.ConvertJSonToObject(stResponse);
                dgvCusList.Rows.Clear();
                m_dsCustomer     = response.ResponseDataSet;
                int iOldSelected = m_iCurrentCustomerIndex;
                if (m_dsCustomer != null && dgvCusList.ColumnCount > 0)
                {
                    for (int i = 0; i < m_dsCustomer.Tables[0].Rows.Count; i++)
                    {
                        dgvCusList.Rows.Add();
                        dgvCusList.Rows[i].Cells[0].Value = (i + 1);
                        dgvCusList.Rows[i].Cells[1].Value = m_dsCustomer.Tables[0].Rows[i]["CUS_NAME"] + " (" + m_dsCustomer.Tables[0].Rows[i]["CUS_ID"] + ")";
                    }
                    if (iOldSelected >= 0)
                    {
                        m_iCurrentCustomerIndex = iOldSelected;
                    }
                    if (m_iCurrentCustomerIndex >= dgvCusList.Rows.Count)
                    {
                        m_iCurrentCustomerIndex = -1;
                    }
                    if (m_iCurrentCustomerIndex >= 0)
                    {
                        dgvCusList.Rows[m_iCurrentCustomerIndex].Selected = true;
                    }
                }
                //if (dgvCardList.Rows.Count <= 0)
                LoadCardList();
            }, SynchronizationContext.Current);
        }