Esempio n. 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);
        }
Esempio n. 2
0
 private void clearForm()
 {
     //rbGas92.Checked = true;
     txtMoney.Text       = 0.ToString(MONEY_FORMAT);
     grBill.Text         = SGMText.SALEGAS_MAIN_BILL;
     txtGasBuying.Text   = 0.ToString(MONEY_FORMAT);
     txtGasType.Text     = "";
     txtPrice.Text       = 0.ToString(MONEY_FORMAT);
     txtMoneyBefore.Text = 0.ToString(MONEY_FORMAT);
     txtMoneyBuying.Text = 0.ToString(MONEY_FORMAT);
     txtMoneyAfter.Text  = 0.ToString(MONEY_FORMAT);
     txtMoneySaving.Text = 0.ToString(MONEY_FORMAT);
     SGMHelper.Clear();
     grBill.Text = SGMText.SALEGAS_MAIN_BILL;
 }
Esempio n. 3
0
        private void calculatePay()
        {
            //EnableTransaction(true, false);
            SGMHelper.Clear();
            btnBuy.Enabled = true;
            try
            {
                if (m_iCurrentPrice > 0)
                {
                    _moneyBuying = Int32.Parse(txtMoney.Text, System.Globalization.NumberStyles.Currency);
                    float _totalBuying = (float)_moneyBuying / m_iCurrentPrice;
                    if (_totalBuying <= m_iCurrentTotal)
                    {
                        float _moneyRealBuying = _totalBuying * m_iApplyPrice;
                        float moneyAfter       = _cardDTO.CardRemainingMoney - _moneyRealBuying;
                        if (moneyAfter >= 0)
                        {
                            txtMoneyBefore.Text = _cardDTO.CardRemainingMoney.ToString(MONEY_FORMAT);
                            txtGasBuying.Text   = Math.Round(_totalBuying, 1).ToString();
                            txtMoneyAfter.Text  = moneyAfter.ToString(MONEY_FORMAT);

                            txtMoneySaving.Text = (m_iSavingMoney * _totalBuying).ToString(MONEY_FORMAT);
                            txtMoneyBuying.Text = _moneyRealBuying.ToString(MONEY_FORMAT);
                        }
                        else
                        {
                            SGMHelper.ShowToolTip(txtMoney, SGMText.GAS_BUYING_INPUT_MONEY_FAIL);
                            btnBuy.Enabled = false;
                        }
                    }
                    else
                    {
                        SGMHelper.ShowToolTip(txtMoney, SGMText.GAS_BUYING_INPUT_TOTAL_GAS_FAIL);
                        btnBuy.Enabled = false;
                    }
                }
            }
            catch (Exception)
            {
                txtMoneyBefore.Text = "";
                txtGasBuying.Text   = "";
                txtMoneyAfter.Text  = "";
                txtMoneyBuying.Text = "";
                txtMoneySaving.Text = "";
            }
        }
Esempio n. 4
0
 private void UpdateStateControls(bool isEditMode)
 {
     txtSearch.Enabled      = (!isEditMode && (dgvCusList.RowCount > 0));
     btnSearch.Enabled      = (!isEditMode && (dgvCusList.RowCount > 0));
     dgvCusList.Enabled     = !isEditMode;
     dgvCardList.Enabled    = !isEditMode;
     txtCusID.Enabled       = isEditMode;
     txtCusName.Enabled     = isEditMode;
     txtCusBirthday.Enabled = isEditMode;
     txtCusVisa.Enabled     = isEditMode;
     txtCusPhone.Enabled    = isEditMode;
     txtCusAddress.Enabled  = isEditMode;
     txtNote.Enabled        = isEditMode;
     btnBuyCard.Enabled     = (!isEditMode && (dgvCusList.RowCount > 0));
     btnLockCard.Enabled    = (!isEditMode && (dgvCardList.RowCount > 0));
     btnRecharge.Enabled    = (!isEditMode && (dgvCardList.RowCount > 0));
     dgvCardList.Enabled    = !isEditMode;
     btnCancel.Enabled      = isEditMode;
     btnDelete.Enabled      = (!isEditMode && (dgvCusList.RowCount > 0));
     btnAdd.Enabled         = (!isEditMode || btnAdd.Text.Equals("&Lưu"));
     btnEdit.Enabled        = ((!isEditMode && (dgvCusList.RowCount > 0)) || (isEditMode && btnEdit.Text.Equals("&Lưu")));
     SGMHelper.Clear();
 }