public Persona Post(Persona persona)
        {
            int           id;
            GestorPersona gPersona = new GestorPersona();

            id         = gPersona.AgregarPersona(persona);
            persona.Id = id;
            return(persona);
        }
示例#2
0
        void AgregarPaciente()
        {
            string nombre = null, apellido = null, documento = null;

            if (TxtNombre.Text != "Nombre")
            {
                nombre = TxtNombre.Text.ToLower();
            }
            if (TxtDireccion.Text != "Apellido")
            {
                apellido = TxtApellido.Text.ToLower();
            }
            if (TxtDNI.Text != "Documento")
            {
                documento = TxtDNI.Text.ToLower();
            }

            string direccion = null, numero = null, piso = null, dpto = null;

            if (TxtDireccion.Text != "Dirección")
            {
                direccion = TxtDireccion.Text.ToLower();
            }
            if (TxtPiso.Text != "Piso")
            {
                piso = TxtPiso.Text.ToLower();
            }
            if (TxtDepto.Text != "Dpto")
            {
                dpto = TxtDepto.Text.ToLower();
            }
            if (TxtNumero.Text != "Nro.")
            {
                numero = TxtNumero.Text.ToLower();
            }

            //GestorDireccion gestorDireccion = new GestorDireccion();
            Nullable <int> idDireccion = GestorDireccion.AgregarDireccion(direccion, numero, piso, dpto, Convert.ToInt32(CmbCiudad.SelectedValue.ToString()));

            List <Nullable <int> > obrasChequeadas = new List <Nullable <int> >();

            foreach (ListaObraSocialDTO os in ChkLstObrasSociales.CheckedItems)
            {
                obrasChequeadas.Add(os.Id);
            }

            //GestorPersona gestorPersona = new GestorPersona();
            int idPersona = GestorPersona.AgregarPersona(documento, nombre, apellido, CmbSexo.SelectedValue.ToString(), idDireccion, null, null, obrasChequeadas);


            string telFijo = null, telCelular = null, email = null;

            if (TxtTelefono.Text != "Teléfono")
            {
                telFijo = TxtTelefono.Text.ToLower();
            }
            if (TxtCelular.Text != "Celular")
            {
                telCelular = TxtCelular.Text.ToLower();
            }
            if (TxtMail.Text != "E-Mail")
            {
                email = TxtMail.Text.ToLower();
            }

            //GestorDatosContacto gestorDatosContacto = new GestorDatosContacto();
            Nullable <int> idDC = GestorDatosContacto.AgregarDatosDeContacto(email, telCelular, telFijo, idPersona);

            if (idDC != 0)
            {
                MessageBox.Show("El paciente se ha guardado correctamente");
            }
        }