private void textBoxPersonName_Click(object sender, EventArgs e) { FormSelectPerson.DefaultPosition = Position.STOCKINFO; if (FormSelectPerson == null) { FormSelectPerson.DefaultPosition = Position.STOCKINFO; FormSelectPerson = new FormSelectPerson(); } FormSelectPerson.SetSelectFinishedCallback((selectedID) => { var PersonName = (from s in wmsEntities.PersonView where s.ID == selectedID select s).FirstOrDefault(); if (PersonName.Name == null) { MessageBox.Show("选择人员信息失败,人员信息不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //this.supplierID = selectedID; //selectedID = 1; this.personid = selectedID; this.Controls.Find("textBoxPersonName", true)[0].Text = PersonName.Name; this.personidc = 1; }); FormSelectPerson.ShowDialog(); }
private void textBoxJobPersonName_Click(object sender, EventArgs e) { FormSelectPerson form = new FormSelectPerson(); form.SetSelectFinishedCallback((id) => { this.curJobPersonID = id; if (!this.IsDisposed) { WMSEntities wmsEntities = new WMSEntities(); Person person = (from p in wmsEntities.Person where p.ID == id select p).FirstOrDefault(); if (person == null) { MessageBox.Show("选中人员不存在,请重新查询", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.curJobPersonID = id; this.textBoxJobPersonName.Text = person.Name; } }); form.Show(); }