Exemplo n.º 1
0
        // METODO PARA INSERTAR UN NUEVO INTERNADO
        public bool InsertInternado(Internado objInternado)
        {
            SqlConnection connection = null;
            SqlCommand    command    = null;
            bool          response   = false;

            try
            {
                connection          = Connection.GetInstance().ConnectionDB();
                command             = new SqlCommand("SP_INSERTINTERNADO", connection);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@paciente", objInternado.Paciente.IdPacient);
                command.Parameters.AddWithValue("@servicio", objInternado.Servicio.IdService);
                command.Parameters.AddWithValue("@fechaIngreso", objInternado.FechaIngreso);
                //command.Parameters.AddWithValue("@fechaSalida", objInternado.FechaSalida);

                connection.Open();
                int rows = command.ExecuteNonQuery();

                if (rows > 0)
                {
                    response = true;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                connection.Close();
            }
            return(response);
        }
Exemplo n.º 2
0
 public bool InsertInternado(Internado objInternado)
 {
     try
     {
         return(InternadoConnection.GetInstance().InsertInternado(objInternado));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 3
0
 public bool InsertInternado(Internado objInternado)
 {
     try
     {
         InternadoBL internadoBL = new InternadoBL();
         return(internadoBL.InsertInternado(objInternado));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 4
0
        public Internado GetValues()
        {
            Internado objInternado = new Internado();

            objInternado.Paciente = new Pacient();
            objInternado.Servicio = new Service();

            objInternado.IdInternamiento    = 0;
            objInternado.Paciente.IdPacient = DBHelper.ReadNullSafeInt(this.paciente.SelectedValue);
            objInternado.Servicio.IdService = DBHelper.ReadNullSafeInt(this.servicio.SelectedValue);
            objInternado.FechaIngreso       = Convert.ToDateTime(fechaIngreso.Text);
            //objInternado.FechaSalida = Convert.ToDateTime(fechaSalida.Text);
            return(objInternado);
        }
Exemplo n.º 5
0
        // METODO PARA LISTAR LAS PERSONAS INTERNADAS
        public List <Internado> ListInternados()
        {
            List <Internado> list       = new List <Internado>();
            SqlConnection    connection = null;
            SqlCommand       command    = null;
            SqlDataReader    reader     = null;

            //INSTANCIAS
            Pacient paciente;
            Service servicio;

            try
            {
                connection          = Connection.GetInstance().ConnectionDB();
                command             = new SqlCommand("SP_LISTINTERNADO", connection);
                command.CommandType = CommandType.StoredProcedure;
                connection.Open();
                reader = command.ExecuteReader();

                while (reader.Read())
                {
                    paciente = new Pacient();
                    servicio = new Service();

                    Internado objInternado = new Internado();
                    objInternado.Paciente = new Pacient();
                    objInternado.Servicio = new Service();

                    objInternado.IdInternamiento    = DBHelper.ReadNullSafeInt(reader["idInternamiento"]);
                    objInternado.Paciente.IdPacient = DBHelper.ReadNullSafeInt(reader["paciente"]);
                    objInternado.Servicio.IdService = DBHelper.ReadNullSafeInt(reader["servicio"]);
                    objInternado.FechaIngreso       = DBHelper.ReadNullSafeDateTime(reader["fecha_ingreso"]);
                    objInternado.FechaSalida        = DBHelper.ReadNullSafeDateTime(reader["fecha_salida"]);

                    // AGREGAR A LA LISTA
                    list.Add(objInternado);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                connection.Close();
            }
            return(list);
        }
Exemplo n.º 6
0
        //public void CargarDoctores(Doctor objDoctor)
        //{
        //    List<Doctor> listDoctores = new List<Doctor>();
        //    WSDoctor wsdoctor = new WSDoctor();
        //    listDoctores = wsdoctor.ListDoctorPorServicio(objDoctor);
        //    this.doctor.DataSource = listDoctores;
        //    this.doctor.DataValueField = "idDoctor";
        //    this.doctor.DataTextField = "name";
        //    this.doctor.DataBind();
        //    this.doctor.Items.Insert(0, new ListItem("-- SELECCIONE EL DOCTOR --"));
        //}

        protected void BtnInsert_Click(object sender, EventArgs e)
        {
            // REGISTRANDO INTERNADO
            Internado objInternado = GetValues();
            // ACCEDIENDO AL WEB SERVICE
            WSInternado wsinternado = new WSInternado();
            bool        response    = wsinternado.InsertInternado(objInternado);

            if (response)
            {
                this.divSuccess.Visible = true;
                this.TextSuccess.Text   = "¡Internamiento realizado con éxito!";
                this.paciente.Items.Clear();
                this.servicio.Items.Clear();
                this.fechaIngreso.Text = string.Empty;
                CargarServicios();
                CargarPacientes();
            }
            else
            {
                this.divError.Visible = true;
                this.TextError.Text   = "¡El internamiento no fue realizado!";
            }
        }