示例#1
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(nameTB.Text.Trim()) || String.IsNullOrEmpty(lastNameTB.Text.Trim()) ||
                String.IsNullOrEmpty(postNameTB.Text.Trim()) || this.orgIDCmB.SelectedItem == null)
            {
                MessageBox.Show("Не заполнено одно из полей", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (this._editableId != -1)
            {
                _entity.Name       = this.nameTB.Text.Trim();
                _entity.LastName   = this.lastNameTB.Text.Trim();
                _entity.MiddleName = this.middleNameTB.Text.Trim();
                _entity.PostName   = this.postNameTB.Text.Trim();
                _entity.OrgID      = (this.orgIDCmB.SelectedItem as OutsideOrg).Id;

                ApplicationMap.OutsideEmp[this._editableId] = this._entity;
            }
            else
            {
                this._entity = new OutsideEmp((this.orgIDCmB.SelectedItem as OutsideOrg).Id,
                                              this.postNameTB.Text.Trim(), this.lastNameTB.Text.Trim(),
                                              this.nameTB.Text.Trim(), this.middleNameTB.Text.Trim());

                ApplicationMap.OutsideEmp[this._editableId] = this._entity;
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
示例#2
0
 private void EditDicOutsideEmp_Shown(object sender, EventArgs e)
 {
     if (this._editableId != -1)
     {
         this._entity               = ApplicationMap.OutsideEmp[this._editableId];
         this.lastNameTB.Text       = _entity.LastName;
         this.nameTB.Text           = _entity.Name;
         this.middleNameTB.Text     = _entity.MiddleName;
         this.postNameTB.Text       = _entity.PostName;
         this.orgIDCmB.SelectedItem = ApplicationMap.OutsideOrg[_entity.OrgID];
     }
 }