Beispiel #1
0
 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;
     }
 }
Beispiel #2
0
        protected void btnRegistrarse_Click(object sender, EventArgs e)
        {
            if (txtNombres.Text.Trim() == "" || txtNombres.Text.Length < 3) { txtNombres.Focus(); return; }
            if (txtApellidos.Text.Trim() == "" || txtApellidos.Text.Length < 4) { txtApellidos.Focus(); return; }
            if (txtCorreo.Text.Trim() == "" || txtCorreo.Text.Length <= 8) { txtCorreo.Focus(); return; }
            entCliente c = new entCliente();
            entNacionalidad objNacionalidad = new entNacionalidad();
            bool retorno, band=false;
            try
            {
                c.Nombres = txtNombres.Text;
                c.Apellidos = txtApellidos.Text;
                c.Sexo = Convert.ToChar(ddlSexo.SelectedValue[0]);
                c.Direccion = txtDireccion.Text;
                c.Telefono = txtTelefono.Text;
                c.Correo = txtCorreo.Text;
                c.NroDocumento = txtNroDocumento.Text;
                objNacionalidad = negNacionalidad.Instancia.BuscarNacionalidadxNombre(ddlNacionalidad.SelectedValue);
                c.Nacionalidad = objNacionalidad;
                c.TipoCliente = ddlTipoCliente.SelectedValue;
                c.RUC = txtRUC.Text;
                c.RazonSocial = txtRazonSocial.Text;
                c.Password = txtPassword.Text;

                retorno = negCliente.Instancia.RegistrarCliente(c);

                if (retorno)
                {
                    Response.Write("<script>alert('Registrado con exito')</script>");
                    band = true;
                }
                else
                {
                    Response.Write("<script>alert('No se pudo registrar con exito')</script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('" + ex + "')</script>");

            }
            LimpiarControles();
            if (band)
            {
                Response.Redirect("login.aspx");
            }
        }
Beispiel #3
0
 public entCliente BuscarXNroDocumento(String NroDocumento)
 {
     entCliente c = null;
     SqlCommand cmd = null;
     SqlDataReader dr = null;
     try
     {
         SqlConnection conex = Conexion.Instancia.Conectar();
         cmd = new SqlCommand("Buscar_X_NroDocumento", conex);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@NroDocumento", NroDocumento);
         conex.Open();
         dr = cmd.ExecuteReader();
         if (dr.Read())
         {
             c = new entCliente();
             c.IdPersona = Convert.ToInt32(dr["IDPERSONA"]);
             c.Nombres = dr["NOMBRES"].ToString();
             c.Apellidos = dr["APELLIDOS"].ToString();
             c.Sexo = Convert.ToChar(dr["SEXO"]);
             c.Direccion = dr["DIRECCION"].ToString();
             c.Telefono = dr["TELEFONO"].ToString();
             c.Correo = dr["CORREO"].ToString();
             c.NroDocumento = dr["NRODOCUMENTO"].ToString();
             c.TipoCliente = dr["TIPOCLIENTE"].ToString();
             entNacionalidad n = new entNacionalidad();
             n.IdNacionalidad = Convert.ToInt32(dr["IDNACIONALIDAD"]);
             n.Nombre = dr["NOMBRE"].ToString();
             c.Nacionalidad = n;
         }
     }
     catch (Exception e)
     {
         c = null;
         throw e;
     }
     finally
     {
         cmd.Connection.Close();
     }
     return c;
 }
Beispiel #4
0
        public bool RegistrarCliente(entCliente c)
        {
            SqlCommand cmd = null;
            bool retorno = false;
            try
            {
                SqlConnection conex = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("spRegistrarCliente", conex);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@prmNombres", c.Nombres);
                cmd.Parameters.AddWithValue("@prmApellidos", c.Apellidos);
                cmd.Parameters.AddWithValue("@prmSexo", c.Sexo);
                cmd.Parameters.AddWithValue("@prmDireccion", c.Direccion);
                cmd.Parameters.AddWithValue("@prmTelefono", c.Telefono);
                cmd.Parameters.AddWithValue("@prmCorreo", c.Correo);
                cmd.Parameters.AddWithValue("@prmNroDocumento", c.NroDocumento);
                cmd.Parameters.AddWithValue("@prmIdNacionalidad", c.Nacionalidad.IdNacionalidad);
                cmd.Parameters.AddWithValue("@prmTipoCliente", c.TipoCliente);
                cmd.Parameters.AddWithValue("@prmRUC", c.RUC);
                cmd.Parameters.AddWithValue("@prmRazonSocial", c.RazonSocial);
                cmd.Parameters.AddWithValue("@prmPassword", c.Password);

                conex.Open();

                int filas = cmd.ExecuteNonQuery();
                if (filas > 0)
                {
                    retorno = true;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return retorno;
        }
Beispiel #5
0
 public bool RegistrarCliente(entCliente c)
 {
     return datCliente.Instancia.RegistrarCliente(c);
 }