0

我正在开发一个应用程序,但是卡在一段代码中,我不知道如何弄清楚,当我从数据库加载数据时,我希望每个记录状态都设置为无。

但未能做到这一点。这是我的代码。

 
    [Table(`PROGRAM_OFFER`)]
    public class ProgramOffer : DomainObject
    {
        #region -   [   Properties  ]   -

        private decimal _ProgramOfferId { get; set; }
        [PrimaryKey(`PROGRAM_OFFER_ID`)]
        public virtual decimal ProgramOfferId
        {
            get { return _ProgramOfferId; }
            set
            {
                if (_ProgramOfferId != value)
                {
                    _ProgramOfferId = value;
                    NotifyChanged(`ProgramOfferId`);

                    CheckIfFirstRecord();
                }
            }
        }
        private decimal _ProgramId { get; set; }
        [Column(`PROGRAM_ID`)]
        public virtual decimal ProgramId
        {
            get { return _ProgramId; }
            set
            {
                if (_ProgramId != value)
                {
                    _ProgramId = value;
                    NotifyChanged(`ProgramId`);

                    CheckIfFirstRecord();
                }
            }
        }
        private RecordStatus _CurruntRecordStatus { get; set; }
        public RecordStatus CurruntRecordStatus
        {
            get { return _CurruntRecordStatus; }
            set
            {
                if (_CurruntRecordStatus != value)
                    if (value == RecordStatus.None || _CurruntRecordStatus == RecordStatus.None || _CurruntRecordStatus == 0)
                    {
                        _CurruntRecordStatus = value;
                        NotifyChanged("CurruntRecordStatus");
                    }
            }
        }

        private void CheckIfFirstRecord()
        {
            if (ProgramOfferId > 0 && ProgramId > 0 && TermId > 0 && SemesterId > 0)
                if (CurruntRecordStatus == 0)
                    CurruntRecordStatus = RecordStatus.None;
                else
                    CurruntRecordStatus = RecordStatus.Updated;
        }
 

CurrentRecordStatus这是我的代码,如果这是第一次加载,如何设置为 None,

谢谢

问候

4

1 回答 1

0

在构造函数中设置默认值怎么样?

public ProgramOffer()
{
    _CurruntRecordStatus = RecordStatus.None;
}
于 2013-02-28T09:16:57.920 回答