protected void btnWithdrawRequest_Click(object sender, EventArgs e)
    {
        var latestUserPH = _orderBll.GetLatestUserPh(UserId);

        if (latestUserPH == null)
        {
            DisplayMessage.ShowMessage("ban chua co lenh PH nao het", Page);
            return;
        }

        var lastOrderCode = _orderBll.GetByOrderCode(latestUserPH.LastOrderCode);

        if (latestUserPH.Status == 0 && lastOrderCode.Status == 2)
        {
            DisplayMessage.ShowMessage("lenh ph 20% moi dang cho dc nhan", Page);
        }
        else if (latestUserPH.Status == 1 && lastOrderCode.Status == 2)
        {
            AddNewOrder("Ask");
            lblMessageContent.Text = "Your GH request have been sent successfully.";
            DisplayMessage.ShowAlertModal("ShowAlertSuccess()", Page);
            LoadAllUserOrders();
        }
        else
        {
            DisplayMessage.ShowMessage("ban chua the rut vui long doc ky huong dan", Page);
        }
    }
    protected void btnCompletePayment_Click(object sender, EventArgs e)
    {
        var orderDetail = _orderDetailBll.GetOrderDetailByOrderDetailCode(hfOrderDetailCode.Value);

        if (orderDetail == null)
        {
            return;
        }

        orderDetail.OrderDetailCode = hfOrderDetailCode.Value;
        orderDetail.Status          = 1;
        if (!fuPhotoConfirmation.HasFiles)
        {
            DisplayMessage.ShowMessage("Please select a photo to confirm before complete this payment !", Page);
        }
        else
        {
            var fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + fuPhotoConfirmation.FileName;
            fuPhotoConfirmation.SaveAs(Path.Combine(Server.MapPath("~/Member/Upload/PhConfirm"), fileName));
            orderDetail.Confirmation = fileName;
            _orderDetailBll.UpdateOrderDetail(orderDetail);

            lblMessageContent.Text = "You have been completed successfully.";
            DisplayMessage.ShowAlertModal("ShowAlertSuccess()", Page);
        }

        LoadAllUserOrders();
        LoadAllUserOrderDetail();
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     AddNewBank();
     ResetControl();
     LoadAllUserBanks();
     DisplayMessage.ShowAlertModal("ShowAlertSuccess()", Page);
 }
    protected void btnSaveBid_Click(object sender, EventArgs e)
    {
        var latestUserPH = _orderBll.GetLatestUserPh(UserId);

        if (latestUserPH == null || latestUserPH.RemainingAmount == 0)
        {
            AddNewOrder("Bid");
            lblMessageContent.Text = "You have been sent a Provide Help (PH) request successfully !";
            DisplayMessage.ShowAlertModal("ShowAlertSuccess()", Page);
            LoadAllUserOrders();
            LoadAllUserOrderDetail();
        }
        else
        {
            DisplayMessage.ShowAlertModal("ShowAlertError()", Page);
        }
    }
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        var orderDetail = _orderDetailBll.GetOrderDetailByOrderDetailCode(hfOrderDetailCode.Value);

        if (orderDetail == null)
        {
            return;
        }

        orderDetail.OrderDetailCode = orderDetail.OrderDetailCode;
        orderDetail.Status          = 2;
        _orderDetailBll.UpdateOrderDetail(orderDetail);

        var ghOrder = _orderBll.GetByOrderCode(orderDetail.GHOrderCode);

        ghOrder.OrderCode = ghOrder.OrderCode;

        ghOrder.RemainingAmount = ghOrder.RemainingAmount - orderDetail.Amount;
        ghOrder.Status          = 1;
        _orderBll.UpdateOrder(ghOrder);

        var phOrder = _orderBll.GetByOrderCode(orderDetail.PHOrderCode);

        phOrder.OrderCode       = phOrder.OrderCode;
        phOrder.RemainingAmount = phOrder.RemainingAmount - orderDetail.Amount;

        if (phOrder.RemainingAmount != 0)
        {
            phOrder.Status = 1;
        }
        else
        {
            phOrder.Status = 2;
        }
        _orderBll.UpdateOrder(phOrder);

        /// tinh commission
        ///
        SetCommission(orderDetail.SenderId, float.Parse(orderDetail.Amount.ToString()), 1);

        lblMessageContent.Text = "You have been confirmed successfully.";
        DisplayMessage.ShowAlertModal("ShowAlertSuccess()", Page);
        LoadAllUserOrders();
        LoadAllUserOrderDetail();
    }
 protected void lbtnAskBitcoin_Click(object sender, EventArgs e)
 {
     DisplayMessage.ShowAlertModal("ShowAsk()", Page);
     LoadAllUserBanks();
 }
 protected void lbtnShowOrderDetail_Click(object sender, EventArgs e)
 {
     DisplayMessage.ShowAlertModal("ShowOrderDetail()", Page);
 }
 protected void lbBidBitcoin_Click(object sender, EventArgs e)
 {
     lblMessageContent.Text = "Your Bid have been saved successfully.";
     DisplayMessage.ShowAlertModal("ShowBid()", Page);
 }
 protected void lbAddBitcoinAddress_Click(object sender, EventArgs e)
 {
     DisplayMessage.ShowAlertModal("ShowBitcoinAddressModal()", Page);
 }