protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { CargaMarca(); if (Session["FLAG"].ToString() != "0") { btnGuardar.Enabled = true; } if (!(Request.QueryString["Cod"] == null)) { eVehiculo.ID_Vehiculo = Request.QueryString["Cod"].ToString(); DataTable dtVehiculo = new DataTable(); dtVehiculo = objVehiculo.ListarVehiculo(eVehiculo); DataRow dr = dtVehiculo.Rows[0]; tbCodigo.Text = dr["ID"].ToString(); tbPlaca.Text = dr["Placa"].ToString(); tbColor.Text = dr["Color"].ToString(); ddlMarca.SelectedValue = dr["Marca"].ToString(); tbKilometraje.Text = dr["Kilometraje"].ToString(); tbSerie.Text = dr["Nro_Serie"].ToString(); tbMotor.Text = dr["Nro_Motor"].ToString(); tbAnio.Text = dr["Anio"].ToString(); btnGuardar.Enabled = true; } } } catch (Exception ex) { throw new Exception("Error de carga de datos", ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { CargaTipoPersona(); if (!(Request.QueryString["Cod"] == null)) { eCliente.ID_Cliente = Request.QueryString["Cod"].ToString(); DataTable dtCliente = new DataTable(); dtCliente = objCliente.ListarCliente(eCliente); DataRow dr = dtCliente.Rows[0]; tbCodigo.Text = dr["ID"].ToString(); Session["IDContacto"] = dr["IDContacto"].ToString(); Session["IDVehiculo"] = dr["IDVehiculo"].ToString(); tbContacto.Text = dr["NombreContacto"].ToString(); tbVehiculo.Text = dr["NombreVehiculo"].ToString(); ddlTipo.SelectedValue = dr["Tipo"].ToString(); tbNombre.Text = dr["Nombre"].ToString(); tbRazonSocial.Text = dr["RazonSocial"].ToString(); tbDocumento.Text = dr["Documento"].ToString(); tbDireccion.Text = dr["Direccion"].ToString(); tbDistrito.Text = dr["Distrito"].ToString(); tbTelefono.Text = dr["Telefono"].ToString(); tbEmail.Text = dr["Email"].ToString(); tbPaginaWeb.Text = dr["PaginaWeb"].ToString(); btnDetalleVehiculo.Enabled = true; btnDetalleContacto.Enabled = true; } if (Session["Cliente_IDCliente"].ToString() != "") { eCliente.ID_Cliente = Session["Cliente_IDCliente"].ToString(); DataTable dtCliente = new DataTable(); dtCliente = objCliente.ListarCliente(eCliente); DataRow dr = dtCliente.Rows[0]; tbCodigo.Text = dr["ID"].ToString(); Session["IDContacto"] = dr["IDContacto"].ToString(); Session["IDVehiculo"] = dr["IDVehiculo"].ToString(); tbContacto.Text = dr["NombreContacto"].ToString(); tbVehiculo.Text = dr["NombreVehiculo"].ToString(); ddlTipo.SelectedValue = dr["Tipo"].ToString(); tbNombre.Text = dr["Nombre"].ToString(); tbRazonSocial.Text = dr["RazonSocial"].ToString(); tbDocumento.Text = dr["Documento"].ToString(); tbDireccion.Text = dr["Direccion"].ToString(); tbDistrito.Text = dr["Distrito"].ToString(); tbTelefono.Text = dr["Telefono"].ToString(); tbEmail.Text = dr["Email"].ToString(); tbPaginaWeb.Text = dr["PaginaWeb"].ToString(); btnDetalleVehiculo.Enabled = true; btnDetalleContacto.Enabled = true; } if (Session["Cliente_IDContacto"].ToString() != "0") { eContacto.ID_Contacto = Session["Cliente_IDContacto"].ToString(); DataTable dtContacto = new DataTable(); dtContacto = objContacto.ListarContacto(eContacto); DataRow dr = dtContacto.Rows[0]; eCliente.ID_Contacto = dr["ID"].ToString(); tbContacto.Text = dr["Nombre"].ToString(); } if (Session["Cliente_IDVehiculo"].ToString() != "0") { eVehiculo.ID_Vehiculo = Session["Cliente_IDVehiculo"].ToString(); DataTable dtVehiculo = new DataTable(); dtVehiculo = objVehiculo.ListarVehiculo(eVehiculo); DataRow dr = dtVehiculo.Rows[0]; eCliente.ID_Vehiculo = dr["ID"].ToString(); tbVehiculo.Text = dr["Placa"].ToString(); } if (tbContacto.Text != "" && tbVehiculo.Text != "") { ddlTipo.Enabled = true; tbNombre.Enabled = true; tbRazonSocial.Enabled = true; tbDocumento.Enabled = true; tbDireccion.Enabled = true; tbDistrito.Enabled = true; tbTelefono.Enabled = true; tbEmail.Enabled = true; tbPaginaWeb.Enabled = true; } } } catch (Exception ex) { throw new Exception("Error de carga de datos", ex); } }