Example #1
0
        private bool ValidateDataInput()
        {
            bool bValidate = true;

            SGMHelper.Clear();
            if (txtCusID.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCusID, SGMText.CUSTOMER_DATA_INPUT_CUS_ID_ERR);
                bValidate = false;
            }
            else if (!txtCusID.Text.Trim().Equals(m_stCusIDEdit))
            {
                Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                    () =>
                {
                    return(m_service.SGMManager_CheckCustomerExist(txtCusID.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)
                        {
                            SGMHelper.ShowToolTip(txtCusID, SGMText.CUSTOMER_DATA_INPUT_EXIST_CUS_ID_ERR);
                            bValidate = false;
                        }
                    }
                    else
                    {
                        SGMHelper.ShowToolTip(txtCusID, SGMText.CUSTOMER_GET_CUS_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 (txtCusName.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCusName, SGMText.CUSTOMER_DATA_INPUT_CUS_NAME_ERR);
                bValidate = false;
            }
            if (txtCusBirthday.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCusBirthday, SGMText.CUSTOMER_DATA_INPUT_CUS_BIRTHDAY_ERR);
                bValidate = false;
            }
            if (txtCusVisa.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCusVisa, SGMText.CUSTOMER_DATA_INPUT_CUS_VISA_ERR);
                bValidate = false;
            }
            return(bValidate);
        }