private void sendReceipt(Order order, List <Order_Artwork> oaList, string emailAddress) { string subject = "Thank you for your purchase!"; string body = "<h1>Your order has been successfully confirmed</h1>" + "\n<h2>Order ID: " + order.OrderId + "</h2>" + "\n<h2>Order Date: " + order.OrderDate + "</h2>" + "\n<h3>Delivering to: " + order.DeliveryAddress + "</h2>" + "\n<hr/>" + "\n<h4>Order Items</h5>"; foreach (Order_Artwork oa in oaList) { // Get artpiece name ArtpieceDao artpieceDao = new ArtpieceDao(); Classes.Artpiece artpiece = artpieceDao.Get("ARTPIECEID", oa.ArtpieceId); // Get artist name ArtistDao artistDao = new ArtistDao(); Classes.Artist artist = artistDao.Get("ARTISTID", artpiece.ArtistId); body += "<b>" + artpiece.Title + "</b> by <i>" + artist.DisplayName + "</i> ( x" + oa.Quantity + " )<br/>"; } // Display total body += "\n<h4>Total: RM" + Quick.FormatPrice(order.TotalPrice) + "</h4>"; // Send email Email.SendEmail(emailAddress, subject, body); }
protected void Page_Load(object sender, EventArgs e) { // Initialize FormatLbl = new FormatLabel(lblEditError); artpiece = new Classes.Artpiece(); // To ensure that a valid username is entered string artpieceId = ""; try { artpieceId = Request.QueryString["id"].ToString(); } catch (Exception ex) { //Show error msg } // Get from DB ArtpieceDao dao = new ArtpieceDao(); artpiece = dao.Get("ARTPIECEID", artpieceId); // Validate artpiece ID if (artpiece == null) { Net.Redirect("Artpiece.aspx?id=UNKNOWN"); } else { // Get Artist info ArtistDao artistDao = new ArtistDao(); artist = artistDao.Get("ARTISTID", artpiece.ArtistId); // Will be null if currently logged in user is not an artist Artist currentArtist = (Artist)Session["Artist"]; // Redirect if not original artist if (currentArtist == null || artpiece.ArtistId != currentArtist.Id) { Net.Redirect("Artpiece.aspx?id=" + artpiece.ArtpieceId); } else { // Show private artpiece to the original artist if (!artpiece.IsPublic && currentArtist.Id == artist.Id) { if (!IsPostBack) { //Display artpiece details lblArtist.Text = artist.DisplayName; lblDescription.Text = artpiece.About; lblTitle.Text = artpiece.Title + "(PRIVATE ARTPIECE)"; txtStocks.Text = artpiece.Stocks + ""; artpieceImg.ImageUrl = artpiece.ImageLink; lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price); if (!artpiece.IsForSale) { lblForSale.Text = "NOT FOR SALE"; lblForSale.CssClass = "notforsale"; } } } else // Show public artpiece { if (!IsPostBack) { //Display artpiece details lblArtist.Text = artist.DisplayName; lblDescription.Text = artpiece.About; lblTitle.Text = artpiece.Title; txtStocks.Text = artpiece.Stocks + ""; lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price); artpieceImg.ImageUrl = artpiece.ImageLink; if (!artpiece.IsForSale) { lblForSale.Text = "NOT FOR SALE"; lblForSale.CssClass = "notforsale"; } } } } } }
protected void Page_Load(object sender, EventArgs e) { artpiece = new Classes.Artpiece(); // Hide edit button first btnEdit.Visible = false; //Hide buttons first btnAddToWishlist.Visible = false; btnAddToCart.Visible = false; btnViewArtist.Visible = false; // To ensure that a valid username is entered string artpieceId = ""; try { artpieceId = Request.QueryString["id"].ToString(); } catch (Exception ex) { //Show error msg } // Get from DB ArtpieceDao dao = new ArtpieceDao(); artpiece = dao.Get("ARTPIECEID", artpieceId); // Validate artpiece ID if (artpiece == null) { lblTitle.Text = "Artpiece does not exist"; } else { // Get Artist info ArtistDao artistDao = new ArtistDao(); artist = artistDao.Get("ARTISTID", artpiece.ArtistId); // Will be null if currently logged in user is not an artist Artist currentArtist = (Artist)Session["Artist"]; // Block private artpiece from customer if (!artpiece.IsPublic && currentArtist == null) { lblTitle.Text = "Artpiece is private"; } else { // Block private artpiece from other artists if (!artpiece.IsPublic && currentArtist.Id != artist.Id) { lblTitle.Text = "Artpiece is private"; } // Show private artpiece to the original artist else if (!artpiece.IsPublic && currentArtist.Id == artist.Id) { //Display artpiece details lblArtist.Text = artist.DisplayName; lblDescription.Text = artpiece.About; lblTitle.Text = artpiece.Title + "(PRIVATE ARTPIECE)"; lblStocks.Text = artpiece.Stocks + ""; artpieceImg.ImageUrl = artpiece.ImageLink; lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price); if (!artpiece.IsForSale) { lblForSale.Text = "NOT FOR SALE"; lblForSale.CssClass = "notforsale"; } } else // Show public artpiece { LoadBt(); // Make buttons visible btnViewArtist.Visible = true; //Display artpiece details lblArtist.Text = artist.DisplayName; lblDescription.Text = artpiece.About; lblTitle.Text = artpiece.Title; lblStocks.Text = artpiece.Stocks + ""; lblArtpiecePrice.Text = Quick.FormatPrice(artpiece.Price); artpieceImg.ImageUrl = artpiece.ImageLink; if (!artpiece.IsForSale) { lblForSale.Text = "NOT FOR SALE"; lblForSale.CssClass = "notforsale"; } } // Show edit button if this is the original artist if (currentArtist != null && currentArtist.Id == artist.Id) { btnEdit.Visible = true; } } } }