Exemple #1
0
 private void EditRowOnGrid(DataGridViewRow selectedRow,
                            AddFullDayDetalizationDataForm addFullDayDetalizationData)
 {
     selectedRow.Cells[0].Value = $"{addFullDayDetalizationData.Detalization.WorkDate:dd/MM/yyyy}";
     selectedRow.Cells[1].Value = addFullDayDetalizationData.Detalization.Payment.GetDisplayName();
     selectedRow.Cells[2].Value = addFullDayDetalizationData.Detalization.WorkHours;
     selectedRow.Cells[3].Value = addFullDayDetalizationData.Detalization.Used.GetDisplayName();
     selectedRow.Cells[4].Value = $"{addFullDayDetalizationData.Detalization.RestDate:dd/MM/yyyy}";
     selectedRow.Cells[5].Value = addFullDayDetalizationData.Detalization.Comment;
 }
Exemple #2
0
        private void btEdit_Click(object sender, EventArgs e)
        {
            var selectedRow = dgvFullDayDetalization.Rows[dgvFullDayDetalization.SelectedCells[0].RowIndex];

            if (!DateTime.TryParse(dgvFullDayDetalization.Rows[dgvFullDayDetalization.SelectedCells[0].RowIndex]
                                   .Cells[0]?.Value?.ToString(), out var wDate))
            {
                return;
            }

            var editData = new AddFullDayDetalizationDataForm(GetFullDayDetalization(selectedRow), "Редактировать детализацию полного дня");

            if (editData.ShowDialog() == DialogResult.OK &&
                employeeRepository.TryEditFullDayDetalization(wDate, id, editData.Detalization))
            {
                EditRowOnGrid(selectedRow, editData);
            }
        }
Exemple #3
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            var addData =
                new AddFullDayDetalizationDataForm(new FullDayDetalization {
                WorkDate = null, RestDate = null
            }, "Добавить детализацию полного дня");

            if (addData.ShowDialog() == DialogResult.OK)
            {
                var d = addData.Detalization;

                if (employeeRepository.TryAddFullDayDetalization(id, d))
                {
                    dgvFullDayDetalization.Rows.Add($"{d.WorkDate?.Date:dd/MM/yyyy}",
                                                    d.Payment.GetDisplayName(), d.WorkHours,
                                                    d.Used.GetDisplayName(), $"{d.RestDate?.Date:dd/MM/yyyy}", d.Comment);
                }
            }
        }