protected void Page_Load(object sender, EventArgs e) { double subTotal = 0.0; if (!Page.IsPostBack) { entCliente c = (entCliente)Session["infoCliente"]; if (c != null) { lblNombre.Text = c.Nombres; lblApellidos.Text = c.Apellidos; lblNroDocumento.Text = c.NroDocumento; lblNacionalidad.Text = c.Nacionalidad.Nombre; lblCorreo.Text = c.Correo; lblTelefono.Text = c.Telefono; DataTable dt = (DataTable)Session["reserva"]; for (int i = 0; i < dt.Rows.Count; i++) { DataRow r = dt.Rows[i]; subTotal += Convert.ToDouble(r["Precio"]) * Convert.ToInt32(r["NroNoches"]); } lblSubTotal.Text = subTotal.ToString(); lblTotal.Text = (((double)Convert.ToInt32(lblSubTotal.Text) * 0.18) + Convert.ToInt32(lblSubTotal.Text)).ToString(); entPago p = new entPago(); p.Total = Convert.ToDouble(lblTotal.Text); Session["Pago"] = p; gvHabReservadas.DataSource = dt; gvHabReservadas.DataBind(); } } }
public int RegistrarReserva(DataTable dtReserva, entCliente c, entPago p, char estado) { DataRow Cr = dtReserva.Rows[0]; try { String cadXML = "<root>"; cadXML += "<reserva "; cadXML += "IdPersona= '" + c.IdPersona + "' "; cadXML += "FechaEntrada= '" + Cr["FechaIngreso"] + "' "; cadXML += "FechaSalida= '" + Cr["FechaSalida"] + "' "; cadXML += "NroNoches= '" + Cr["NroNoches"] + "' "; cadXML += "MontoPagado= '" + p.Pagado + "' "; cadXML += "Saldo= '" + (p.Total - p.Pagado) + "' "; cadXML += "EstadoReserva= '" + estado + "' >"; foreach (DataRow r in dtReserva.Rows) { cadXML += "<detreserva "; cadXML += "IdHabitacion= '" + r["IdHabitacion"] + "' "; cadXML += "PrecioHabitacion= '" + r["Precio"] + "' />"; } cadXML += "</reserva></root>"; int i = datReserva.Instancia.RegistrarReserva(cadXML); return i; } catch (Exception e) { throw e; } }
protected void Page_Load(object sender, EventArgs e) { p = (entPago)Session["Pago"]; }