Пример #1
0
    // VISITAR
    protected void btVisitar_Click(object sender, EventArgs e)
    {
        try
        {
            CargarControl();

            if (txtNombre.Text == "" || txtTelefono.Text == "")
            {
                throw new Exception("Debe ingresar nombre y telefono..");
            }

            DateTime fechaAgenda = DateTime.Parse(Convert.ToString(CalVisita.SelectedDate.Year) + "-" + Convert.ToString(CalVisita.SelectedDate.Month) + "-" + Convert.ToString(CalVisita.SelectedDate.Day) + " " + ddlHora.SelectedValue + ":" + ddlMinuto.SelectedValue + ":" + "00");

            Visita visita = new Visita(fechaAgenda, Convert.ToInt32(txtTelefono.Text), txtNombre.Text, (Propiedad)Session["Ver"]);

            ILogicaVisita LVisita = FabricaLogica.getLogicaVisita();
            LVisita.Agregar(visita);

            lbResultado.Text = "Se ha creado visita satisfactoriamente";
        }
        catch (Exception ex)
        {
            lbResultado.Text = "ERROR:" + ex.Message;
        }
    }