protected void Page_Load(object sender, EventArgs e) { if (Session["TaiKhoan"] != null) { } else { Response.Redirect("../../index.aspx"); } if (!IsPostBack) { dsOrderPhong dsOrderPhong = (dsOrderPhong)Session["datphong"]; txtMaDatPhong.Text = dsOrderPhong.MaDatPhong.ToString(); txtHoTen.Text = dsOrderPhong.HoTen; txtSDT.Text = dsOrderPhong.SDT; txtTimeIn.Text = dsOrderPhong.thoigianvao.ToString(); txtTimeOut.Text = dsOrderPhong.thoigianra.ToString(); DDL_MaPhong.DataSource = data.getAllPhong(); DDL_MaPhong.DataValueField = "MaPhong"; DDL_MaPhong.DataTextField = "TenPhong"; DataBind(); DDL_MaPhong.SelectedValue = dsOrderPhong.MaPhong.ToString(); txtPhongCu.Text = dsOrderPhong.MaPhong.ToString(); } }
protected void Sua_Click(object sender, CommandEventArgs e) { if (e.CommandName == "sua") { int MaDatPhong = Convert.ToInt16(e.CommandArgument); dsOrderPhong dsOrder = data.get1Schedule(MaDatPhong); Session["datphong"] = dsOrder; Response.Redirect("DatPhongEdit.aspx"); } }
protected void btnSuaDatPhong_Click(object sender, EventArgs e) { dsOrderPhong dsOrderPhong = new dsOrderPhong(); dsOrderPhong.MaDatPhong = int.Parse(txtMaDatPhong.Text); dsOrderPhong.HoTen = txtHoTen.Text; dsOrderPhong.SDT = txtSDT.Text; dsOrderPhong.thoigianvao = DateTime.Parse(txtTimeIn.Text); dsOrderPhong.thoigianra = DateTime.Parse(txtTimeOut.Text); dsOrderPhong.MaPhong = int.Parse(DDL_MaPhong.Text); data.updateSchedule(dsOrderPhong); // Cập nhật room_status phòng vừa đặt là 1 (Đã dùng) data.phongdaSuDung(dsOrderPhong.MaDatPhong); err_msg.ForeColor = System.Drawing.Color.Green; err_msg.Text = "Cập nhật đặt phòng thành công!"; }