private void button3_Click(object sender, EventArgs e) { Person_Bll person_Bll = new Person_Bll(); Person person = new Person(); person = person_Bll.GetPerson("002"); }
private void button7_Click(object sender, EventArgs e) { Person person = new Person(); List <Person> person_list = new List <Person>(); Person_Bll person_bll = new Person_Bll(); person_list = person_bll.GetPerson(); DataTable dt = (from pl in person_list select new { pl.person_no, pl.person_name, pl.class_no, pl.grade.class_name }).ToList().ConvertToDataTable(); this.exDataGridView1.DataSource = dt; this.exDataGridView1.Columns.Clear(); this.exDataGridView1.AddColumn("class_no", "班级编号", IFReadOnly: false); this.exDataGridView1.AddColumn("class_name", "班级名称", IFReadOnly: false); this.exDataGridView1.AddColumn("person_no", "人员编号", IFReadOnly: false); this.exDataGridView1.AddColumn("person_name", "人员名称", IFReadOnly: false); dt.AcceptChanges(); }
private void button5_Click(object sender, EventArgs e) { Person_Bll person_Bll = new Person_Bll(); List <Person> person_List = new List <Person>(); person_List = person_Bll.GetPerson(); this.dataGridView1.DataSource = person_List; //this.dataGridView1.DataSource = person_List.ConvertToDataTable(); this.dataGridView1.Columns.Clear(); DataGridViewTextBoxColumn obj1 = new DataGridViewTextBoxColumn(); obj1.DataPropertyName = "person_no"; obj1.HeaderText = "人员编号"; obj1.Name = "person_no"; obj1.Width = 80; Func <string, int> A = x => x.Length; int kkk = A("fdsa"); Func <int, int, bool> B = (a, b) => a > b; bool kkk2 = B(10, 20); Func <Person, bool> C = x => x.id > 10; person_List.Where(x => x.id > 10 || x.person_name.Length > 5); this.dataGridView1.Columns.AddRange(obj1); DataGridViewComboBoxColumn obj2 = new DataGridViewComboBoxColumn(); obj2.DataPropertyName = "sex"; obj2.HeaderText = "性别"; obj2.Name = "sex"; obj2.Width = 80; //obj2.DataSource = System.Enum.GetNames(typeof(Model.Enum.Enum.Sex)); obj2.DataSource = System.Enum.GetValues(typeof(Model.Enum.Enum.Sex)); // obj2.ValueType = typeof(Model.Enum.Enum.Sex); //obj2.DataSource=Model.Enum.Enum.Sex Console.WriteLine(Enum.GetName(typeof(Model.Enum.Enum.Sex), 100)); var aa = System.Enum.GetNames(typeof(Model.Enum.Enum.Sex)); var bb = System.Enum.GetValues(typeof(Model.Enum.Enum.Sex)); this.dataGridView1.Columns.AddRange(obj2); }
private void button2_Click(object sender, EventArgs e) { Person_Bll person_Bll = new Person_Bll(); person_Bll.GetPerson(); }