我无法在页面之间传递数据

时间:2019-11-20 17:01:45

标签: c# xaml xamarin.forms

我正在创建一个应用,我需要使用另一页中输入文本中的数据

我创建了一个课程

Part 1:
M.knum must be Null
D.Knum must be null
O.knum must be null
E.Knum must be null
st.customer_id must be Null

Part 2:
IF c.pbs#freq is A and c.pbs#days#delq <= 716 - Show in results
IF c.pbs#freq is E and c.pbs#days#delq <= 1446 - Show in results
IF c.pbs#freq is O and c.pbs#days#delq <= 1081 - Show in results
IF c.pbs#freq is null - Show in results

Part 3: 
i.date >= 5/1/2019 - Show in results 
i.date is Null - Show in results

Part 4:
p.d30 is <= 6 or null - Show in results
p.d60 is <= 1 or null - Show in results
p.d90 is <= 0 or null - Show in results

Part 5:
p.pmts_Made >= 12 or p.pmts_made is null - Show in results

然后我创建了用户输入文本

    select s.knum,m.knum as M_knum, d.knum as D_knum, o.knum as O_knum, e.knum as E_knum, s.customer_id, st.customer_id as ST_Customer_id, s.fdd, s.status, s.state, 
        (select max(HighTrw) from (values (trw1), (trw2), (trw3)) as Value(HighTrw)) as high_trw, i.knum as Issued, isnull (i.date, '1980-01-01') as Issued_Date, c.PBS#DISP as MF_Disp, c.LN#DISP as LN_Disp,
        c.PBS#DAYS#DELQ as MF_Delq, c.PBS#FREQ as MF_Freq, c.LN#CURR#BAL as LN_Bal, c.LN#NPDD as NPDD, p.PMTS_Made as Pmts_Made, p.D30, p.D60, p.D90

    From dbo.SPI S

    left outer join dbo.combined C
        on s.knum = c.k
    Left outer join dbo.payments P
        on s.knum = p.knum 
    Left join dbo.dvn D
        on s.knum = d.knum
    Left join dbo.exclusion E
        on s.knum = e.knum
    left join dbo.issued I 
        on s.knum = i.knum
    left join dbo.outfield O
        on s.knum = o.knum 
    left join dbo.spi_tours ST
        on s.customer_id = st.customer_id
    left join dbo.magna M
        on s.knum = m.knum



        where

                              (c.pbs#freq = 'A' and c.pbs#days#delq <= 716  
                           or c.pbs#freq = 'E' and c.pbs#days#delq <= 1446 
                           or c.pbs#freq = 'O' and c.pbs#days#delq <= 1081 ) and

        (
       (i.date >= '2019-05-01' or i.date is null) 

        and

       (st.customer_id is null) 

       and    

       (p.d30 <= '6' or p.d30 is null) and (p.d60 <= '1' or p.d60 is null) and (p.d90 <= '0' or p.d90 is null)

                       )
       and       
               (

                     m.knum is null
                  and o.knum is null 
                  and e.knum is null 
                  and d.knum is null
                )
        and

                     (p.PMTS_Made >= '12' or p.pmts_made is null)

        and

        (
            (
                select max(HighTrw)
                from (values (trw1), (trw2), (TRW3)) As updatedate (HighTrw)
            )  between 625 and 900  
            and c.LN#CURR#BAL between '7500' and '15000' ) 

        or 

        (
            (
                select max(HighTrw)
                from (values (trw1), (trw2), (TRW3)) As updatedate (HighTrw)
            )  between 600 and 624  
            and c.LN#CURR#BAL between '5000' and '7499' ) 

        or

        (
            (
                select max(HighTrw)
                from (values (trw1), (trw2), (TRW3)) As updatedate (HighTrw)
            )  between 600 and 624  
            and c.LN#CURR#BAL between '3000' and '499' ) 
     ```     
    ```
    knum    M_knum  D_knum  O_knum  E_knum  customer_id ST_Customer_id  fdd status  state   high_trw    Issued  Issued_Date MF_Disp LN_Disp MF_Delq MF_Freq LN_Bal  NPDD    Pmts_Made   D30 D60 D90
    109924  NULL    NULL    NULL    NULL    102014  NULL    2018-07-20  Full    PA  618 109924  2019-11-18  A   T   0   O   5584.18 2019-12-05  14  0   0   0
    107238  NULL    NULL    NULL    NULL    97287   NULL    2016-07-21  Full    NY  609 107238  2019-04-15  A   A   0   O   6998.61 2019-11-20  39  0   0   0
    95516   NULL    NULL    NULL    NULL    73190   NULL    2009-11-15  Full    MD  618 95516   2019-11-11  A   T   372 A   7202.02 2019-11-20  67  0   0   0
    109927  NULL    NULL    NULL    NULL    93592   NULL    2018-06-16  Full    NJ  671 109927  2019-11-11  A   A   0   O   7580.33 2019-12-05  16  0   0   0
    105681  NULL    NULL    NULL    NULL    79131   NULL    2015-05-02  Full    NY  662 105681  2019-11-11  A   A   7   A   7787.22 2019-12-05  54  0   0   0
    109928  NULL    NULL    NULL    NULL    96359   NULL    2018-06-16  Full    NY  696 NULL    1980-01-01  A   T   7   A   9837.91 2019-12-05  16  0   0   0
    109928  NULL    NULL    NULL    NULL    96359   NULL    2018-06-16  Full    NY  724 NULL    1980-01-01  A   T   7   A   9837.91 2019-12-05  16  0   0   0
    109931  NULL    NULL    NULL    NULL    106351  NULL    2018-07-16  Full    NY  618 NULL    1980-01-01  A   A   0   O   5158.56 2019-09-05  12  5   3   0
    109934  NULL    NULL    NULL    NULL    102087  NULL    2018-06-26  Full    PA  656 109934  2019-11-18  A   A   7   A   10730.94    2019-11-20  15  0   0   0
    109935  NULL    NULL    NULL    NULL    108582  NULL    2018-07-15  Full    NY  642 109935  2019-10-14  A   A   372 A   11024.11    2019-12-05  15  0   0   0
    104320  NULL    NULL    NULL    NULL    81542   NULL    2014-06-10  Full    NY  688 104320  2019-09-01  A   A   7   A   8171.64 2019-12-05  65  0   0   0
    107249  NULL    NULL    NULL    NULL    102757  NULL    2016-07-22  Full    NJ  617 107249  2019-07-29  A   A   7   A   6156.54 2019-12-05  39  0   0   0
    109940  NULL    NULL    NULL    NULL    108507  NULL    2018-06-17  Full    NJ  774 NULL    1980-01-01  A   A   7   A   9678.42 2019-12-05  16  0   0   0
    107254  NULL    NULL    NULL    NULL    100012  NULL    2016-07-23  Full    DE  700 107254  2019-09-01  A   A   7   A   8457.08 2019-11-20  38  0   0   0
    99906   NULL    NULL    NULL    NULL    82770   NULL    2012-06-16  Full    NJ  707 99906   2019-09-01  A   T   7   A   8777.3  2019-11-20  88  0   0   0
    108521  NULL    NULL    NULL    NULL    97201   NULL    2017-08-18  Full    NY  615 108521  2019-03-31  A   A   7   E   6346.63 2019-12-05  27  0   0   0

毕竟是最终观点

public class Calculos
{
    public string puntos { get; set; }
    public decimal distancia { get; set; }
    public string personas { get; set; } 
    public string carros { get; set; }
    public string buses { get; set; }
    public int gaseosas { get; set; }
    public decimal monto { get; set; }
}

及其在XAML中的外观

public async void Siguiente_Clicked(object sender, EventArgs e)
{

    Calculos calculos = new Calculos();

    calculos.personas = Personas.Text.ToString();
    calculos.carros = Carros.Text.ToString();
    calculos.buses = Buses.Text.ToString();

    MitadMundo myHomePage = new MitadMundo();
    NavigationPage.SetHasNavigationBar(myHomePage, true);
    await Navigation.PushModalAsync(myHomePage);
}

但是当我测试应用程序时数据没有显示任何内容 我不知道输入文字中是否有东西 或者如果最后一页有问题 我非常感谢您的帮助

2 个答案:

答案 0 :(得分:2)

您实际上并没有做任何事情来传递数据

尝试

Row    QuestionNumber    Speaker    SpeechNEW
 1     1                 MD         Permission to record?
 2     1                 P          Yes
 3     1                 MD         Great
 4     2                 MD         I'd like to ask you- What was that?
 5     2                 P          Excuse me (blows nose)

然后,在该页面的构造函数中

// pass the instance of calculos to the new page
MitadMundo myHomePage = new MitadMundo(calculos);

答案 1 :(得分:0)

当您使用“ new”时,这意味着您正在创建该类的新实例。新实例将没有您之前在其他任何地方设置的任何值。

Calculos calculos = new Calculos();

您要做的是将calculos对象传递给您要读取的值。 Calculos calculos = new Calculos(); calculos.personas = Personas.Text.ToString(); calculos.carros = Carros.Text.ToString(); calculos.buses = Buses.Text.ToString();

将此calculos对象传递到要从中读取值的任何类或页面。