Exemplo n.º 1
0
        private void Login()
        {
            if (ValidateLoginCode() == false)
            {
                return;
            }

            // request server
            string        SYS_ADMIN = txtAdmin.Text;
            string        SYS_PWD   = txtPwd.Text;
            Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () => {
                return(service.SGMManager_ValidateAdminLogin(SYS_ADMIN, SYS_PWD));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    this.Hide();
                    frmGSMMain.s_currentAdminDTO = dataResponse.ResponseDataSystemAdminDTO;
                    frmGSMMain a = new frmGSMMain();
                    a.ShowDialog();
                    this.Close();
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (m_iCurrentCustomerIndex >= 0)
            {
                string cusID   = m_dsCustomer.Tables[0].Rows[m_iCurrentCustomerIndex]["CUS_ID"].ToString();
                string cusName = m_dsCustomer.Tables[0].Rows[m_iCurrentCustomerIndex]["CUS_NAME"].ToString();

                if ((frmMSg.ShowMsg(SGMText.SGM_WARNING, SGMText.CUSTOMER_DEL_CUS_WARNING + "\n" + cusID + " : " + cusName, SGMMessageType.SGM_MESSAGE_TYPE_QUES) == SGMMessageResult.SGM_MESSAGE_RESULT_OK))
                {
                    Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                        () =>
                    {
                        return(m_service.SGMManager_DelCustomer(cusID));
                    });
                    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)
                        {
                            frmMSg.ShowMsg(SGMText.SGM_INFO, SGMText.CUSTOMER_DEL_CUS_SUCCESS, SGMMessageType.SGM_MESSAGE_TYPE_INFO);
                            LoadCustomerList();
                        }
                        else
                        {
                            frmMSg.ShowMsg(SGMText.SGM_ERROR, response.ResponseErrorMsg + "\n" + response.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                        }
                    }, SynchronizationContext.Current);
                }
            }
        }
Exemplo n.º 3
0
        private void RefreshUpdateHistory()
        {
            DateTime fromDate = dtpBegin.Value;
            DateTime toDate   = dtpEnd.Value;

            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_GetGasStoreUpdateHistory(_storeDTO.GasStoreID, fromDate, toDate));
            });

            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.ResponseDataSet != null)
                    {
                        dgvGasStoreUpdate.DataSource = response.ResponseDataSet.Tables[0];
                    }
                    else
                    {
                        dgvGasStoreUpdate.DataSource = null;
                        dgvGasStoreUpdate.Rows.Clear();
                    }
                }
                else
                {
                    //frmMsg.ShowMsg(SGMText.SGM_ERROR, response.ResponseErrorMsg + "\n" + response.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 4
0
 private void btnLockCard_Click(object sender, EventArgs e)
 {
     if (m_iCurrentCardIndex >= 0)
     {
         bool bUnLock = Boolean.Parse(m_dsCard.Tables[0].Rows[m_iCurrentCardIndex]["CARD_STATE"].ToString());
         bUnLock = !bUnLock;
         string        stCardID = m_dsCard.Tables[0].Rows[m_iCurrentCardIndex]["CARD_ID"].ToString();
         Task <String> task     = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
             () =>
         {
             return(m_service.SGMManager_UpdateCardState(stCardID, bUnLock));
         });
         SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
         {
             String stResponse         = task.Result as String;
             DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
             if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
             {
                 LoadCardList();
             }
             else
             {
                 frmMSg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg + " :  " + dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
             }
         }, SynchronizationContext.Current);
     }
 }
Exemplo n.º 5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!ValidateInput())
            {
                return;
            }

            string        SYS_ADMIN = txtAdmin.Text;
            string        SYS_PWD   = txtPwd.Text;
            Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(service.SGMManager_UpdateAdminAccount(frmGSMMain.s_currentAdminDTO.SysAdminAccount, SYS_ADMIN, SYS_PWD));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    frmMsg.ShowMsg(SGMText.SGM_INFO, SGMText.SYS_ADMIN_CHANGE_SUCCESS, SGMMessageType.SGM_MESSAGE_TYPE_INFO);
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 6
0
        public string UpdateSystemPrice(String jsonSysAdminDTO)
        {
            DataTransfer   dataInput   = JSonHelper.ConvertJSonToObject(jsonSysAdminDTO);
            SystemAdminDAL dalSystemAd = new SystemAdminDAL();
            DataTransfer   response    = dalSystemAd.UpdateSystemAdminPrice(dataInput.ResponseDataSystemAdminDTO);

            return(JSonHelper.ConvertObjectToJSon(response));
        }
