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

            SGMHelper.ShowToolTip(txtCardID, "");
            SGMHelper.ShowToolTip(txtCardMoney, "");
            SGMHelper.ShowToolTip(txtExMoney, "");
            SGMHelper.ShowToolTip(dtpRechargeDate, "");

            if (txtCardID.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCardID, SGMText.CARD_DATA_INPUT_CARD_ID_ERR);
                bValidate = false;
            }
            else if (!m_bRecharge)
            {
                Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                    () =>
                {
                    return(m_service.SGMManager_CheckCardExist(txtCardID.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(txtCardID, SGMText.CARD_DATA_INPUT_EXIST_CARD_ID_ERR);
                            bValidate = false;
                        }
                    }
                    else
                    {
                        SGMHelper.ShowToolTip(txtCardID, SGMText.CARD_GET_CARD_ERR);
                        frmMsg.ShowMsg(SGMText.SGM_ERROR, SGMText.CARD_GET_CARD_ERR + "\n" + response.ResponseErrorMsg + ":\n" + response.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                        bValidate = false;
                    }
                }, SynchronizationContext.Current);
            }
            if (txtCardMoney.Text.Trim().Equals(""))
            {
                SGMHelper.ShowToolTip(txtCardMoney, SGMText.CARD_DATA_INPUT_CARD_MONEY_ERR);
                bValidate = false;
            }
            //else if (txtRechargeMoney.Text.Trim().Equals(""))
            //{
            //    SGMHelper.ShowToolTip(txtRechargeMoney, SGMText.CARD_DATA_INPUT_CARD_PRICE_ERR);
            //    bValidate = false;
            //}
            //else if (Int32.Parse(txtCardMoney.Text.Trim()) < Int32.Parse(txtExMoney.Text.Trim()))
            //{
            //    SGMHelper.ShowToolTip(txtExMoney, SGMText.CARD_DATA_INPUT_CARD_MONEY_PRICE_ERR);
            //    bValidate = false;
            //}
            //if (!m_bStateUpdate)
            {
                if (dtpRechargeDate.Value.Date < DateTime.Now.Date)
                {
                    SGMHelper.ShowToolTip(dtpRechargeDate, SGMText.CARD_DATA_INPUT_DATE_ERR);
                    bValidate = false;
                }
            }

            return(bValidate);
        }