Esempio n. 1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Resident resident = ResidentBindingSource.Current as Resident;

            if (resident == null)
            {
                MessageBox.Show("请选择一个家庭成员进行修改");
                return;
            }
            InformationEdit information = new InformationEdit(resident);

            if (information.ShowDialog() == DialogResult.OK)
            {
                ResidentBindingSource.ResetBindings(false);
            }
        }
Esempio n. 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            InformationEdit information = new InformationEdit(new Resident());

            try
            {
                if (information.ShowDialog() == DialogResult.OK)
                {
                    information.Resident.ResidentId = txtUserId.Text;
                    ResidentService.Add(information.Resident);
                    ResidentBindingSource.ResetBindings(false);
                }
            }
            catch (Exception e2)
            {
                MessageBox.Show(e2.Message);
            }
        }