C#-INotifyPropertyChanged(解决数据绑定的界面刷新问题)
using xxxxxxxx;
using System;
using System.Collections.Generic;
using System.Data;
namespace YJCZJJG.Server.Models.Model.Business
{
/// <summary>
/// 个人账户
/// </summary>
[TableDesc(TableName = "yjczjjg_Account", IsLowerOrUpper = true)]
public partial class AccountModel : System.ComponentModel.INotifyPropertyChanged
{
private string _saccountid;
private string _orgid;
private string _bankTypeid;
private List<string> _updatecolumns;
/// <summary>
/// 银行类别代码
/// </summary>
[ModelProperty(CurDbType = DbType.String, Size = 12, sqlKey = false, IsUserDefined = false)]
public string BankTypeId
{
set
{
if (_bankTypeid != value)
{
_bankTypeid = value;
this.RaisePropertyChanged("BankTypeId");
}
}
get { return _bankTypeid; }
}
/// <summary>
/// 第三方机构Id
/// </summary>
[ModelProperty(CurDbType = DbType.String, Size = 12, sqlKey = false, IsUserDefined = false)]
public string OrgId
{
set
{
if (_orgid != value)
{
_orgid = value;
this.RaisePropertyChanged("OrgId");
}
}
get { return _orgid; }
}
/// <summary>
/// 更新列集合
/// </summary>
[Newtonsoft.Json.JsonProperty(Order = 10000)]
public List<string> UpdateColumns
{
set { _updatecolumns = value; }
get { return _updatecolumns; }
}
/// <summary>
/// 资金专户Id
/// </summary>
[ModelProperty(CurDbType = DbType.String, Size = 32, sqlKey = false, IsUserDefined = false)]
public string SAccountId
{
set
{
if (_saccountid != value)
{
_saccountid = value;
this.RaisePropertyChanged("SAcountId");
}
}
get { return _saccountid; }
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
if (propertyName != "IsChecked")
{
//记录更新属性
if (_updatecolumns == null) _updatecolumns = new List<string>();
if (_updatecolumns.Contains(propertyName) == false) _updatecolumns.Add(propertyName);
}
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
}