Exemplo n.º 7
0
        private void btnBuy_Click(object sender, EventArgs e)
        {
            m_iTimeOutReset = 0;
            if (txtMoney.Text == "0")
            {
                SGMHelper.ShowToolTip(txtMoney, SGMText.GAS_BUYING_INPUT_MONEY_INVALID);
                return;
            }
            SaleGasDTO dto = new SaleGasDTO();

            dto.CardID                 = _cardDTO.CardID;
            dto.GasStationID           = _gasStationDTO.GasStationID;
            dto.SaleGasType            = rbGas92.Checked ? SaleGasDTO.GAS_TYPE_92 : rbGas95.Checked ? SaleGasDTO.GAS_TYPE_95 : SaleGasDTO.GAS_TYPE_DO;
            dto.SaleGasPriceOnCard     = Int32.Parse(txtPrice.Text, System.Globalization.NumberStyles.Currency);
            dto.SaleGasCardMoneyBefore = Int32.Parse(txtMoneyBefore.Text, System.Globalization.NumberStyles.Currency);
            dto.SaleGasCardMoneyAfter  = Int32.Parse(txtMoneyAfter.Text, System.Globalization.NumberStyles.Currency);
            dto.SaleGasCardMoneySaving = Int32.Parse(txtMoneySaving.Text, System.Globalization.NumberStyles.Currency);
            dto.SaleGasCurrentPrice    = m_iCurrentPrice;
            dto.NumberBuyLit           = float.Parse(txtGasBuying.Text, System.Globalization.NumberStyles.Currency);
            dto.GasStoreID             = _gasStationDTO.GasStoreID;
            DataTransfer df = new DataTransfer();

            df.ResponseDataSaleGasDTO = dto;

            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(service.SGMSaleGas_GasBuying(JSonHelper.ConvertObjectToJSon(df)));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    m_bBuy = true;
                    //frmMsg.ShowMsg(SGMText.SGM_INFO, SGMText.GAS_BUYING_SUCCESS, SGMMessageType.SGM_MESSAGE_TYPE_INFO);
                    // _cardDTO.CardRemainingMoney = _cardDTO.CardRemainingMoney - _moneyBuying;
                    // txtCardMoney.Text = _cardDTO.CardRemainingMoney.ToString(MONEY_FORMAT);
                    // calculatePay();
                    EnableTransaction(false, false);
                    grBill.Text       = SGMText.SALEGAS_MAIN_BILL + txtCardName.Text;
                    txtCardID.Text    = "";
                    txtCardMoney.Text = "";
                    txtMoney.Text     = "0";
                    txtCardName.Text  = "";
                    //rbGas92.Enabled = false;
                    //rbGas95.Enabled = false;
                    //rbGasDO.Enabled = false;
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg + "\n" + dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 8
0
        private bool ValidateDataInput()
        {
            bool bValidate = true;

            errProvider.Clear();
            if (txtGSCode.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSCode, SGMText.GASSTATION_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_CheckGasStationExist(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.GASSTATION_DATA_INPUT_EXIST_GS_ID_ERR);
                            bValidate = false;
                        }
                    }
                    else
                    {
                        errProvider.SetError(txtGSCode, SGMText.GASSTATION_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 (cboGasStore.Items.Count <= 0)
            {
                errProvider.SetError(cboGasStore, SGMText.GASSTATION_DATA_INPUT_GS_GASTORE_ERR);
                bValidate = false;
            }
            if (txtGSName.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSName, SGMText.GASSTATION_DATA_INPUT_GS_NAME_ERR);
                bValidate = false;
            }
            if (txtGSAddress.Text.Trim().Equals(""))
            {
                errProvider.SetError(txtGSAddress, SGMText.GASSTATION_DATA_INPUT_GS_ADDRESS_ERR);
                bValidate = false;
            }

            return(bValidate);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (m_iCurrentGSIndex >= 0)
     {
         if (btnEdit.Text.Equals("&Sửa"))
         {
             m_stGSIDEdit = m_dsGasStore.Tables[0].Rows[m_iCurrentGSIndex]["GASSTORE_ID"].ToString();
             btnEdit.Text = "&Lưu";
             UpdateStateControls(true);
             btnReset.Enabled = true;
             txtGSCode.Focus();
         }
         else
         {
             if (!ValidateDataInput())
             {
                 return;
             }
             GasStoreDTO gas = new GasStoreDTO();
             gas.GasStoreID          = txtGSCode.Text.Trim();
             gas.GasStoreName        = txtGSName.Text.Trim();
             gas.GasStoreAddress     = txtGSAddress.Text.Trim();
             gas.GasStoreDescription = txtGSDes.Text.Trim();
             gas.GasStoreMacAddress  = txtMacAddress.Text.Trim();
             gas.GasStoreGas92Total  = float.Parse(txtTotalGas92.Text);
             gas.GasStoreGas95Total  = float.Parse(txtTotalGas95.Text);
             gas.GasStoreGasDOTotal  = float.Parse(txtTotalGasDO.Text);
             DataTransfer request = new DataTransfer();
             request.ResponseDataGasStoreDTO = gas;
             string        jsRequest = JSonHelper.ConvertObjectToJSon(request);
             Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                 () =>
             {
                 return(m_service.SGMManager_UpdateGasStore(jsRequest, m_stGSIDEdit));
             });
             SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
             {
                 String stResponse         = task.Result as String;
                 DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                 if (dataResponse.ResponseCode != DataTransfer.RESPONSE_CODE_SUCCESS)
                 {
                     frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg + "\n" + dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                     return;
                 }
                 m_stGSIDEdit     = "";
                 btnEdit.Text     = "&Sửa";
                 btnReset.Enabled = false;
                 LoadGasStoreList();
                 SelectGSRow(gas.GasStoreID);
                 UpdateStateControls(false);
             }, SynchronizationContext.Current);
         }
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Populates the page with university list
        /// </summary>
        private void PopulateUnitiversityList()
        {
            try
            {
                String strSendData = Constants.CMD_COMMAND_KEY + "=" + Constants.CMD_QUERY_COLLEGE;

                OpenConnection(Global.util, mqUserId, mqPassword);
                OpenQueues(Global.util);
                byte[] msgId    = SendMessage(strSendData, Global.util.MqReplyQ);
                String recvdMsg = ReceiveMessage(msgId);
                CloseConnection();

                if (recvdMsg != "")
                {
                    JSonHelper            helper         = new JSonHelper();
                    List <UniversityData> universityList = helper.ConvertJSonToObject <List <UniversityData> >(recvdMsg);

                    // Clear existing table entries
                    collegeInfoTable.Rows.Clear();

                    // Traverse through list of objects and update table
                    foreach (UniversityData univ in universityList)
                    {
                        TableRow tr = new TableRow();

                        TableCell tcName = new TableCell();
                        tcName.Text  = univ.universityName.Trim();
                        tcName.Width = 400;
                        tr.Cells.Add(tcName);


                        TableCell tcCollege = new TableCell();
                        tcCollege.Text  = univ.universityAdress.Trim();
                        tcCollege.Width = 500;
                        tr.Cells.Add(tcCollege);

                        TableCell tcRating = new TableCell();
                        tcRating.Text  = univ.universityRating.Trim();
                        tcRating.Width = 100;
                        tr.Cells.Add(tcRating);

                        collegeInfoTable.Rows.Add(tr);
                    }
                }
            }
            catch (Exception ex)
            {
                infoLabel.Text = ex.ToString();
                CloseConnection();
            }
        }
Exemplo n.º 12
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (m_iCurrentCustomerIndex >= 0)
     {
         if (btnEdit.Text.Equals("&Sửa"))
         {
             m_stCusIDEdit = m_dsCustomer.Tables[0].Rows[m_iCurrentCustomerIndex]["CUS_ID"].ToString();
             btnEdit.Text  = "&Lưu";
             UpdateStateControls(true);
             txtCusID.Focus();
         }
         else
         {
             if (!ValidateDataInput())
             {
                 return;
             }
             CustomerDTO cus = new CustomerDTO();
             cus.CustomerID        = txtCusID.Text.Trim();
             cus.CustomerName      = txtCusName.Text.Trim();
             cus.CustomerPhone     = txtCusPhone.Text.Trim();
             cus.CustomerBirthDate = txtCusBirthday.Text.Trim();
             cus.CustomerVisa      = txtCusVisa.Text.Trim();
             cus.CustomerAddress   = txtCusAddress.Text.Trim();
             cus.CustomerNote      = txtCusAddress.Text.Trim();
             DataTransfer request = new DataTransfer();
             request.ResponseDataCustomerDTO = cus;
             string        jsRequest = JSonHelper.ConvertObjectToJSon(request);
             Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                 () =>
             {
                 return(m_service.SGMManager_UpdateCustomer(jsRequest, m_stCusIDEdit));
             });
             SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
             {
                 String stResponse         = task.Result as String;
                 DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                 if (dataResponse.ResponseCode != DataTransfer.RESPONSE_CODE_SUCCESS)
                 {
                     frmMSg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg + "\n" + dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                     return;
                 }
                 m_stCusIDEdit = "";
                 btnEdit.Text  = "&Sửa";
                 LoadCustomerList();
                 SelectCustomeRow(cus.CustomerID);
                 UpdateStateControls(false);
             }, SynchronizationContext.Current);
         }
     }
 }
