Beispiel #1
0
        protected override void OnSaveButtonClicked()
        {
            var entity = new Person
            {
                Name = nameBox.Text.Trim(),
                Mobile = mobileBox.Text.Trim(),
                Telephone = telephoneBox.Text.Trim(),
                Address = addressBox.Text.Trim()
            };

            if (!Validation(entity)) return;

            var old = _repository.FirstOrDefault(x => x.Id == _result.Id);
            if (old == null)
            {
                entity.ActiveState = true;
                _repository.Add(entity);
            }
            else
            {
                old.Name = entity.Name;
                old.Mobile = entity.Mobile;
                old.Telephone = entity.Telephone;
                old.Address = entity.Address;
            }
            SaveAndExit();
        }
Beispiel #2
0
        public async Task<AddUpdatePersonStatus> UpdateAsync(Person person)
        {
            var old = await FindByMobileAsync(person.Mobile);
            if (old?.Id != person.Id)
                return AddUpdatePersonStatus.DuplicateMobile;

            return AddUpdatePersonStatus.Success;
        }
Beispiel #3
0
        public async Task<AddUpdatePersonStatus> AddAsync(Person person)
        {
            if (await IsExistByMobileAsync(person.Mobile))
                return AddUpdatePersonStatus.DuplicateMobile;

            _persons.Add(person);
            return AddUpdatePersonStatus.Success;
        }
 protected override DataGridViewRow FillRow(Person entity, DataGridViewRow rowToAdd)
 {
     rowToAdd.Cells.Add(new DataGridViewTextBoxCell { Value = entity.Id });
     rowToAdd.Cells.Add(new DataGridViewTextBoxCell { Value = entity.Name });
     rowToAdd.Cells.Add(new DataGridViewTextBoxCell { Value = entity.Mobile });
     rowToAdd.Cells.Add(new DataGridViewTextBoxCell { Value = entity.Telephone });
     rowToAdd.Cells.Add(new DataGridViewTextBoxCell { Value = entity.Address });
     if (!entity.ActiveState) rowToAdd.DefaultCellStyle.BackColor = _inactiveColor;
     return rowToAdd;
 }
 DialogResult IAddOrEditCheckBank.ShowAddDialog(Person owner)
 {
     _ownerPerson = owner;
     Result = null;
     return ShowDialog();
 }
 private void personCombo_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     var ix = personCombo.SelectedIndex;
     if (ix >= 0) Person = _personsList[ix];
 }
 private void personCombo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.Enter) return;
     int id;
     if (!int.TryParse(personCombo.Text, out id)) return;
     var p = _personsList.FirstOrDefault(x => x.Id == id);
     if (p != null) Person = p;
 }
 DialogResult IShowListForCheckBanks.ShowDialog(Person owner)
 {
     _person = owner;
     return ShowDialog();
 }
 public async Task<IList<CheckBank>> FindForPerson(Person person)
     => await FindForPerson(person.Id);
Beispiel #10
0
 public async Task<IList<Transfer>> GetListForPersonAsync(Person person)
     => await GetListForPersonAsync(person.Id);
 public void ShowFor(Person entity)
 {
     _person = entity;
     Text = "::. صورت حساب .::" + $"[{_person.Id}]: {_person.Name} {_person.Mobile}";
     ShowDialog();
 }
 DialogResult IShowListForTransferForms.ShowDialog(Person owner)
 {
     _person = owner;
     return ShowDialog();
 }
 public DialogResult ShowAddDialog(Person owner)
 {
     _person = owner;
     Result = null;
     return ShowDialog();
 }
Beispiel #14
0
 public void Inactive(Person person)
     => person.ActiveState = false;
Beispiel #15
0
 public void Activate(Person person)
     => person.ActiveState = true;