tags:

views:

77

answers:

1

Strange thing is happening. My constructor returning object with null fields when one property value is 3 here is the constructor:

public T_BR(BR br)
{
    try
    {
        base.BR_ID = br.BR_ID;
        base.QT_ID = br.QT_ID;
        base.WWID = br.WWID;
        base.Date = br.Date;
        base.Ctg_ID = br.Ctg_ID;
        base.F_Ctg_ID = br.F_Ctg_ID;
        base.Prj_ID = br.Prj_ID;
        base.Mch_ID = br.Mch_ID;
        base.Dtl_ID = br.Dtl_ID;
        base.Grp_ID = br.Grp_ID;
        base.Notes = br.Notes;
        base.BR_Status_ID = br.BR_Status_ID;
        base.UsedAmount = br.UsedAmount;
        base.New = br.New;
        base.Ownerless = br.Ownerless;

        this._RemainingAmount = br.RemainingAmount;
        this._EnableEditQTstatus5 = br.EnableEditQTstatus5;
        if (br.EnableEditQTstatus5 == false&&br.BR_Status_ID!=4)
        {
            base.RequestedAmount = br.NewRequestedAmount;
            base.ApprovedAmount = br.NewApprovedAmount;
        }
        else
        {
            base.RequestedAmount = br.RequestedAmount;
            base.ApprovedAmount = br.ApprovedAmount;
        }
        this._NewApprovedAmount = br.NewApprovedAmount;
        this._NewRequestedAmount = br.NewRequestedAmount;
    }
    catch (Exception)
    {
        throw;
    }

}

When I running debug mode I see that the fields are filled but outside the constructor they are null. All the object fields are from primitive type (int,string,float) If the value of the property base.BR_Status_ID is 3 I will get a T_BR object with null fields. Else everything is OK. Here is the call to the constructor:

    foreach (DataRow dr in dt.Rows)
    { 
        br=new BR(dr);
        tbr = new T_BR(br);
        tbrList.Add(tbr);
    }

The br object is OK (I build it also with constructor).The tbr object containing null fields. Please help. Thanks.

A: 

I think I fad mistake during dibugging. didn't look to correct values. The problem is somewhere else. Thanks.