-
Notifications
You must be signed in to change notification settings - Fork 0
/
odeme-bilgileri.aspx.cs
65 lines (61 loc) · 1.97 KB
/
odeme-bilgileri.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
59
60
61
62
63
64
65
using System;
public partial class odeme_bilgileri : System.Web.UI.Page
{
private TurPaylasimEntities db = new TurPaylasimEntities();
private string turID;
private tblTur tur;
private tblOdeme odeme = new tblOdeme();
private tblTuraKatilanlar tk = new tblTuraKatilanlar();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["uyeId"] == null)
{
Response.Redirect("~/giris-yap");
}
else
{
TurFiyatiniGetir();
}
}
private void TurFiyatiniGetir()
{
turID = Request.QueryString["Tur"];
if (turID == null)
{
Response.Redirect("");
}
else
{
tur = db.tblTur.Find(int.Parse(turID));
TextBoxFiyat.Text = tur.Fiyat.ToString() + "₺";
}
}
protected void buttonOde_Click(object sender, EventArgs e)
{
try
{
odeme.KartSahibi = TextBoxKartSahibi.Text;
odeme.KartNo = TextBoxKartNo.Text;
odeme.SKT = TextBoxSKT.Text;
odeme.CVV = TextBoxCVV.Text;
odeme.OdemeTarihi = DateTime.Now;
odeme.Durum = "B";
odeme.UyeId = int.Parse(Session["uyeId"].ToString());
odeme.TurId = int.Parse(Request.QueryString["Tur"].ToString());
db.tblOdeme.Add(odeme);
tk.UyeId = int.Parse(Session["uyeId"].ToString());
tk.TurId = int.Parse(Request.QueryString["Tur"].ToString());
tk.RehberId = odeme.tblTur.tblRehber.Id;
db.tblTuraKatilanlar.Add(tk);
tk.Fiyat = tur.Fiyat;
db.SaveChanges();
labelMessage.ForeColor = System.Drawing.Color.Green;
labelMessage.Text = "Ödeme Başarılı !";
Response.AddHeader("REFRESH", "3;URL=katildigim-turlar.aspx");
}
catch (Exception hata)
{
labelMessage.Text = "Hata oluştu : " + hata.Message;
}
}
}