-
Notifications
You must be signed in to change notification settings - Fork 1
/
CheckOut.aspx.cs
58 lines (48 loc) · 1.88 KB
/
CheckOut.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//ID#: 1401375
//Developer: Lomar Lilly
//Module: Enterprise Computing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class CheckOut : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Software software = (Software)Session["Software"];
txtSoftwareId.Text = software.SoftwareId;
lblAmountOutput.Text = Convert.ToString(software.SoftwareAmount);
lblTotalCostOutput.Text = Convert.ToString(software.calculateSoftwareTotalCost());
}
protected void btnBuy_Click(object sender, EventArgs e)
{
int SoftwareId;
try
{
SoftwareId = Convert.ToInt32(txtSoftwareId.Text);
}
catch (Exception)
{
SoftwareId = 1;
}
Customer customer = new Customer();
customer.FirstName = txtFirstName.Text;
customer.LastName = txtLastName.Text;
customer.PaymentMethodID = ddlPaymentMethod.SelectedItem.Text;
customer.NewsLetter = cbNewsletter.Checked;
customer.Total = Convert.ToDouble(lblTotalCostOutput.Text);
customer.Software = SoftwareId;
customer.Amount = lblAmountOutput.Text;
customer.PaymentMethodText = ddlPaymentMethod.SelectedItem.Text;
int customerId = BusinessClass.Customer_Insert(Convert.ToInt16(ddlPaymentMethod.SelectedItem.Value), customer.FirstName, customer.LastName, customer.NewsLetter);
BusinessClass.Transaction_Insert(customerId, SoftwareId, DateTime.Now, Convert.ToDouble(lblTotalCostOutput.Text));
Session["Customer"] = customer;
Response.Redirect("Display.aspx");
}
protected void btnCancel_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
}