Esempio n. 1
0
        private bool ValidateDataInput()
        {
            bool bValidate = true;

            errProvider.Clear();
            if (txtGSCode.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSCode, SGMText.GASSTORE_DATA_INPUT_GS_ID_ERR);
                bValidate = false;
            }
            else if (!txtGSCode.Text.Trim().Equals(m_stGSIDEdit))
            {
                Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                    () =>
                {
                    return(m_service.SGMManager_CheckGasStoreExist(txtGSCode.Text.Trim()));
                });
                SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                {
                    String stResponse     = task.Result as String;
                    DataTransfer response = JSonHelper.ConvertJSonToObject(stResponse);
                    if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                    {
                        if (response.ResponseDataBool)
                        {
                            errProvider.SetError(txtGSCode, SGMText.GASSTORE_DATA_INPUT_EXIST_GS_ID_ERR);
                            bValidate = false;
                        }
                    }
                    else
                    {
                        errProvider.SetError(txtGSCode, SGMText.GASSTORE_GET_GS_ERR);
                        frmMsg.ShowMsg(SGMText.SGM_ERROR, SGMText.CUSTOMER_GET_CUS_ERR + "\n" + response.ResponseErrorMsg + ":\n" + response.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                        bValidate = false;
                    }
                }, SynchronizationContext.Current);
            }
            if (txtGSName.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSName, SGMText.GASSTORE_DATA_INPUT_GS_NAME_ERR);
                bValidate = false;
            }
            if (txtGSAddress.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSAddress, SGMText.GASSTORE_DATA_INPUT_GS_ADDRESS_ERR);
                bValidate = false;
            }

            return(bValidate);
        }