private void button1_Click(object sender, EventArgs e) { Model_infAdd_Main.clear(); Model_infAdd_Main.Name = textBox_Name.Text; Model_infAdd_Main.PeopleId = label10.Text; Model_infAdd_Main.Sex = comboBox_Sex.Text; Model_infAdd_Main.BoolType = comboBox_BoolType.Text; Model_infAdd_Main.Type = textBox_main_Type.Text; Bll.ChangeByPeopleId(); }
private void submit_Click(object sender, EventArgs e) { Model_infAdd_Main.clear(); //mark=false 时要求实体可以出现空值 Model_infAdd_Main.Mark = true; if (checkBox_Sb_Name.Checked == true) { Model_infAdd_Main.Name = textBox_Sb_Name.Text; } if (checkBox_Sb_Sex.Checked == true) { Model_infAdd_Main.Sex = textBox_Sb_Sex.Text; } if (checkBox_Sb_Address.Checked == true) { Model_infAdd_Main.Ad_1 = textBox_Sb_Address.Text; } if (checkBox_Sb_Age.Checked == true) { Model_infAdd_Main.Age_1 = textBox_Sb_age_1.Text; Model_infAdd_Main.Age_2 = textBox_Sb_age_2.Text; } if (checkBox_Sb_Id.Checked == true) { Model_infAdd_Main.PeopleId = textBox_Sb_id.Text; } if (checkBox_Sb_BloodType.Checked == true) { Model_infAdd_Main.BoolType = textBox_Sb_BloodType.Text; } if (checkBox_Sb_Type.Checked == true) { Model_infAdd_Main.Type = textBox_Sb_Type.Text; } //给数据源dt dt = Bll.find_cz_inf(); dataGridView1.DataSource = Bll.GetPagedTable(dt, 1, 10); //计算总行数 MaxpageIdex = dt.Rows.Count; label15.Text = "1" + "/" + ((dt.Rows.Count / 10) + 1).ToString(); }
private void button1_Click(object sender, EventArgs e) { Model_infAdd_Main.clear(); //mark=true 时要求实体不能出现空值 Model_infAdd_Main.Mark = true; /*****给实体类赋值*****/ Model_infAdd_Main.Name = textBox_Name.Text; Model_infAdd_Main.Ad_1 = comboBox_Address_1.Text; Model_infAdd_Main.Ad_2 = comboBox_Address_2.Text; Model_infAdd_Main.Ad_3 = comboBox_Address_3.Text; Model_infAdd_Main.BoolType = comboBox_BoolType.Text;//Model_infAdd_Main.Date = dateTimePicker_date.CustomFormat = "yyyy-MM-dd"; dateTimePicker_date.Format = DateTimePickerFormat.Custom; this.dateTimePicker_date.ShowUpDown = true; Model_infAdd_Main.Date = dateTimePicker_date.Text; Model_infAdd_Main.PeopleId = textBox_People_Id.Text; Model_infAdd_Main.Sex = comboBox_Sex.Text; Model_infAdd_Main.Type = textBox_main_Type.Text; Model_infAdd_Other.Tel = textBox_Tel.Text; Model_infAdd_Other.Healthy = comboBox_Body.Text; Model_infAdd_Other.Lv = comboBox_Lv.Text; //添加 Bll.add_cz_inf(); //添加后查询 验证是否成功 Model_infAdd_Main.Mark = false; Model_infAdd_Main.clear(); Model_infAdd_Main.PeopleId = textBox_People_Id.Text; DataTable dtTemp = Bll.find_cz_inf(); if (dtTemp.Rows.Count > 0) { Model_infAdd_Other.People_inf_main_id = dtTemp.Rows[0][0].ToString(); Model_infAdd_Other.Tel = textBox_Tel.Text; Model_infAdd_Other.Healthy = comboBox_Body.Text; Model_infAdd_Other.Lv = comboBox_Lv.Text; if (comboBox_Body.Text == "健康") { Model_infAdd_Other.Lv = 0 + ""; } Bll.add_cz_other_inf(); MessageBox.Show("添加成功"); } else if (Model_infAdd_Main.Mark != false) { MessageBox.Show("失败"); } }