Beispiel #1
0
        public void PostPedidoxMedicamento([FromBody] PedidoxMedicamento pedidoxMedicamento)
        {
            System.Data.SqlClient.SqlConnection conn;
            SqlCommand command;

            conn = new SqlConnection("Data Source=(local);Initial Catalog=Proyecto1;Integrated Security=True");
            conn.Open();

            SqlParameter IdPedido = new SqlParameter("@IdPedido", System.Data.SqlDbType.Int);

            IdPedido.Value = pedidoxMedicamento.IdPedido;

            SqlParameter IdMedicamento = new SqlParameter("@IdMedicamento", System.Data.SqlDbType.Int);

            IdMedicamento.Value = pedidoxMedicamento.IdMedicamento;

            SqlParameter Cantidad = new SqlParameter("@Cantidad", System.Data.SqlDbType.Int);

            Cantidad.Value = pedidoxMedicamento.Cantidad;



            command = new SqlCommand("insert into PedidoxMedicamento(IdPedido,IdMedicamento,Cantidad) VALUES (@IdPedido,@IdMedicamento,@Cantidad)", conn);
            command.Parameters.Add(IdPedido);
            command.Parameters.Add(IdMedicamento);
            command.Parameters.Add(Cantidad);
            //command.Parameters.Add(RecetaImg);
            command.ExecuteNonQuery();

            conn.Close();
        }
Beispiel #2
0
        public List <PedidoxMedicamento> GetAllPedidosxMedicamentos()
        {
            System.Data.SqlClient.SqlConnection conn;
            SqlCommand    command;
            SqlDataReader read;

            conn = new SqlConnection("Data Source=(local);Initial Catalog=Proyecto1;Integrated Security=True");
            conn.Open();
            command = new SqlCommand("SELECT *  from PedidoxMedicamento where LogicDelete = 0", conn);
            read    = command.ExecuteReader();

            List <PedidoxMedicamento> ListPedidosxMedicamento = new List <PedidoxMedicamento>();

            while (read.Read())
            {
                PedidoxMedicamento pedidoxMedicamento = new PedidoxMedicamento();
                pedidoxMedicamento.IdMedicamento = Convert.ToInt32(read["IdMedicamento"]);
                pedidoxMedicamento.IdPedido      = Convert.ToInt32(read["IdPedido"]);
                pedidoxMedicamento.Cantidad      = Convert.ToInt32(read["Cantidad"]);
                pedidoxMedicamento.LogicDelete   = Convert.ToBoolean(read["LogicDelete"]);

                ListPedidosxMedicamento.Add(pedidoxMedicamento);
            }
            read.Close();
            conn.Close();
            return(ListPedidosxMedicamento);
        }
Beispiel #3
0
        public void UpdatePedidoxMedicamento([FromBody] PedidoxMedicamento pedidoxMedicamento)
        {
            System.Data.SqlClient.SqlConnection conn;
            SqlCommand command;

            conn = new SqlConnection("Data Source=(local);Initial Catalog=Proyecto1;Integrated Security=True");
            conn.Open();

            SqlParameter IdPedido = new SqlParameter("@IdPedido", System.Data.SqlDbType.Int);

            IdPedido.Value = pedidoxMedicamento.IdPedido;

            SqlParameter IdMedicamento = new SqlParameter("@IdMedicamento", System.Data.SqlDbType.Int);

            IdMedicamento.Value = pedidoxMedicamento.IdMedicamento;

            SqlParameter Cantidad = new SqlParameter("@Cantidad", System.Data.SqlDbType.Int);

            Cantidad.Value = pedidoxMedicamento.Cantidad;

            command = new SqlCommand("update PedidoxMedicamento set Cantidad = @Cantidad where IdPedido=@IdPedido and IdMedicamento=@IdMedicamento", conn);
            command.Parameters.Add(IdPedido);
            command.Parameters.Add(IdMedicamento);
            command.Parameters.Add(Cantidad);

            command.ExecuteNonQuery();

            conn.Close();
        }
Beispiel #4
0
        public void UpdatePedidoxMedicamento([FromBody] PedidoxMedicamento pedidoxMedicamento)
        {
            PedidoxMedicamentoService con = new PedidoxMedicamentoService();

            con.UpdatePedidoxMedicamento(pedidoxMedicamento);
        }
Beispiel #5
0
        public void PostMedicamento([FromBody] PedidoxMedicamento pedidoxMedicamento)
        {
            PedidoxMedicamentoService con = new PedidoxMedicamentoService();

            con.PostPedidoxMedicamento(pedidoxMedicamento);
        }
        public void UpdateMedicamentoxReceta([FromBody] PedidoxMedicamento cFar)
        {
            MedicamentoxRecetaService con = new MedicamentoxRecetaService();

            con.UpdateMedicamentoxReceta(cFar);
        }