protected override DataGridViewRow FillRow(Freight 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.SuggestedMoney.ToString("C0") }); if (!entity.ActiveState) rowToAdd.DefaultCellStyle.BackColor = _inactiveColor; return rowToAdd; }
public async Task<AddUpdateFreightStatus> UpdateAsync(Freight freight) { var old = await FindByNameAsync(freight.Name); if (old?.Id != freight.Id) return AddUpdateFreightStatus.DuplicateName; return AddUpdateFreightStatus.Success; }
public async Task<AddUpdateFreightStatus> AddAsync(Freight freight) { if (await IsExistByNameAsync(freight.Name)) return AddUpdateFreightStatus.DuplicateName; _freights.Add(freight); return AddUpdateFreightStatus.Success; }
protected override void OnSaveButtonClicked() { var entity = new Freight { Name = nameBox.Text.Trim(), SuggestedMoney = taxNum.Value, ActiveState = true }; 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.SuggestedMoney = entity.SuggestedMoney; } SaveAndExit(); }
public void Active(Freight freight) => freight.ActiveState = true;
public void Inactive(Freight freight) => freight.ActiveState = false;