Exemplo n.º 13
0
 public void LoadCardList()
 {
     if (m_iCurrentCustomerIndex >= 0)
     {
         Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
             () =>
         {
             string cusID = "";
             if (m_dsCustomer != null && m_dsCustomer.Tables.Count > 0 && m_dsCustomer.Tables[0].Rows.Count > m_iCurrentCustomerIndex)
             {
                 cusID = m_dsCustomer.Tables[0].Rows[m_iCurrentCustomerIndex]["CUS_ID"].ToString();
             }
             return(m_service.SGMManager_GetCardsOfCustomer(cusID));
         });
         SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
         {
             String stResponse     = task.Result as String;
             DataTransfer response = JSonHelper.ConvertJSonToObject(stResponse);
             dgvCardList.Rows.Clear();
             m_dsCard         = response.ResponseDataSet;
             int iOldSelected = m_iCurrentCardIndex;
             if (m_dsCard != null && dgvCardList.ColumnCount > 0)
             {
                 for (int i = 0; i < m_dsCard.Tables[0].Rows.Count; i++)
                 {
                     dgvCardList.Rows.Add();
                     dgvCardList.Rows[i].Cells[0].Value = (i + 1);
                     dgvCardList.Rows[i].Cells[1].Value = m_dsCard.Tables[0].Rows[i]["CARD_ID"];
                     dgvCardList.Rows[i].Cells[2].Value = m_dsCard.Tables[0].Rows[i]["CARD_MONEY"];
                     dgvCardList.Rows[i].Cells[3].Value = m_dsCard.Tables[0].Rows[i]["CARD_MONEY_EX"];
                     dgvCardList.Rows[i].Cells[4].Value = m_dsCard.Tables[0].Rows[i]["CARD_BUY_DATE"];
                     dgvCardList.Rows[i].Cells[5].Value = m_dsCard.Tables[0].Rows[i]["RECHARGE_DATE"];
                     dgvCardList.Rows[i].Cells[6].Value = !Boolean.Parse(m_dsCard.Tables[0].Rows[i]["CARD_STATE"].ToString());
                 }
                 if (iOldSelected >= 0)
                 {
                     m_iCurrentCardIndex = iOldSelected;
                 }
                 if (m_iCurrentCardIndex >= dgvCusList.Rows.Count)
                 {
                     m_iCurrentCardIndex = -1;
                 }
                 if (m_iCurrentCardIndex >= 0 && m_iCurrentCardIndex < dgvCardList.RowCount)
                 {
                     dgvCardList.Rows[m_iCurrentCardIndex].Selected = true;
                 }
             }
         }, SynchronizationContext.Current);
     }
 }
