Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var peopleFamily = new PeopleFamily();

            peopleFamily.Relation = this.txtRelation.Text;
            peopleFamily.FamilyPeopleName = this.txtFamilyPeopleName.Text;
            peopleFamily.WorkUnit = this.txtWorkUnit.Text;
            peopleFamily.Title = this.txtTitle.Text;
            peopleFamily.PhoneNum = this.txtPhoneNum.Text;
            peopleFamily.Address = this.txtAddress.Text;

            var bll = new PeopleFamilyBLL();
            if (this._isEdit) {
                if (this._currentPeopleFamilyID.HasValue) {
                    peopleFamily.PeopleFamilyID = this._currentPeopleFamilyID.Value;
                    var result = bll.UpdatePeopleFamily(peopleFamily);
                    MessageHelper.ShowSaveDbResultMessage(result);
                    if (result.Code == 0) {
                        this.Dispose();
                    }
                }
            } else {
                if (this._peopleID.HasValue) {
                    peopleFamily.PeopleID = this._peopleID.Value;
                    var result = bll.InsertPeopleFamily(peopleFamily);
                    MessageHelper.ShowSaveDbResultMessage(result);
                    if (result.Code == 0) {
                        this.Dispose();
                    }
                }
            }
            if (callbackEvent != null) {
                callbackEvent.Invoke();
            }
        }