protected void Page_Load(object sender, EventArgs e) { if (Session["Order"] != null) { Order order = (Order)Session["Order"]; if (order.ShippingAddress != null) { lbFullName.Text = ToSQL.EmptyNull(order.ShippingAddress.Name); lbEmail.Text = ToSQL.EmptyNull(order.ShippingAddress.Email); lbPhone.Text = ToSQL.EmptyNull(order.ShippingAddress.Phone); lbShippingAddress.Text = new AddressRepo().GetToString(order.ShippingAddress.Address); } lbOrderID.Text = ToSQL.EmptyNull(order.ID); lbDateCreated.Text = ToSQL.EmptyNull(order.DateCreated.ToShortDateString()); Model.Payment payment = new PaymentRepo().GetById(order.Payment_ID); lbPaymentType.Text = ToSQL.EmptyNull(payment.Name); } if (Session["Subtotal"] != null) { lbTotalPrice.Text = ToSQL.EmptyNull(Session["Subtotal"]); } }
protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs e) { Order order = (Order)e.Row.DataItem; if (order != null) { OrderStatu orderStatus = new OrderStatusRepo().GetById(ToSQL.SQLToInt(order.OrderStatus_ID)); if (orderStatus != null) { e.Row.Cells[2].Text = orderStatus.Name;//order stat } Customer customer = new CustomerRepo().GetById(ToSQL.SQLToInt(order.Customer_ID)); if (customer != null) { e.Row.Cells[3].Text = customer.FirstName;//customer nam } Model.Payment payment = new PaymentRepo().GetById(ToSQL.SQLToInt(order.Payment_ID)); if (payment != null) { e.Row.Cells[4].Text = payment.Name;//payment method } ShippingAddress shippingAddress = new ShippingAddressRepo().GetById(ToSQL.SQLToInt(order.ShippingAddress_ID)); if (shippingAddress != null) { e.Row.Cells[5].Text = shippingAddress.Name;//Recipient's Name e.Row.Cells[6].Text = shippingAddress.Phone; string strAddress = new AddressRepo().GetToString(shippingAddress.Address); e.Row.Cells[7].Text = new AddressRepo().ShortString(strAddress); e.Row.Cells[7].ToolTip = strAddress; } } }