Exemplo n.º 14
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (btnAdd.Text.Equals("&Thêm"))
            {
                btnAdd.Text = "&Lưu";
                UpdateStateControls(true);
                clearInput();
                txtGSCode.Focus();
            }
            else
            {
                if (!ValidateDataInput())
                {
                    return;
                }
                GasStoreDTO gas = new GasStoreDTO();
                gas.GasStoreID          = txtGSCode.Text.Trim();
                gas.GasStoreName        = txtGSName.Text.Trim();
                gas.GasStoreAddress     = txtGSAddress.Text.Trim();
                gas.GasStoreDescription = txtGSDes.Text.Trim();
                gas.GasStoreGas92Total  = 0;
                gas.GasStoreGas95Total  = 0;
                gas.GasStoreGasDOTotal  = 0;

                DataTransfer request = new DataTransfer();
                request.ResponseDataGasStoreDTO = gas;
                string        jsRequest = JSonHelper.ConvertObjectToJSon(request);
                Task <String> task      = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                    () =>
                {
                    return(m_service.SGMManager_AddNewGasStore(jsRequest));
                });
                SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                {
                    String stResponse         = task.Result as String;
                    DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                    if (dataResponse.ResponseCode != DataTransfer.RESPONSE_CODE_SUCCESS)
                    {
                        frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg + "\n" + dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                        return;
                    }
                    btnAdd.Text = "&Thêm";
                    LoadGasStoreList();
                    SelectGSRow(gas.GasStoreID);
                    UpdateStateControls(false);
                }, SynchronizationContext.Current);
            }
        }
