Untitled
unknown
plain_text
6 months ago
4.5 kB
2
Indexable
namespace DataGridViewDemo { using System; using System.Data; using System.Xml.Serialization; using System.ComponentModel; using System.Collections.Generic; /// <summary> /// Represents a strongly typed DataSet for managing the PhoneBook records. /// </summary> [Serializable()] [XmlSchemaProvider("GetTypedDataSetSchema")] [System.ComponentModel.DesignerCategory("code")] [System.ComponentModel.ToolboxItem(true)] [XmlRoot("AppData")] public partial class AppData : DataSet { private PhoneBookDataTable tablePhoneBook; public AppData() { this.BeginInit(); this.InitClass(); this.EndInit(); } private void InitClass() { this.tablePhoneBook = new PhoneBookDataTable(); this.Tables.Add(this.tablePhoneBook); } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public PhoneBookDataTable PhoneBook { get { return this.tablePhoneBook; } } public override DataSet Clone() { AppData cln = (AppData)base.Clone(); cln.InitVars(); return cln; } private void InitVars() { this.tablePhoneBook = (PhoneBookDataTable)this.Tables["PhoneBook"]; } /// <summary> /// Represents a strongly-typed DataTable for storing phone book records. /// </summary> [Serializable()] [XmlSchemaProvider("GetTypedTableSchema")] public partial class PhoneBookDataTable : DataTable, IEnumerable { private DataColumn columnFullName; private DataColumn columnPhoneNumber; private DataColumn columnEmail; public PhoneBookDataTable() { this.TableName = "PhoneBook"; this.BeginInit(); this.InitClass(); this.EndInit(); } private void InitClass() { this.columnFullName = new DataColumn("FullName", typeof(string), null, MappingType.Element); this.Columns.Add(this.columnFullName); this.columnPhoneNumber = new DataColumn("PhoneNumber", typeof(string), null, MappingType.Element); this.Columns.Add(this.columnPhoneNumber); this.columnEmail = new DataColumn("Email", typeof(string), null, MappingType.Element); this.Columns.Add(this.columnEmail); } public PhoneBookRow NewPhoneBookRow() { return (PhoneBookRow)this.NewRow(); } protected override DataRow NewRowFromBuilder(DataRowBuilder builder) { return new PhoneBookRow(builder); } public void AddPhoneBookRow(PhoneBookRow row) { this.Rows.Add(row); } public PhoneBookRow FindByFullName(string fullName) { return (PhoneBookRow)this.Rows.Find(new object[] { fullName }); } public IEnumerator GetEnumerator() { return this.Rows.GetEnumerator(); } } /// <summary> /// Represents a strongly-typed DataRow for storing an individual phone book entry. /// </summary> public partial class PhoneBookRow : DataRow { private PhoneBookDataTable tablePhoneBook; internal PhoneBookRow(DataRowBuilder rb) : base(rb) { this.tablePhoneBook = (PhoneBookDataTable)this.Table; } public string FullName { get { return (string)this[this.tablePhoneBook.FullNameColumn]; } set { this[this.tablePhoneBook.FullNameColumn] = value; } } public string PhoneNumber { get { return (string)this[this.tablePhoneBook.PhoneNumberColumn]; } set { this[this.tablePhoneBook.PhoneNumberColumn] = value; } } public string Email { get { return (string)this[this.tablePhoneBook.EmailColumn]; } set { this[this.tablePhoneBook.EmailColumn] = value; } } } } }
Editor is loading...
Leave a Comment