Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hideNavButton();
            string RoleId;

            if (Session["RoleId"] == null)
            {
                RoleId = "-1";
            }
            else
            {
                RoleId = Session["RoleId"].ToString();
            }

            int UserId;

            if (Session["UserId"] == null)
            {
                UserId = -1;
            }
            else
            {
                UserId = int.Parse(Session["UserId"].ToString());
            }

            int ShowId = int.Parse(Request.QueryString["ShowId"]);

            showButton(RoleId, ShowId, UserId);
            Models.ShowDetail show = ShowController.GetShowDetailById(ShowId);

            if (show != null)
            {
                lblNameContent.Text          = show.Show_Name;
                lblPriceContent.Text         = String.Format(CultureInfo.CreateSpecificCulture("id-id"), "Rp. {0:N}", show.Show_Price);
                lblSellerContent.Text        = show.Seller_Name;
                lblDescriptionContent.Text   = show.Description;
                lblAverageRatingContent.Text = (show.Average_Rating).ToString();

                FillGrid(ShowId);
            }
        }
Пример #2
0
        protected void BindData()
        {
            int        ShowId = int.Parse(Request.QueryString["ShowId"]);
            ShowDetail show   = ShowController.GetShowDetailById(ShowId);
            Button     button;

            if (show != null)
            {
                lblDescriptionValue.Text = show.Description;
                lblRatingValue.Text      = show.Average_Rating.ToString();
                lblPriceValue.Text       = show.Show_Price.ToString();
                lblShowNameValue.Text    = show.Show_Name;
                lblSellerNameValue.Text  = show.Seller_Name;
            }

            showAdditionalNavbar();

            string orderDate = txtOrderDate.Text;

            if (orderDate == "")
            {
                orderDate = DateTime.Now.Date.ToString();
            }

            DataTable dt = new DataTable();

            dt.Columns.AddRange(new DataColumn[2] {
                new DataColumn("Id"), new DataColumn("Time")
            });
            dt.Rows.Add(1, "00:00 - 00:59");
            dt.Rows.Add(2, "01:00 - 01:59");
            dt.Rows.Add(3, "02:00 - 02:59");
            dt.Rows.Add(4, "03:00 - 03:59");
            dt.Rows.Add(5, "04:00 - 04:59");
            dt.Rows.Add(6, "05:00 - 05:59");
            dt.Rows.Add(7, "06:00 - 06:59");
            dt.Rows.Add(8, "07:00 - 07:59");
            dt.Rows.Add(9, "08:00 - 08:59");
            dt.Rows.Add(10, "09:00 - 09:59");
            dt.Rows.Add(11, "10:00 - 10:59");
            dt.Rows.Add(12, "11:00 - 11:59");
            dt.Rows.Add(13, "12:00 - 12:59");
            dt.Rows.Add(14, "13:00 - 13:59");
            dt.Rows.Add(15, "14:00 - 14:59");
            dt.Rows.Add(16, "15:00 - 15:59");
            dt.Rows.Add(17, "16:00 - 16:59");
            dt.Rows.Add(18, "17:00 - 17:59");
            dt.Rows.Add(19, "18:00 - 18:59");
            dt.Rows.Add(20, "19:00 - 19:59");
            dt.Rows.Add(21, "20:00 - 20:59");
            dt.Rows.Add(22, "21:00 - 21:59");
            dt.Rows.Add(23, "22:00 - 22:59");
            dt.Rows.Add(24, "23:00 - 23:59");

            gvOrder.DataSource = dt;
            gvOrder.DataBind();


            DateTime targetTime = Convert.ToDateTime(orderDate);
            TimeSpan timeDiff   = currentTime - targetTime;

            int n = Convert.ToInt32(timeDiff.TotalHours);

            if (n < 0)
            {
                n = -1;
            }
            else if (n > 23)
            {
                n = 23;
            }

            for (int i = 0; i <= n; i++)
            {
                button         = this.gvOrder.Rows[i].FindControl("btnOrderShow") as Button;
                button.Visible = false;

                Label label = this.gvOrder.Rows[i].FindControl("lblUnavailable") as Label;
                label.Text = "Unavailable";
            }

            List <int> alreadyOrderedAt = isAlreadyOrder(orderDate);

            foreach (int index in alreadyOrderedAt)
            {
                button         = this.gvOrder.Rows[index].FindControl("btnOrderShow") as Button;
                button.Visible = false;

                Label label = this.gvOrder.Rows[index].FindControl("lblUnavailable") as Label;
                label.Text = "Unavailable";
            }
        }