📄 userinfo.cs
字号:
public event UserInfoRowChangeEventHandler UserInfoRowDeleted;
public event UserInfoRowChangeEventHandler UserInfoRowDeleting;
public void AddUserInfoRow(UserInfoRow row) {
this.Rows.Add(row);
}
public UserInfoRow AddUserInfoRow(string LoginName, string UserName, int Gender, string Mobile, string Remark, string Password) {
UserInfoRow rowUserInfoRow = ((UserInfoRow)(this.NewRow()));
rowUserInfoRow.ItemArray = new object[] {
null,
LoginName,
UserName,
Gender,
Mobile,
Remark,
Password};
this.Rows.Add(rowUserInfoRow);
return rowUserInfoRow;
}
public System.Collections.IEnumerator GetEnumerator() {
return this.Rows.GetEnumerator();
}
public override DataTable Clone() {
UserInfoDataTable cln = ((UserInfoDataTable)(base.Clone()));
cln.InitVars();
return cln;
}
protected override DataTable CreateInstance() {
return new UserInfoDataTable();
}
internal void InitVars() {
this.columnUserId = this.Columns["UserId"];
this.columnLoginName = this.Columns["LoginName"];
this.columnUserName = this.Columns["UserName"];
this.columnGender = this.Columns["Gender"];
this.columnMobile = this.Columns["Mobile"];
this.columnRemark = this.Columns["Remark"];
this.columnPassword = this.Columns["Password"];
}
private void InitClass() {
this.columnUserId = new DataColumn("UserId", typeof(int), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnUserId);
this.columnLoginName = new DataColumn("LoginName", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnLoginName);
this.columnUserName = new DataColumn("UserName", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnUserName);
this.columnGender = new DataColumn("Gender", typeof(int), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnGender);
this.columnMobile = new DataColumn("Mobile", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnMobile);
this.columnRemark = new DataColumn("Remark", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnRemark);
this.columnPassword = new DataColumn("Password", typeof(string), null, System.Data.MappingType.Element);
this.Columns.Add(this.columnPassword);
this.columnUserId.AutoIncrement = true;
this.columnUserId.AllowDBNull = false;
this.columnUserId.ReadOnly = true;
this.columnLoginName.AllowDBNull = false;
this.columnUserName.AllowDBNull = false;
this.columnGender.AllowDBNull = false;
this.columnMobile.AllowDBNull = false;
this.columnPassword.AllowDBNull = false;
}
public UserInfoRow NewUserInfoRow() {
return ((UserInfoRow)(this.NewRow()));
}
protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
return new UserInfoRow(builder);
}
protected override System.Type GetRowType() {
return typeof(UserInfoRow);
}
protected override void OnRowChanged(DataRowChangeEventArgs e) {
base.OnRowChanged(e);
if ((this.UserInfoRowChanged != null)) {
this.UserInfoRowChanged(this, new UserInfoRowChangeEvent(((UserInfoRow)(e.Row)), e.Action));
}
}
protected override void OnRowChanging(DataRowChangeEventArgs e) {
base.OnRowChanging(e);
if ((this.UserInfoRowChanging != null)) {
this.UserInfoRowChanging(this, new UserInfoRowChangeEvent(((UserInfoRow)(e.Row)), e.Action));
}
}
protected override void OnRowDeleted(DataRowChangeEventArgs e) {
base.OnRowDeleted(e);
if ((this.UserInfoRowDeleted != null)) {
this.UserInfoRowDeleted(this, new UserInfoRowChangeEvent(((UserInfoRow)(e.Row)), e.Action));
}
}
protected override void OnRowDeleting(DataRowChangeEventArgs e) {
base.OnRowDeleting(e);
if ((this.UserInfoRowDeleting != null)) {
this.UserInfoRowDeleting(this, new UserInfoRowChangeEvent(((UserInfoRow)(e.Row)), e.Action));
}
}
public void RemoveUserInfoRow(UserInfoRow row) {
this.Rows.Remove(row);
}
}
[System.Diagnostics.DebuggerStepThrough()]
public class UserInfoRow : DataRow {
private UserInfoDataTable tableUserInfo;
internal UserInfoRow(DataRowBuilder rb) :
base(rb) {
this.tableUserInfo = ((UserInfoDataTable)(this.Table));
}
public int UserId {
get {
return ((int)(this[this.tableUserInfo.UserIdColumn]));
}
set {
this[this.tableUserInfo.UserIdColumn] = value;
}
}
public string LoginName {
get {
return ((string)(this[this.tableUserInfo.LoginNameColumn]));
}
set {
this[this.tableUserInfo.LoginNameColumn] = value;
}
}
public string UserName {
get {
return ((string)(this[this.tableUserInfo.UserNameColumn]));
}
set {
this[this.tableUserInfo.UserNameColumn] = value;
}
}
public int Gender {
get {
return ((int)(this[this.tableUserInfo.GenderColumn]));
}
set {
this[this.tableUserInfo.GenderColumn] = value;
}
}
public string Mobile {
get {
return ((string)(this[this.tableUserInfo.MobileColumn]));
}
set {
this[this.tableUserInfo.MobileColumn] = value;
}
}
public string Remark {
get {
try {
return ((string)(this[this.tableUserInfo.RemarkColumn]));
}
catch (InvalidCastException e) {
throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
}
}
set {
this[this.tableUserInfo.RemarkColumn] = value;
}
}
public string Password {
get {
return ((string)(this[this.tableUserInfo.PasswordColumn]));
}
set {
this[this.tableUserInfo.PasswordColumn] = value;
}
}
public bool IsRemarkNull() {
return this.IsNull(this.tableUserInfo.RemarkColumn);
}
public void SetRemarkNull() {
this[this.tableUserInfo.RemarkColumn] = System.Convert.DBNull;
}
}
[System.Diagnostics.DebuggerStepThrough()]
public class UserInfoRowChangeEvent : EventArgs {
private UserInfoRow eventRow;
private DataRowAction eventAction;
public UserInfoRowChangeEvent(UserInfoRow row, DataRowAction action) {
this.eventRow = row;
this.eventAction = action;
}
public UserInfoRow Row {
get {
return this.eventRow;
}
}
public DataRowAction Action {
get {
return this.eventAction;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -