コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int         id    = int.Parse(Request.QueryString["id"].ToString());
        OrdersCheap order = new OrdersCheap();

        if (Request.QueryString["action"] != null)
        {
            int    status = int.Parse(Request.QueryString["status"].ToString());
            string action = Request.QueryString["action"].ToString();
            if (action == "update")
            {
                order.UpdateStatus(id, status, AppUtils.UserID().ToString());
                Response.StatusCode = 200;
                Response.Flush();
                return;
            }
        }
        List <OrdersCheap> lstOrder = new List <OrdersCheap>();

        if (Session["OrdersCheap"] != null)
        {
            lstOrder = (List <OrdersCheap>)Session["OrdersCheap"];
            order    = lstOrder.Where(o => o.OrderId == id).FirstOrDefault();
        }
        else
        {
            lstOrder = order.GetById(id);
            if (lstOrder.Count > 0)
            {
                order = lstOrder[0];
            }
        }
        if (Application["Config"] != null)
        {
            Libs.Content.Config con = (Libs.Content.Config)Application["Config"];
            AppUtils.LoadDropDownList(drpStatus, con.StatusCheapTicket);
        }
        drpStatus.SelectedValue = order.Status.ToString();
        if (order.Status == 2 || order.Status == 3)
        {
            drpStatus.Enabled = false;
        }
        fromname               = order.FromCity;
        toname                 = order.ToCity;
        lblStartDate.Text      = order.DepTime.ToString().Remove(5) + " " + order.StartDate.ToString("dd/MM/yyyy");
        lblEndDate.Text        = order.DicTime.ToString().Remove(5) + " " + order.EndDate.ToString("dd/MM/yyyy");
        lblTimeFly.Text        = AppUtils.CalTimeFly(order.StartDate.ToString("dd/MM/yyyy"), order.EndDate.ToString("dd/MM/yyyy"), order.DepTime.ToString(), order.DicTime.ToString());
        lblTotalPrice.Text     = AppUtils.ConvertPrice(order.Price.ToString());
        lblContactName.Text    = order.FirstName + " " + order.LastName;
        lblContactPhone.Text   = order.Phone;
        lblContactEmail.Text   = order.Email;
        lblContactAddress.Text = order.Address;
        if (order.Target == 0)
        {
            lblTarget.Text = "Người lớn";
        }
        else if (order.Target == 1)
        {
            lblTarget.Text = "Trẻ em";
        }
        else
        {
            lblTarget.Text = "Em bé";
        }
        lblQuantity.Text = order.Num.ToString();
        lblPrice.Text    = AppUtils.ConvertPrice(order.AdultPriceNet.ToString());
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int           id     = int.Parse(Request.QueryString["id"].ToString());
        int           status = int.Parse(Request.QueryString["status"].ToString());
        List <Orders> lstOrder;

        if (Request.QueryString["ishis"] != null && Request.QueryString["ishis"].ToString() == "1")
        {
            lstOrder = new Orders().GetHistoryById(id);
        }
        else
        {
            lstOrder = new Orders().GetById(id);
        }
        if (Request.QueryString["action"] != null)
        {
            string action = Request.QueryString["action"].ToString();
            if (action == "update")
            {
                Orders order = new Orders();
                order.UpdateStatus(lstOrder, status);
                Response.StatusCode = 200;
                Response.Flush();
                return;
            }
        }

        string air = Request.QueryString["air"].ToString();

        if (lstOrder != null && lstOrder.Count > 0)
        {
            RoundTrip = lstOrder.Count;
            List <Address> lstadd = new List <Address>();
            Address        add    = new Address();
            fromcity = lstOrder[0].FromCity;
            lstadd   = add.GetName(fromcity);
            if (lstadd != null && lstadd.Count > 0)
            {
                fromname = lstadd[0].name;
            }
            tocity = lstOrder[0].ToCity;
            lstadd = add.GetName(tocity);
            if (lstadd != null && lstadd.Count > 0)
            {
                toname = lstadd[0].name;
            }
            //Hiển thị thời gian bay
            lblStartDate.Text = lstOrder[0].DepTime.ToString().Substring(0, lstOrder[0].DepTime.ToString().LastIndexOf(":")) + " " + lstOrder[0].StartDate.ToString("dd/MM/yyyy");
            lblEndDate.Text   = lstOrder[0].DicTime.ToString().Substring(0, lstOrder[0].DicTime.ToString().LastIndexOf(":")) + " " + lstOrder[0].EndDate.ToString("dd/MM/yyyy");
            lblTimeFly.Text   = AppUtils.CalTimeFly(lstOrder[0].StartDate.ToString("dd/MM/yyyy"), lstOrder[0].EndDate.ToString("dd/MM/yyyy"), lstOrder[0].DepTime.ToString(), lstOrder[0].DicTime.ToString());
            List <Info> lstInfo = CreateOrdersInfo(lstOrder[0].Adult, lstOrder[0].Child, lstOrder[0].Infant, lstOrder[0]);
            rptOrders.DataSource = lstInfo;
            rptOrders.DataBind();
            if (lstOrder.Count == 2)
            {
                pnReturn.Visible        = true;
                lblReturnStartDate.Text = lstOrder[1].DepTime.ToString().Substring(0, lstOrder[1].DepTime.ToString().LastIndexOf(":")) + " " + lstOrder[1].StartDate.ToString("dd/MM/yyyy");
                lblReturnEndDate.Text   = lstOrder[1].DicTime.ToString().Substring(0, lstOrder[1].DicTime.ToString().LastIndexOf(":")) + " " + lstOrder[1].EndDate.ToString("dd/MM/yyyy");
                lblReturnTimeFly.Text   = AppUtils.CalTimeFly(lstOrder[1].StartDate.ToString("dd/MM/yyyy"), lstOrder[1].EndDate.ToString("dd/MM/yyyy"), lstOrder[1].DepTime.ToString(), lstOrder[1].DicTime.ToString());
                lstInfo = new List <Info>();
                lstInfo = CreateOrdersInfo(lstOrder[1].Adult, lstOrder[1].Child, lstOrder[1].Infant, lstOrder[1]);
                rptReturnOrders.DataSource = lstInfo;
                rptReturnOrders.DataBind();
            }
            lblTotalTax.Text       = AppUtils.ConvertPrice(lstOrder[0].TaxFee.ToString());
            lblTotalPrice.Text     = AppUtils.ConvertPrice(lstOrder[0].Price.ToString());
            lblContactName.Text    = lstOrder[0].FirstName + " " + lstOrder[0].LastName;
            lblContactPhone.Text   = lstOrder[0].Phone;
            lblContactEmail.Text   = lstOrder[0].Email;
            lblContactAddress.Text = lstOrder[0].Address;
            if (lstOrder[0].Status == 2 || lstOrder[0].Status == 3)
            {
                drpStatus.Enabled = false;
            }
            drpStatus.SelectedValue = lstOrder[0].Status.ToString();
        }
    }