public string GET_ID(int id) { JSonHelper jSonHelper = new JSonHelper(); string result = jSonHelper.ConvertObjectToJSon(_allAutos.GetAuto(id)); if (String.IsNullOrEmpty(result)) { return("Объект не найден"); } return(jSonHelper.ConvertObjectToJSon(_allAutos.GetAuto(id))); }
public string Get(int id) //GET/id method { JSonHelper jSonHelper = new JSonHelper(); if (_allAutos.Autos.Where(c => c.Id == id).Count() == 0) { return("Объект не найден"); } string result = jSonHelper.ConvertObjectToJSon(_allAutos.GetAuto(id)); return(jSonHelper.ConvertObjectToJSon(_allAutos.GetAuto(id))); }
public string GetCustomerList() { CustomerDAL dalCustomer = new CustomerDAL(); DataTransfer response = dalCustomer.GetCustomerList(); return(JSonHelper.ConvertObjectToJSon(response)); }
public string GetCurrentPrice(int iGasType) { SystemAdminDAL dalSystemAd = new SystemAdminDAL(); DataTransfer response = dalSystemAd.GetCurrentPrice(iGasType); return(JSonHelper.ConvertObjectToJSon(response)); }
public string GetSaleGasReport(string stGasStoreID, string stGasStationID, DateTime dateStart, DateTime dateEnd, string stCardID) { SaleGasDAL dal = new SaleGasDAL(); DataTransfer dataResult = dal.GetSaleGasReport(stGasStoreID, stGasStationID, dateStart, dateEnd, stCardID); return(JSonHelper.ConvertObjectToJSon(dataResult)); }
public string ValidateGasStationLogin(string stGasStationID, string stGasStationMacAddress) { GasStationDAL dalGasStation = new GasStationDAL(); DataTransfer response = dalGasStation.ValidateGasStationLogin(stGasStationID, stGasStationMacAddress); if (response.ResponseCode == DataTransfer.RESPONSE_CODE_SUCCESS) { SystemAdminDAL dalSystemAdmin = new SystemAdminDAL(); DataTransfer responseAdmin = dalSystemAdmin.GetCurrentPrice(SystemAdminDTO.GAS_TYPE_ALL); response.ResponseCurrentPriceGas92 = responseAdmin.ResponseCurrentPriceGas92; response.ResponseCurrentPriceGas95 = responseAdmin.ResponseCurrentPriceGas95; response.ResponseCurrentPriceGasDO = responseAdmin.ResponseCurrentPriceGasDO; response.ResponseDataSystemAdminDTO = responseAdmin.ResponseDataSystemAdminDTO; GasStoreDAL dalGasStore = new GasStoreDAL(); DataTransfer responseGasStore = dalGasStore.GetGasStoreFromGasStation(stGasStationID); response.ResponseDataGasStoreDTO = responseGasStore.ResponseDataGasStoreDTO; response.ResponseGasStoreGas92Total = responseGasStore.ResponseDataGasStoreDTO.GasStoreGas92Total; response.ResponseGasStoreGas95Total = responseGasStore.ResponseDataGasStoreDTO.GasStoreGas95Total; response.ResponseGasStoreGasDOTotal = responseGasStore.ResponseDataGasStoreDTO.GasStoreGasDOTotal; } return(JSonHelper.ConvertObjectToJSon(response)); }
/// <summary> /// Read records from database /// </summary> /// <returns></returns> private String getRecordsFromDB() { String recordsList = null; try { // SQL query to read college records from database SqlCommand sqlQury = new SqlCommand("SELECT * FROM University", _sqlConnection); SqlDataReader reader = sqlQury.ExecuteReader(); // Build a list of colleges List <mqHelpers.UniversityData> ciList = new List <mqHelpers.UniversityData>(); // Iterate through all records we have got and build a list while (reader.Read()) { UniversityData ci = new UniversityData(); ci.universityName = reader[Constants.SQL_COLMN_COLLEGE_NAME].ToString(); ci.universityAdress = reader[Constants.SQL_COLMN_COLLEGE_ADRESS].ToString(); ci.universityRating = reader[Constants.SQL_COLMN_COLLEGE_REATING].ToString(); ciList.Add(ci); } // Convert the list to a JSon object JSonHelper js = new JSonHelper(); recordsList = js.ConvertObjectToJSon(ciList); } catch (Exception ex) { Trace.TraceInformation("Failed reading records" + ex.ToString()); } return(recordsList); }
public string UpdateSystemPrice(String jsonSysAdminDTO) { DataTransfer dataInput = JSonHelper.ConvertJSonToObject(jsonSysAdminDTO); SystemAdminDAL dalSystemAd = new SystemAdminDAL(); DataTransfer response = dalSystemAd.UpdateSystemAdminPrice(dataInput.ResponseDataSystemAdminDTO); return(JSonHelper.ConvertObjectToJSon(response)); }
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); }
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); } } }
public string GetGasStore(string stGasStoreID) { if (stGasStoreID == null) { m_dataResponse = m_dalGasStore.GetGasStores(); } else { m_dataResponse = m_dalGasStore.GetGasStore(stGasStoreID); } return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
public string GetCustomer(string stCustomerID, bool bExactly) { if (bExactly) { m_dataResponse = m_dalCustomer.GetCustomer(stCustomerID); } else { m_dataResponse = m_dalCustomer.GetCustomers(stCustomerID); } return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
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); } } }
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); } }
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)); }
public string ValidateAdminLogin(string admin, string pwd) { SystemAdminDAL dalSysAdmin = new SystemAdminDAL(); DataTransfer response = new DataTransfer(); SystemAdminDTO dto = dalSysAdmin.GetSystemAdminInfo(admin, pwd); if (dto != null) { response.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS; response.ResponseDataSystemAdminDTO = dto; } else { response.ResponseCode = DataTransfer.RESPONSE_CODE_FAIL; response.ResponseErrorMsg = SGMText.ADMIN_LOGON_ERROR; } return(JSonHelper.ConvertObjectToJSon(response)); }
public string UpdateAdminAccount(string admin, string admin_new, string pwd) { SystemAdminDAL dalSysAdmin = new SystemAdminDAL(); DataTransfer response = new DataTransfer(); bool res = dalSysAdmin.UpdateAdminAccount(admin, admin_new, pwd); if (res == true) { response.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS; response.ResponseErrorMsg = SGMText.SYS_ADMIN_CHANGE_SUCCESS; } else { response.ResponseCode = DataTransfer.RESPONSE_CODE_FAIL; response.ResponseErrorMsg = SGMText.SYS_ADMIN_CHANGE_FAIL; } return(JSonHelper.ConvertObjectToJSon(response)); }
public string GetGasStationList(string stGasStoreID) { GasStationDAL dalGasStation = new GasStationDAL(); DataTransfer response = new DataTransfer(); DataSet ds = dalGasStation.GetGasStationList(stGasStoreID); if (ds != null) { response.ResponseDataSet = ds; response.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS; } else { response.ResponseCode = DataTransfer.RESPONSE_CODE_FAIL; } return(JSonHelper.ConvertObjectToJSon(response)); }
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)); }
public string ValidateCardId(string strCardId) { CardDAL dalCard = new CardDAL(); DataTable tblCard = dalCard.ValidateCardID(strCardId); DataTransfer dataResult = new DataTransfer(); if (tblCard.Rows.Count > 0) { dataResult.ResponseCode = DataTransfer.RESPONSE_CODE_SUCCESS; DataSet ds = new DataSet(); ds.Tables.Add(tblCard.Copy()); dataResult.ResponseDataSet = ds; } else { dataResult.ResponseCode = DataTransfer.RESPONSE_CODE_FAIL; dataResult.ResponseErrorMsg = SGMText.GAS_STATION_CARD_ID_NOT_EXIST; } return(JSonHelper.ConvertObjectToJSon(dataResult)); }
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); }
public string GetCardReport(string stGasStationID, DateTime dateStart, DateTime dateEnd, string stCardID) { DataTransfer dataResult = m_dalCard.GetCardReport(stGasStationID, dateStart, dateEnd, stCardID); return(JSonHelper.ConvertObjectToJSon(dataResult)); }
public string UpdateCardState(string stCardID, bool bLocked) { m_dataResponse = m_dalCard.UpdateCardState(stCardID, bLocked); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
public string UpdateMoneyForCard(string stCardID, int iMoney, int iMoneyEx) { m_dataResponse = m_dalCard.UpdateMoneyForCard(stCardID, iMoney, iMoneyEx); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
public string UpdateRechargeIDForCard(string stCardID) { m_dataResponse = m_dalCard.UpdateRechargeIDForCard(stCardID); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
public string AddRechargeCard(string jsRechargeDTO) { m_dataRequest = JSonHelper.ConvertJSonToObject(jsRechargeDTO); m_dataResponse = m_dalRecharge.AddRecharge(m_dataRequest.ResponseDataRechargeDTO); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
public string AddNewCard(string jsCardDTO) { m_dataRequest = JSonHelper.ConvertJSonToObject(jsCardDTO); m_dataResponse = m_dalCard.AddNewCard(m_dataRequest.ResponseDataCardDTO); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }
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); } } }
private void DoDDPayment() { AndHUD.Shared.Show(this, "Please wait ...", -1, MaskType.Clear); string url = Settings.InstanceURL; var url2 = url + "/Api/MakeDebitPayment"; var amount = Decimal.Parse(this.et_Amount.Text); if (Settings.MakePaymentIn3Part) { paymentType = 2; } else if (Settings.MakePaymentInstallment) { paymentType = 3; } else if (amount == Settings.TotalOutstanding) { Settings.MakePaymentInFull = true; paymentType = 1; } else if (amount < Settings.TotalOutstanding) { Settings.MakePaymentOtherAmount = true; paymentType = 4; } var DebtorPaymentInstallment = ""; if (Settings.MakePaymentIn3Part || Settings.MakePaymentInstallment) { JSonHelper helper = new JSonHelper(); string jsonResult = helper.ConvertObjectToJSon(this.instalmentList); DebtorPaymentInstallment = jsonResult; } var json2 = new { Item = new { ReferenceNumber = Settings.RefNumber, Amount = this.et_Amount.Text, DirectDebitAccountName = this.et_AccountName.Text, DirectDebitAccountNumber = this.et_AccountNumber.Text, DirectDebitBSB = this.et_BSB.Text, PaymentType = paymentType, PaymentMethod = "2", DebtorPaymentInstallment = DebtorPaymentInstallment, InstalmentPaymentFrequency = Settings.Frequency } }; try { var ObjectReturn2 = new PaymentReturnModel(); string results = ConnectWebAPI.Request(url2, json2); if (string.IsNullOrEmpty(results)) { AndHUD.Shared.Dismiss(); this.RunOnUiThread(() => this.bt_Continue.Enabled = true); this.RunOnUiThread(() => alert = new Alert(this, "Error", Resources.GetString(Resource.String.NoServer))); this.RunOnUiThread(() => alert.Show()); } else { ObjectReturn2 = Newtonsoft.Json.JsonConvert.DeserializeObject <PaymentReturnModel>(results); if (ObjectReturn2.IsSuccess) { TrackingHelper.SendTracking("Make DD Payment"); Intent Intent = new Intent(this, typeof(UpdatePersonalInformationActivity)); Intent.PutExtra("ScreenComeFrom", "MakeDDPayment"); ////////////////////////////////////////////////////////////////////////////////////////////////// Intent.PutExtra("tv_TransactionDescription", ObjectReturn2.TransactionDescription); Intent.PutExtra("tv_ReceiptNumber", ObjectReturn2.ReceiptNumber); Intent.PutExtra("tv_Amount", ObjectReturn2.Amount); Intent.PutExtra("tv_Time", ObjectReturn2.Time); Intent.PutExtra("tv_Date", ObjectReturn2.Date); Intent.PutExtra("tv_Name", ObjectReturn2.Name); Intent.PutExtra("PaymentMethod", 2); Intent.PutExtra("PaymentType", this.paymentType); Intent.PutExtra("PaymentId", ObjectReturn2.PaymentId); Intent.PutExtra("ClientName", ObjectReturn2.ClientName); Intent.PutExtra("FirstDebtorPaymentInstallmentId", ObjectReturn2.FirstDebtorPaymentInstallmentId); StartActivity(Intent); AndHUD.Shared.Dismiss(); this.Finish(); } else { AndHUD.Shared.Dismiss(); this.RunOnUiThread(() => this.bt_Continue.Enabled = true); this.RunOnUiThread(() => alert = new Alert(this, "Error", ObjectReturn2.Errors[0].ErrorMessage)); this.RunOnUiThread(() => alert.Show()); } } } catch (Exception ee) { this.RunOnUiThread(() => this.bt_Continue.Enabled = true); AndHUD.Shared.Dismiss(); } }
public string GetCardsOfCustomer(string stCusID) { m_dataResponse = m_dalCard.GetCardsOfCustomer(stCusID); return(JSonHelper.ConvertObjectToJSon(m_dataResponse)); }