protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BookingLink booking = db.BookingLinks.SingleOrDefault(b => b.BookingKey.ToString() == Request["key"]); if (booking == null) { Response.Redirect("Home.aspx"); } if (!booking.IsPaid) { lbl_amount.Text = string.Format("€{0:n2}", booking.Price); } else { Response.Redirect("Home.aspx"); } } }
protected void btn_pay_Click(object sender, EventArgs e) { if (Page.IsValid) { BookingLink booking = db.BookingLinks.SingleOrDefault(b => b.BookingKey.ToString() == Request["key"]); if (booking != null) { // make a payement booking.IsPaid = true; if (booking.DealID != null) { DealLink deal = db.DealLinks.SingleOrDefault(d => d.DealId == booking.DealID); if (deal != null) { if (deal.LimitedDealCounter != null) // is the teal limited? { deal.LimitedDealCounter--; ArturDelegate2 a = new ArturDelegate2(CommAgent.SendInfoNewDealsUsers); a += new ArturDelegate2(CommAgent.SendInfoNewDealsAdmin); if (deal.LimitedDealCounter <= 0 && deal.Discount == 10) { // 10 % discount deal is over -- send emails to users about 5 % deal deal.Discount = 5; deal.LimitedDealCounter = 50; a(deal.Discount, (int)deal.LimitedDealCounter); } else if (deal.LimitedDealCounter <= 0) { a(deal.Discount, (int)deal.LimitedDealCounter); } } } } db.SubmitChanges(); } } }
protected void btn_pay_Click(object sender, EventArgs e) { if (Page.IsValid) { DealLink deal = db.DealLinks.SingleOrDefault(d => d.DealKey.ToString() == Request["key"]); // if aspx login is used that line can help us to identify user //string userName = HttpContext.Current.User.Identity.Name; BookingLink bkg = new BookingLink() { // getting info from Fergal booking form ? StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(3), UserID = 1, CarID = 1, Price = CalcPrice(deal), DealID = deal == null ? (Nullable <int>)null : deal.DealId,// if function in object , asking is booking based on a deal BookingKey = Guid.NewGuid() }; db.BookingLinks.InsertOnSubmit(bkg); db.SubmitChanges(); // insert booking into db Response.Redirect("Payment.aspx?key=" + bkg.BookingKey.ToString()); // go to payments with booking key } }
protected void btn_pay_Click(object sender, EventArgs e) { if (Page.IsValid) { DealLink deal = db.DealLinks.SingleOrDefault(d => d.DealKey.ToString() == Request["key"]); // if aspx login is used that line can help us to identify user //string userName = HttpContext.Current.User.Identity.Name; BookingLink bkg = new BookingLink() { // getting info from Fergal booking form ? StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(3), UserID = 1, CarID = 1, Price = CalcPrice(deal), DealID = deal == null ? (Nullable<int>)null : deal.DealId,// if function in object , asking is booking based on a deal BookingKey = Guid.NewGuid() }; db.BookingLinks.InsertOnSubmit(bkg); db.SubmitChanges();// insert booking into db Response.Redirect("Payment.aspx?key=" + bkg.BookingKey.ToString()); // go to payments with booking key } }
private void detach_BookingLinks(BookingLink entity) { this.SendPropertyChanging(); entity.UserLink = null; }
partial void UpdateBookingLink(BookingLink instance);
partial void DeleteBookingLink(BookingLink instance);
partial void InsertBookingLink(BookingLink instance);
private void detach_BookingLinks(BookingLink entity) { this.SendPropertyChanging(); entity.UserLink = null; }
partial void DeleteBookingLink(BookingLink instance);
partial void UpdateBookingLink(BookingLink instance);
partial void InsertBookingLink(BookingLink instance);