예제 #1
0
 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;
 }
예제 #2
0
        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;
        }
예제 #3
0
        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();
        }
예제 #4
0
 public DialogResult ShowAddDialog(Report owner)
 {
     _ownerReport = owner;
     Result = null;
     return ShowDialog();
 }
예제 #5
0
 DialogResult IShowListForSubReports.ShowDialog(Report entity)
 {
     _report = entity;
     Text = "::. گزارش .::" + $" {entity.Title} - {entity.DateTime.ToPersianDateString()}";
     return ShowDialog();
 }
예제 #6
0
 public AddReportStatus Add(Report report)
 {
     _reports.Add(report);
     return AddReportStatus.Successs;
 }