protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ReceivedData.Value = this.Request["EncryData"];
}
}
PayTelecom_CHT_pay_telecom_cht_s2.aspx.cs 繼承 TelecomBasePage
protected void btnSubmit_Click(object sender, EventArgs e)
{
viewModel = this.GetViewModel(this.ReceivedData.Value); //將object data 解密
viewModel.PhoneNo = txtPhoneNo.Text; // 取得輸入電話號碼
viewModel.IdNoOrTaxId = txtIdNoOrTaxId.Text; // 取得身分證字號
if (!viewModel.Validate()) // 只驗證是否為空,號碼格式無驗證
{
this.ErrorMessage = viewModel.ErrorMessage;
}
else
{
if (IsDeposit) //查詢帳單前,寫ebill操作紀錄log (FunctionName 中華電信費, SystemName eBill, LogDesc[0] 查詢帳單前)
{
this.WriteLog(string.Format("{0}-{1}", SystemName, FunctionName), LogDesc[0], viewModel);
}
else
{
this.WriteLog(string.Format("{0}-{1}", SystemNameMybill, FunctionName), LogDesc[0], viewModel);
}
if (this.SetBills(viewModel)) //log紀錄完之後,查詢是否有帳單
{
this.PostPage(IsDeposit //有帳單 將頁面導向 帳單查詢結果
? ConstParam.PostPageUrl.pay_telecom_cht_s3_deposit
: ConstParam.PostPageUrl.pay_telecom_cht_s3_creditcard, viewModel);
}
else // 沒有帳單 將頁面導向 pay_telecom_cht_s3_fail
{
this.PostPage(ConstParam.PostPageUrl.pay_telecom_cht_s3_fail, viewModel);
}
}
}
private bool SetBills(PayTelecomViewModel<TelecomBillViewModel, TelecomDetailViewModel> model)
{
return IsDeposit
? this.QueryTelecomDeposit(model)
: this.QueryTelecomCreditCard(model);
}
private bool QueryTelecomDeposit(PayTelecomViewModel<TelecomBillViewModel, TelecomDetailViewModel> model)
{
PayTelecom_Deposit bll = new PayTelecom_Deposit(model);
bll.QueryBillDetail();
return bll.Model.Bill.Details.Count > 0; // 若帳單筆數不足一筆,回傳false
}
查詢失敗