Exemplo n.º 15
0
        public string ChangeCard(string oldCardID, string jsRechargeDTO)
        {
            m_dataRequest  = JSonHelper.ConvertJSonToObject(jsRechargeDTO);
            m_dataResponse = m_dalRecharge.AddRecharge(m_dataRequest.ResponseDataRechargeDTO);
            if (m_dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
            {
                DataTransfer dataResponseUpdateCard = m_dalCard.UpdateMoneyForCard(oldCardID, 0);

                if (dataResponseUpdateCard.ResponseCode == DataTransfer.RESPONSE_CODE_FAIL)
                {
                    m_dataResponse.ResponseCode           = dataResponseUpdateCard.ResponseCode;
                    m_dataResponse.ResponseErrorMsg       = dataResponseUpdateCard.ResponseErrorMsg;
                    m_dataResponse.ResponseErrorMsgDetail = dataResponseUpdateCard.ResponseErrorMsgDetail;
                    //rollback here
                }
            }
            return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
        }
Exemplo n.º 16
0
        public string GasBuying(String jsonSaleGasDTO)
        {
            DataTransfer   dataInput   = JSonHelper.ConvertJSonToObject(jsonSaleGasDTO);
            SystemAdminDAL dalSystemAd = new SystemAdminDAL();
            SaleGasDTO     saleGasDTO  = dataInput.ResponseDataSaleGasDTO;
            DataTransfer   response    = GasBuyingAddSaleGas(saleGasDTO);

            if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
            {
                response = GasBuyingUpdateCard(saleGasDTO.CardID, saleGasDTO.SaleGasCardMoneyAfter, saleGasDTO.SaleGasCardMoneySaving);
                if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    response = GasBuyingUpdateGasStore(saleGasDTO);
                }
            }

            return(JSonHelper.ConvertObjectToJSon(response));
        }
