Ejemplo 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);
            }
        }
Ejemplo 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);
            }
        }
Ejemplo n.º 3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Resident resident = InfoBindingSource.Current as Resident;

            if (resident == null)
            {
                MessageBox.Show("请选择一个信息进行修改");
                return;
            }
            resident = ResidentService.Get(resident.ResidentId);
            InformationEdit informationEdit = new InformationEdit(resident);

            if (informationEdit.ShowDialog() == DialogResult.OK)
            {
                ResidentService.Update(informationEdit.Resident);
                InfoBindingSource.DataSource = ResidentService.QueryByUser(CurrentUser.UserId);
                InfoBindingSource.ResetBindings(false);
            }
        }