protected override DataGridViewRow FillRow(Report entity, DataGridViewRow rowToAdd) { rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.Id}); rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.DateTime.ToPersianDateString()}); rowToAdd.Cells.Add(new DataGridViewTextBoxCell {Value = entity.Title}); return rowToAdd; }
public async Task<UpdateReportStatus> UpdateAsync(int id, Report report) { var old = await FindByIdAsync(id); if (old == null) return UpdateReportStatus.InvalidReportId; old.DateTime = report.DateTime; old.Percentage = report.Percentage; old.Title = report.Title; return UpdateReportStatus.Successs; }
protected override void OnSaveButtonClicked() { var entity = new Report { Title = titleBox.Text.Trim(), DateTime = datePickerBox.Date, Percentage = percentNum.Value }; if (!Validation(entity)) return; var old = _repository.FirstOrDefault(x => x.Id == _result.Id); if (old == null) { _repository.Add(entity); } else { old.Title = entity.Title; old.DateTime = entity.DateTime; old.Percentage = entity.Percentage; } SaveAndExit(); }
public DialogResult ShowAddDialog(Report owner) { _ownerReport = owner; Result = null; return ShowDialog(); }
DialogResult IShowListForSubReports.ShowDialog(Report entity) { _report = entity; Text = "::. گزارش .::" + $" {entity.Title} - {entity.DateTime.ToPersianDateString()}"; return ShowDialog(); }
public AddReportStatus Add(Report report) { _reports.Add(report); return AddReportStatus.Successs; }