/// <summary> /// Method Name : SetEstimateData /// Author : Hiren Patel /// Creation Date : 30 Dec 2017 /// Purpose : Set estimates data /// Revision : /// </summary> public void SetEstimateData(EstimateModel estimateModel, UITableView tableView, EstimateListViewController estimateListViewController) { this.estimateListViewController = estimateListViewController; this.estimateModel = estimateModel; lblEstimateTitle.Text = estimateModel.MoveNumber; if (string.IsNullOrEmpty(estimateModel.EstimatedLineHaul)) { lblExcessValuation.Text = UtilityPCL.CurrencyFormat("0"); } else { lblExcessValuation.Text = estimateModel.EstimatedLineHaul; } if (estimateModel.MoveNumber == UtilityPCL.selectedMoveNumber) { btnSelectEstimate.SetImage(UIImage.FromFile(AppConstant.ESTIMATE_SELECETD_IMAGE_URL), UIControlState.Normal); } else { btnSelectEstimate.SetImage(UIImage.FromFile(AppConstant.ESTIMATE_UNSELECETD_IMAGE_URL), UIControlState.Normal); } SetIimgViewEstimateTap(); btnSelectEstimate.TintColor = UIColor.White; btnSelectEstimate.Layer.BorderWidth = 0; this.tableView = tableView; }
/// <summary> /// Methode Name : CalculateDueAmountToPaymentModel /// Author : Hiren Patel /// Creation Date : 23 Feb 2018 /// Purpose : Calculates the due amount to payment model. /// Revision : /// </summary> private void CalculateDueAmountToPaymentModel() { decimal totalCost = 0; decimal totalPaid = 0; decimal transactionAmount = 0; if (!string.IsNullOrEmpty(paymentModel.TransactionAmount)) { transactionAmount = Convert.ToDecimal(paymentModel.TransactionAmount); } if (!string.IsNullOrEmpty(paymentModel.TotalCost)) { totalCost = Convert.ToDecimal(paymentModel.TotalCost); } if (!string.IsNullOrEmpty(paymentModel.TotalPaid)) { totalPaid = Convert.ToDecimal(paymentModel.TotalPaid) + transactionAmount; paymentModel.TotalPaid = Convert.ToString(totalPaid); } else { totalPaid = transactionAmount; paymentModel.TotalPaid = Convert.ToString(totalPaid); } paymentModel.TotalDue = UtilityPCL.CurrencyFormat(Convert.ToString(totalCost - totalPaid)); }
/// Method Name : SetEditModeViewSwitcherClick /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : Use for ViewSwitcher switch layout /// Revision : /// </summary> private void SetEditModeViewSwitcherClick() { tvUpdatedneedes.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutDisplay) { viewSwitcher.ShowNext(); txtDeclaredvalue.Text = UtilityPCL.RemoveCurrencyFormat(tvDisplayDeclaredvalue.Text); var list = UtilityPCL.ValuationDeductibleList(); valuationDeductible = new ValuationDeductibleModel(); valuationDeductible = list.FirstOrDefault(rc => rc.DeductibleName == tvDisplayCoverage.Text); if (valuationDeductible != null) { spinnerCoverage.SetSelection(valuationDeductible.Index); } else { spinnerCoverage.SetSelection(1); } txtCost.Text = UtilityPCL.RemoveCurrencyFormat(tvDisplayCost.Text); tvBack.Text = StringResource.wizBtnCancel; tvNext.Text = StringResource.wizBtnNextStep; } }; tvSubmitChanges.Click += delegate { if (viewSwitcher.CurrentView == linearLayoutEdit && Validation()) { viewSwitcher.ShowPrevious(); tvDisplayDeclaredvalue.Text = UtilityPCL.CurrencyFormat(txtDeclaredvalue.Text); if (valuationDeductible != null) { tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } else { var list = UtilityPCL.ValuationDeductibleList(); valuationDeductible = new ValuationDeductibleModel(); valuationDeductible = list.FirstOrDefault(rc => rc.DeductibleName == tvDisplayCoverage.Text); tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } tvDisplayCost.Text = UtilityPCL.CurrencyFormat(txtCost.Text); EditData(); tvBack.Text = StringResource.wizBtnBack; tvNext.Text = StringResource.wizYesCapturedCorrectly; } }; }
/// <summary> /// Method Name : BindPaymentData /// Author : Hiren Patel /// Creation Date : 31 Jan 2017 /// Purpose : Binds the payment data. /// Revision : /// </summary> private void BindPaymentData() { if (paymentModel is null) { paymentModel = new PaymentModel() { TotalCost = "0", TotalPaid = "0", Deposit = "0" }; } decimal totalCost = 0; decimal totalPaid = 0; lblTotalCost.Text = UtilityPCL.CurrencyFormat(paymentModel.TotalCost); lblTotalPaid.Text = UtilityPCL.CurrencyFormat(paymentModel.TotalPaid); lblDepositCollected.Text = UtilityPCL.CurrencyFormat(paymentModel.Deposit); if (!string.IsNullOrEmpty(paymentModel.TotalCost)) { totalCost = Convert.ToDecimal(paymentModel.TotalCost); } if (!string.IsNullOrEmpty(paymentModel.TotalPaid)) { totalPaid = Convert.ToDecimal(paymentModel.TotalPaid); } lblTotalDue.Text = UtilityPCL.CurrencyFormat(Convert.ToString(totalCost - totalPaid)); txtAmount.Text = Convert.ToString(totalCost - totalPaid); if (totalCost <= totalPaid || string.IsNullOrEmpty(DTOConsumer.dtoMoveData.MoveNumber)) { EnableDisableButton(btnMakePayment, false); EnableDisableButton(btnClose, false); EnableDisableButton(btnAddAnotherCard, false); ResetControlState(false); txtAmount.Text = string.Empty; } else if (scrollViewSwipeCard.ContentOffset.X == 0 && Cardcounnter > 1) { EnableDisableButton(btnAddAnotherCard, false); EnableDisableButton(btnClose, true); ResetControlState(true); } else { EnableDisableButton(btnAddAnotherCard, true); EnableDisableButton(btnClose, false); ResetControlState(true); } }
/// <summary> /// Method Name : callPaymentService /// Author : Hiren Patel /// Creation Date : 15 Feb 2018 /// Purpose : Calls the payment service. /// Revision : /// </summary> /// <param name="paymentGatewayModel">Payment gateway model.</param> private async Task callPaymentService(PaymentGatewayModel paymentGatewayModel) { APIResponse <PaymentTransactonModel> serviceResponse = new APIResponse <PaymentTransactonModel>() { STATUS = false }; string errorMessage = string.Empty; LoadingOverlay loadingOverlay = UIHelper.ShowLoadingScreen(View); try { serviceResponse = await payment.ProcessPaymentTransaction(paymentGatewayModel); if (serviceResponse.STATUS) { if (serviceResponse.DATA != null) { lblTransactionId.Text = serviceResponse.DATA.TransactionID; lblPaymentStatusAmountPaid.Text = UtilityPCL.CurrencyFormat(Convert.ToString(paymentGatewayModel.TransactionAmout)); await CallPostPaymentTransaction(serviceResponse.DATA, paymentGatewayModel); } } else { errorMessage = serviceResponse.Message; if (serviceResponse.DATA != null) { lblTransactionId.Text = serviceResponse.DATA.TransactionID; } } } catch (Exception error) { errorMessage = error.Message; } finally { loadingOverlay.Hide(); if (!string.IsNullOrEmpty(errorMessage)) { await UIHelper.ShowMessageWithOKConfirm(string.Empty, errorMessage, AppConstant.ALERT_OK_BUTTON_TEXT); } } ShowPaymentStatus(serviceResponse.STATUS); }
/// <summary> /// Method Name : PopulateData /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : fill Estimate Data /// Revision : /// </summary> public void PopulateData() { if (estimateModel != null && string.IsNullOrEmpty(estimateModel.message)) { tvDespositAmmount.Text = UtilityPCL.CurrencyFormat(estimateModel.Deposit); estimateModel.Deposit = UtilityPCL.RemoveCurrencyFormat(estimateModel.Deposit); estimateModel.EstimatedLineHaul = UtilityPCL.RemoveCurrencyFormat(estimateModel.EstimatedLineHaul); if (estimateModel.PaymentStatus) { linearLayoutTransaction.Visibility = ViewStates.Visible; tvDisplayTransactionId.Text = estimateModel.TransactionId; } else { linearLayoutTransaction.Visibility = ViewStates.Gone; tvDisplayTransactionId.Text = string.Empty; } } }
/// <summary> /// Method Name : PopulateData /// Author : Sanket Prajapati /// Creation Date : 2 Dec 2017 /// Purpose : fill Estimate Data /// Revision : /// </summary> public void PopulateData() { if (estimateModel != null && string.IsNullOrEmpty(estimateModel.message)) { tvDisplayDeclaredvalue.Text = UtilityPCL.CurrencyFormat(estimateModel.ExcessValuation); tvDisplayCost.Text = UtilityPCL.CurrencyFormat(estimateModel.ValuationCost); if (!string.IsNullOrEmpty(estimateModel.ValuationDeductible)) { valuationDeductible = UtilityPCL.ValuationDeductibleList().Find(rc => rc.DeductibleName == estimateModel.ValuationDeductible || rc.DeductibleCode == estimateModel.ValuationDeductible); tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } else { valuationDeductible = new ValuationDeductibleModel(); valuationDeductible = UtilityPCL.ValuationDeductibleList().FirstOrDefault(rc => rc.Index == 1); if (valuationDeductible != null) { tvDisplayCoverage.Text = valuationDeductible.DeductibleName; } } } }
/// <summary> /// Event Name : BtnUpdatesNeed_TouchUpInside /// Author : Hiren Patel /// Creation Date : 29 Dec 2017 /// Purpose : To update and change entered services dates /// Revision : By [Ranjana Singh] 08 Feb 2018 /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event Argument</param> private void BtnUpdatesNeed_TouchUpInside(object sender, EventArgs e) { if (!txtCoverageValue.UserInteractionEnabled)//- Removed condition as per Sonar bug. { ResetControlEditMode(); } else { string message = estimateValidateServices.ValidateValuationData(txtDeclaredValue.Text, txtCoverageValue.Text, txtCost.Text); if (string.IsNullOrEmpty(message)) { txtDeclaredValue.Text = UtilityPCL.CurrencyFormat(txtDeclaredValue.Text); txtCost.Text = UtilityPCL.CurrencyFormat(txtCost.Text); SaveDataToDTO(); ResetControlReadOnlyMode(); } else { UIHelper.ShowMessage(message); } } }
/// <summary> /// Method Name : SetValuation /// Author : Vivek Bhavsar /// Creation Date : 22 Jan 2018 /// Purpose : sub method to set data for valuation fields /// Revision : /// </summary> /// <param name="dtoEstimate"></param> private void SetValuation(EstimateModel dtoEstimate) { if (!string.IsNullOrEmpty(dtoEstimate.ExcessValuation)) { dtoEstimate.ExcessValuation = UtilityPCL.CurrencyFormat(dtoEstimate.ExcessValuation); } if (!string.IsNullOrEmpty(dtoEstimate.EstimatedLineHaul)) { dtoEstimate.EstimatedLineHaul = UtilityPCL.CurrencyFormat(dtoEstimate.EstimatedLineHaul); } if (!string.IsNullOrEmpty(dtoEstimate.ValuationDeductible)) { dtoEstimate.ValuationDeductible = UtilityPCL.GetMoveDataDisplayValue(dtoEstimate.ValuationDeductible, MoveDataDisplayResource.msgValuationDeductible); } if (!string.IsNullOrEmpty(dtoEstimate.ValuationCost)) { dtoEstimate.ValuationCost = UtilityPCL.CurrencyFormat(dtoEstimate.ValuationCost); } if (!string.IsNullOrEmpty(dtoEstimate.Deposit)) { dtoEstimate.Deposit = UtilityPCL.CurrencyFormat(dtoEstimate.Deposit); } }