コード例 #1
0
ファイル: Datve.aspx.cs プロジェクト: minhtuancn/dangkyvexe
    private void LoadTuyenDiTuyenDen()
    {
        DropDownListTuyenDiTuyenDen.DataValueField = "MaTuyen";
        DropDownListTuyenDiTuyenDen.DataTextField  = "BenDiBenDen";
        DropDownListTuyenDiTuyenDen.DataSource     = TuyenDi.ListTuyenDi();
        DropDownListTuyenDiTuyenDen.DataBind();

        //
        DropDownListLoaiXe.DataValueField = "MaXe";
        DropDownListLoaiXe.DataTextField  = "KieuiXe";
        DropDownListLoaiXe.DataSource     = LoaiXe.LoaiXe_DropDownList();
        DropDownListLoaiXe.DataBind();

        //
        DropDownListThoiGian.DataValueField = "MaTG";
        DropDownListThoiGian.DataTextField  = "GioXuatBen";
        DropDownListThoiGian.DataSource     = ThoiGian.ThoiGian_DropDownList();
        DropDownListThoiGian.DataBind();


        //
        string stringId = Request.QueryString["Id"] ?? "";

        if (stringId != "")
        {
            //Lay ve xe theo ID
            VeXe data = VeXe.VeXe_Single(stringId);
            if (data == null)
            {
                Response.Redirect("~/Datve.aspx");
            }
            //Dua du lieu vao fomr de cap nhat
            lbMaVe.Text     = data.MaVe.ToString();
            txtHoVaTen.Text = data.HoTen;
            //string gt = "";
            if (data.GioiTinh == "Nam")
            {
                RadioButtonNam.Checked = true;
            }
            else
            {
                RadioButtonNu.Checked = true;
            }
            //gt = data.GioiTinh;
            txtTuoi.Text                              = data.Tuoi.ToString();
            txtDiaChi.Text                            = data.DiaChi;
            txtSoDT.Text                              = data.SoDT;
            txtNgayThangXuatBen.Text                  = data.NgayXuatBen.ToShortDateString();
            CheckBoxTrangThaiVeXe.Checked             = data.TrangThaiVeXe;
            DropDownListThoiGian.SelectedValue        = data.MaTG.ToString();
            DropDownListTuyenDiTuyenDen.SelectedValue = data.MaTuyen.ToString();
            DropDownListLoaiXe.SelectedValue          = data.MaXe.ToString();
            lbUsername.Text                           = data.MaTKKH;
        }
    }
コード例 #2
0
    private void LoadControl()
    {
        //
        DropDownListLoaiXe.DataValueField = "MaXe";
        DropDownListLoaiXe.DataTextField  = "KieuiXe";
        DropDownListLoaiXe.DataSource     = LoaiXe.LoaiXe_DropDownList();
        DropDownListLoaiXe.DataBind();

        //
        DropDownListThoiGian.DataValueField = "MaTG";
        DropDownListThoiGian.DataTextField  = "GioXuatBen";
        DropDownListThoiGian.DataSource     = ThoiGian.ThoiGian_DropDownList();
        DropDownListThoiGian.DataBind();

        //
        string stringID = Request.QueryString["Id"] ?? "";

        if (stringID != "")
        {
            TuyenDi data = TuyenDi.TuyenDi_Single(stringID);
            if (data == null)
            {
                Response.Redirect("~/Admin/TuyenDi.aspx");
            }
            lbMaTuyen.Text      = data.MaTuyen.ToString();
            txtBenDiBenDen.Text = data.BenDiBenDen;
            DropDownListThoiGian.SelectedValue = data.MaTG.ToString();
            DropDownListLoaiXe.SelectedValue   = data.MaXe.ToString();
            txtGiaVe.Text    = data.GiaVe.ToString();
            txtSoGheDat.Text = data.SoGheDat.ToString();
            txtPhuThu.Text   = data.PhuThu;
            btReset.Visible  = false;
        }
        else
        {
            btReset.Visible = true;
        }
    }