Exemplo n.º 17
0
        private void LoadGasStationList()
        {
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                //if (m_stGasStoreID.Equals(""))
                //    return m_service.SGMManager_GetGasStation(null, null);
                //else
                return(m_service.SGMManager_GetGasStation(null, m_stGasStoreID));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse     = task.Result as String;
                DataTransfer response = JSonHelper.ConvertJSonToObject(stResponse);
                dgvGSList.Rows.Clear();
                m_dsGasStation   = response.ResponseDataSet;
                int iOldSelected = m_iCurrentGSIndex;
                if (m_dsGasStation != null && dgvGSList.ColumnCount > 0)
                {
                    for (int i = 0; i < m_dsGasStation.Tables[0].Rows.Count; i++)
                    {
                        dgvGSList.Rows.Add();
                        dgvGSList.Rows[i].Cells[0].Value = (i + 1);
                        dgvGSList.Rows[i].Cells[1].Value = m_dsGasStation.Tables[0].Rows[i]["GASSTATION_ID"];
                        dgvGSList.Rows[i].Cells[2].Value = m_dsGasStation.Tables[0].Rows[i]["GASSTATION_NAME"];
                        dgvGSList.Rows[i].Cells[3].Value = m_dsGasStation.Tables[0].Rows[i]["GASSTATION_ADDRESS"];
                    }
                    if (iOldSelected >= 0)
                    {
                        m_iCurrentGSIndex = iOldSelected;
                    }
                    if (m_iCurrentGSIndex >= dgvGSList.Rows.Count)
                    {
                        m_iCurrentGSIndex = -1;
                    }
                    if (m_iCurrentGSIndex >= 0)
                    {
                        dgvGSList.Rows[m_iCurrentGSIndex].Selected = true;
                    }
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 18
0
        private void LoadGasStoreList()
        {
            cboGasStore.Items.Clear();
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_GetGasStoreList());
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    DataSet ds          = dataResponse.ResponseDataSet;
                    DataTable tblResult = ds.Tables[0];
                    if (tblResult.Rows.Count > 0)
                    {
                        //ComboboxItem itemAll = new ComboboxItem();
                        //itemAll.Text = SGMText.SGM_ALL;
                        //itemAll.Value = "";
                        //cboGasStore.Items.Add(itemAll);
                        foreach (DataRow dr in tblResult.Rows)
                        {
                            ComboboxItem item = new ComboboxItem();
                            item.Text         = dr["GASSTORE_NAME"].ToString();
                            item.Value        = dr["GASSTORE_ID"].ToString();
                            cboGasStore.Items.Add(item);
                        }
                        if (cboGasStore.Items.Count > 0)
                        {
                            cboGasStore.SelectedIndex = 0;
                        }
                    }
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!ValidateDataInput())
            {
                return;
            }
            frmGSMMain.s_currentAdminDTO.SysApplyDate         = dtpNew.Value;
            frmGSMMain.s_currentAdminDTO.SysGas92CurrentPrice = frmGSMMain.s_currentAdminDTO.SysGas92NewPrice = Int32.Parse(txtGas92NewPrice.Text);
            frmGSMMain.s_currentAdminDTO.SysGas95CurrentPrice = frmGSMMain.s_currentAdminDTO.SysGas95NewPrice = Int32.Parse(txtGas95NewPrice.Text);
            frmGSMMain.s_currentAdminDTO.SysGasDOCurrentPrice = frmGSMMain.s_currentAdminDTO.SysGasDONewPrice = Int32.Parse(txtGasDONewPrice.Text);

            DataTransfer request = new DataTransfer();

            request.ResponseDataSystemAdminDTO = frmGSMMain.s_currentAdminDTO;
            String jsRequest = JSonHelper.ConvertObjectToJSon(request);

            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_UpdateSystemPrice(jsRequest));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    frmMSg.ShowMsg(SGMText.SGM_INFO, SGMText.ADMIN_UPDATE_PRICE_SUCCESS, SGMMessageType.SGM_MESSAGE_TYPE_INFO);
                    DataToUIView();
                }
                else
                {
                    frmMSg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                    frmGSMMain.s_currentAdminDTO.SysGas92CurrentPrice = int.Parse(txtGas92CurrentPrice.Text);
                    frmGSMMain.s_currentAdminDTO.SysGas95CurrentPrice = int.Parse(txtGas95CurrentPrice.Text);
                    frmGSMMain.s_currentAdminDTO.SysGasDOCurrentPrice = int.Parse(txtGasDOCurrentPrice.Text);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 21
0
        private void GetPriceGas()
        {
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () =>
            {
                return(m_service.SGMManager_GetCurrentPrice(SystemAdminDTO.GAS_TYPE_92));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                bool bHasErr            = true;
                String stResponse       = task.Result as String;
                DataTransfer dataResult = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResult.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    m_iPriceGas92 = dataResult.ResponseDataInt;
                    dataResult    = JSonHelper.ConvertJSonToObject(m_service.SGMManager_GetCurrentPrice(SystemAdminDTO.GAS_TYPE_95));
                    if (dataResult.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                    {
                        m_iPriceGas95 = dataResult.ResponseDataInt;
                        dataResult    = JSonHelper.ConvertJSonToObject(m_service.SGMManager_GetCurrentPrice(SystemAdminDTO.GAS_TYPE_DO));
                        if (dataResult.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                        {
                            m_iPriceGasDO = dataResult.ResponseDataInt;
                            bHasErr       = false;
                        }
                    }
                }
                if (bHasErr)
                {
                    m_iPriceGas92 = m_iPriceGas95 = m_iPriceGasDO = 0;
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, SGMText.SYS_ADMIN_GET_PRICE_ERR + "\n" + dataResult.ResponseErrorMsg + ":" + dataResult.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }

                txtRechargeGasPrice.Text = SGMText.GAS_92_TEXT + " : " + m_iPriceGas92 + "đ - " + SGMText.GAS_95_TEXT + " : " + m_iPriceGas95 + "đ - " + SGMText.GAS_DO_TEXT + " : " + m_iPriceGasDO + "đ";
                this.Enabled             = true;
                ShowDialog();
            }, SynchronizationContext.Current);
        }
Exemplo n.º 22
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            // validate user input
            if (ValidateLoginCode() == false)
            {
                return;
            }

            // request server
            string        GASSTORE_ID         = txtLoginCode.Text;
            string        GASSTORE_MACADDRESS = GetMacAddress();
            Task <String> task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                () => {
                return(service.SGMSaleGas_ValidateGasStoreLogin(GASSTORE_ID, GASSTORE_MACADDRESS));
            });

            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
            {
                String stResponse         = task.Result as String;
                DataTransfer dataResponse = JSonHelper.ConvertJSonToObject(stResponse);
                if (dataResponse.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                {
                    this.Hide();
                    if (Program.ReaderPort != null)
                    {
                        Program.ReaderPort.DataReceived -= serialDatahandler;
                    }

                    frmSGMUpdateStore frm = new frmSGMUpdateStore(dataResponse.ResponseDataGasStoreDTO);
                    frm.ShowDialog();
                    this.Close();
                }
                else
                {
                    frmMsg.ShowMsg(SGMText.SGM_ERROR, dataResponse.ResponseErrorMsg, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                }
            }, SynchronizationContext.Current);
        }
