private PedidoDetail Converter(PedidoEntity e)
        {
            var          service = new PedidoItemService(new ContextMercadOn());
            PedidoDetail d       = new PedidoDetail();

            d.Cliente    = e.ClienteEntity.nome;
            d.dataPedido = e.dataPedido.ToShortDateString();
            d.Mercado    = e.MercadoEntity.nome;
            d.total     += service.ConsultarPorFiltro(x => x.idPedido == e.idPedido).Sum(x => x.precoItem);
            d.pedidoid   = e.idPedido;
            return(d);
        }
Beispiel #2
0
    public static PedidosDetails getPedidosByID(int _id, int _tipo_id)
    {
        PedidosDetails pds = new PedidosDetails();

        using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlConn"].ToString()))
        {
            SqlCommand cmm = cnn.CreateCommand();
            cmm.CommandText = "SELECT Grupo_Exame, Setor, Status, Procedencia, Nome_Paciente,"
                              + "Num_Pedido, Nome_Solicitante,data FROM Pedidos_Detais "
                              + "WHERE (ID_Paciente = @id) AND (Cod_Tipo_Paciente = @tipo) "
                              + "order by num_pedido";
            cmm.Parameters.Add("@id", SqlDbType.Int).Value   = _id;
            cmm.Parameters.Add("@tipo", SqlDbType.Int).Value = _tipo_id;
            try
            {
                cnn.Open();
                SqlDataReader dr = cmm.ExecuteReader();
                PedidoDetail  pd;
                while (dr.Read())
                {
                    pd             = new PedidoDetail();
                    pd.Exame       = dr.GetString(0);
                    pd.Setor       = dr.GetString(1);
                    pd.Status      = dr.GetString(2);
                    pd.Procedencia = dr.GetString(3);
                    pd.Paciente    = dr.GetString(4);
                    pd.Numped      = dr.GetInt32(5);
                    pd.Solicitante = dr.GetString(6);
                    pd.Data        = dr.GetDateTime(7);

                    pd.Id_pac = _id;
                    if (_tipo_id == 1)
                    {
                        pd.Tipo_id = "RH";
                    }
                    else
                    {
                        pd.Tipo_id = "BE";
                    }
                    pds.Items.Add(pd);
                }
            }
            catch (Exception ex) { }
        }

        return(pds);
    }
Beispiel #3
0
    public static PedidoDetail getPedidoByPed(int _ped)
    {
        PedidoDetail pd = new PedidoDetail();

        using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlConn"].ToString()))
        {
            SqlCommand cmm = cnn.CreateCommand();
            cmm.CommandText = "SELECT Grupo_Exame, Setor, Status, Procedencia, Nome_Paciente,"
                              + "Nome_Solicitante,data,id_paciente,cod_tipo_paciente FROM Pedidos_Detais "
                              + "WHERE (Num_pedido = @ped)";
            cmm.Parameters.Add("@ped", SqlDbType.Int).Value = _ped;

            try
            {
                cnn.Open();
                SqlDataReader dr = cmm.ExecuteReader();
                if (dr.Read())
                {
                    pd.Exame       = dr.GetString(0);
                    pd.Setor       = dr.GetString(1);
                    pd.Status      = dr.GetString(2);
                    pd.Procedencia = dr.GetString(3);
                    pd.Paciente    = dr.GetString(4);
                    pd.Solicitante = dr.GetString(5);
                    pd.Data        = dr.GetDateTime(6);
                    pd.Id_pac      = dr.GetInt32(7);
                    pd.Numped      = _ped;
                    int _tipo_id = dr.GetInt32(8);
                    if (_tipo_id == 1)
                    {
                        pd.Tipo_id = "RH";
                    }
                    else
                    {
                        pd.Tipo_id = "BE";
                    }
                }
            }
            catch (Exception ex) { }
        }

        return(pd);
    }