예제 #1
0
    protected void btnpayment0_Click(object sender, EventArgs e)
    {
        GoDine a = new GoDine();
        long barcode = 0;
        int success = -1;
        decimal amount = 0;
        try
        {
            barcode = Convert.ToInt64(ddtransactionID.SelectedValue);
            barcode = UTILITIES.removeCheckSum(barcode);
            amount = Convert.ToDecimal(tbtransactionCAD.Text);
            success = 1;
        }
        catch
        {
            success = 0;
        }

        if (success == 1 && !ddtransactionCUser.SelectedValue.Contains("---"))
        {
            string concept = tbtransactionconcept.Text;
            TransactionStatus ts = a.Transaction_from_GcBC_2_CUser(barcode, ddtransactionCUser.SelectedValue, amount, concept, 1);
            if (ts.status == 1000)
            {
                lbltransaction.Text = "OK -> The amount of $" + amount.ToString() + " has been paid to company user " + ddtransactionCUser.SelectedValue + " with the gift card " + barcode.ToString() + ". There is $" + ts.moneyleft.ToString() + " left";
                tbtransactionCAD.Text = "";
            }
            else
            {
                lbltransaction.Text = "ATTENTION -> Transaction not made because there is " + ts.moneyleft + " dollars left in the selected gift card";
            }

        }
        else
        {
            lbltransaction.Text = "ERROR -> A valid amount of money must be inserted for the gift card selected, a company user must also be selected";
        }
    }