Exemplo n.º 23
0
        private void btnUpdateCard_Click(object sender, EventArgs e)
        {
            if (ValidateDataInput())
            {
                DataTransfer  response = null;
                DataTransfer  request  = new DataTransfer();
                Task <String> task;
                if (m_bRecharge)
                {
                    RechargeDTO dtoRecharge = new RechargeDTO();
                    dtoRecharge.RechargeDate        = dtpRechargeDate.Value;
                    dtoRecharge.RechargeGas92Price  = m_iPriceGas92;
                    dtoRecharge.RechargeGas95Price  = m_iPriceGas95;
                    dtoRecharge.RechargeGasDOPrice  = m_iPriceGasDO;
                    dtoRecharge.RechargeMoney       = Int32.Parse(txtCardMoney.Text.Trim());
                    dtoRecharge.RechargeMoneyEx     = Int32.Parse(txtExMoney.Text.Trim());
                    dtoRecharge.RechargeNote        = txtRechargeNote.Text.Trim();
                    dtoRecharge.CardID              = txtCardID.Text.Trim();
                    request.ResponseDataRechargeDTO = dtoRecharge;
                    task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                        () =>
                    {
                        return(m_service.SGMManager_AddRechargeCard(JSonHelper.ConvertObjectToJSon(request)));
                    });
                    SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                    {
                        String stResponse = task.Result as String;
                        response          = JSonHelper.ConvertJSonToObject(stResponse);
                        if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                        {
                            task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                                () =>
                            {
                                return(m_service.SGMManager_UpdateRechargeIDForCard(txtCardID.Text.Trim()));
                            });
                            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                            {
                                stResponse = task.Result as String;
                                response   = JSonHelper.ConvertJSonToObject(stResponse);
                                if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                                {
                                    task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                                        () =>
                                    {
                                        return(m_service.SGMManager_UpdateMoneyForCard(txtCardID.Text.Trim(), m_iCurrentCardMoney + Int32.Parse(txtCardMoney.Text.Trim()) + Int32.Parse(txtExMoney.Text.Trim())));
                                    });
                                    SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                                    {
                                        stResponse = task.Result as String;
                                        response   = JSonHelper.ConvertJSonToObject(stResponse);
                                        if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                                        {
                                            this.Close();
                                        }
                                    }, SynchronizationContext.Current);
                                }
                            }, SynchronizationContext.Current);
                        }
                    }, SynchronizationContext.Current);
                }
                else
                {
                    CardDTO dtoCard = new CardDTO();
                    dtoCard.CardID             = txtCardID.Text.Trim();
                    dtoCard.CardUnlockState    = true;
                    dtoCard.CardRemainingMoney = Int32.Parse(txtCardMoney.Text.Trim());
                    dtoCard.CardMoneyEx        = 0;
                    dtoCard.CardBuyDate        = dtpRechargeDate.Value;
                    dtoCard.RechargeID         = -1;
                    dtoCard.CustomerID         = m_stCusID;

                    request.ResponseDataCardDTO = dtoCard;
                    task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                        () =>
                    {
                        return(m_service.SGMManager_AddNewCard(JSonHelper.ConvertObjectToJSon(request)));
                    });
                    SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                    {
                        String stResponse = task.Result as String;
                        response          = JSonHelper.ConvertJSonToObject(stResponse);
                        if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                        {
                            RechargeDTO dtoRecharge         = new RechargeDTO();
                            dtoRecharge.RechargeDate        = dtpRechargeDate.Value;
                            dtoRecharge.RechargeGas92Price  = m_iPriceGas92;
                            dtoRecharge.RechargeGas95Price  = m_iPriceGas95;
                            dtoRecharge.RechargeGasDOPrice  = m_iPriceGasDO;
                            dtoRecharge.RechargeMoney       = Int32.Parse(txtCardMoney.Text.Trim());
                            dtoRecharge.RechargeNote        = txtRechargeNote.Text.Trim();
                            dtoRecharge.CardID              = txtCardID.Text.Trim();
                            request.ResponseDataRechargeDTO = dtoRecharge;
                            task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                                () =>
                            {
                                if (m_bChangeCard)
                                {
                                    return(m_service.SGMManager_ChangeCard(m_stCardID, JSonHelper.ConvertObjectToJSon(request)));
                                }
                                else
                                {
                                    return(m_service.SGMManager_AddRechargeCard(JSonHelper.ConvertObjectToJSon(request)));
                                }
                            });
                            SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                            {
                                stResponse = task.Result as String;
                                response   = JSonHelper.ConvertJSonToObject(stResponse);
                                if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                                {
                                    task = SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterTask(
                                        () =>
                                    {
                                        return(m_service.SGMManager_UpdateRechargeIDForCard(txtCardID.Text.Trim()));
                                    });
                                    SGM_WaitingIdicator.WaitingForm.waitingFrm.progressReporter.RegisterContinuation(task, () =>
                                    {
                                        stResponse = task.Result as String;
                                        response   = JSonHelper.ConvertJSonToObject(stResponse);
                                        if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS)
                                        {
                                            this.Close();
                                        }
                                        else
                                        {
                                            frmMsg.ShowMsg(SGMText.SGM_ERROR, response.ResponseErrorMsg + " : " + response.ResponseErrorMsgDetail, SGMMessageType.SGM_MESSAGE_TYPE_ERROR);
                                        }
                                    }, SynchronizationContext.Current);
                                }
                            }, SynchronizationContext.Current);
                        }
                    }, SynchronizationContext.Current);
                }
            }
        }
Exemplo n.º 24
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);
        }
Exemplo n.º 25
0
 public string AddNewGasStaion(string jsGasStationDTO)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsGasStationDTO);
     m_dataResponse = m_dalGasStation.AddNewGasStation(m_dataRequest.ResponseDataGasStationDTO);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
Exemplo n.º 26
0
 public string UpdateGasStation(string jsonCustomerDTO, string stGasStationID)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsonCustomerDTO);
     m_dataResponse = m_dalGasStation.UpdateGasStation(m_dataRequest.ResponseDataGasStationDTO, stGasStationID);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
Exemplo n.º 27
0
 public string AddRechargeCard(string jsRechargeDTO)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsRechargeDTO);
     m_dataResponse = m_dalRecharge.AddRecharge(m_dataRequest.ResponseDataRechargeDTO);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
Exemplo n.º 28
0
 public string AddNewCard(string jsCardDTO)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsCardDTO);
     m_dataResponse = m_dalCard.AddNewCard(m_dataRequest.ResponseDataCardDTO);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
Exemplo n.º 29
0
 public string UpdateCustomer(string jsonCustomerDTO, string stCustomerID)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsonCustomerDTO);
     m_dataResponse = m_dalCustomer.UpdateCustomer(m_dataRequest.ResponseDataCustomerDTO, stCustomerID);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }
Exemplo n.º 30
0
 public string AddNewCustomer(string jsonCustomerDTO)
 {
     m_dataRequest  = JSonHelper.ConvertJSonToObject(jsonCustomerDTO);
     m_dataResponse = m_dalCustomer.AddNewCustomer(m_dataRequest.ResponseDataCustomerDTO);
     return(JSonHelper.ConvertObjectToJSon(m_dataResponse));
 }