Beispiel #1
0
        private void DentalRecordsGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dentalRecordsGridView.SelectedRows.Count == 1)
            {
                var dentalRecordID = (Guid)dentalRecordsGridView.SelectedRows[0].Cells[0].Value;
                var dentalRecord   = DentalRecords.FirstOrDefault(record => record.ID == dentalRecordID);

                var dentalRecordForm = new EditDentalRecordForm(dentalRecord.ToothNumber, dentalRecord.Date, dentalRecord.Cause,
                                                                dentalRecord.FromStatus, dentalRecord.ToStatus);

                if (dentalRecordForm.ShowDialog() == DialogResult.OK)
                {
                    dentalRecord.Cause      = dentalRecordForm.Diagnosis;
                    dentalRecord.Date       = dentalRecordForm.Date;
                    dentalRecord.FromStatus = dentalRecordForm.FromToothStatus;
                    dentalRecord.ToStatus   = dentalRecordForm.ToToothStatus;

                    RefreshDiary();
                }
            }
            else
            {
                MessageBox.Show(@"Выбрана не одна запись в дневнике.",
                                @"Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void ToothButtonMouseUp(object sender, MouseEventArgs e)
        {
            var toothButton = sender as Button;
            int toothNumber = Int32.Parse(toothButton.Name.Replace("button_", String.Empty));
            var tooth       = _patientTeeth.First(t => t.ToothNumber == toothNumber);

            if (e.Button == MouseButtons.Left)
            {
                var fromToothStatus = tooth.Status;

                var teethStatusForm = new TeethStatusForm(fromToothStatus);

                if (teethStatusForm.ShowDialog() == DialogResult.OK && teethStatusForm.ToothStatus != fromToothStatus)
                {
                    var    toToothStatus          = teethStatusForm.ToothStatus;
                    string toothStatusDescription = toToothStatus.GetDescription();

                    toothStatusToolTip.SetToolTip(toothButton, toothStatusDescription);
                    toothButton.BackColor = toToothStatus.ConvertToColor();

                    tooth.Status = toToothStatus;

                    var diaryRecordForm = new EditDentalRecordForm(toothNumber, DateTime.Now, teethStatusForm.Cause,
                                                                   fromToothStatus, toToothStatus);

                    if (diaryRecordForm.ShowDialog() == DialogResult.OK)
                    {
                        _dentalRecords.Add(new DentalRecord
                        {
                            ID          = Guid.NewGuid(),
                            Cause       = diaryRecordForm.Diagnosis,
                            Date        = diaryRecordForm.Date,
                            FromStatus  = diaryRecordForm.FromToothStatus,
                            ToStatus    = diaryRecordForm.ToToothStatus,
                            Tooth       = tooth,
                            ToothNumber = tooth.ToothNumber
                        });
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                var toothDentalRecords = _dentalRecords.Where(dentalRecord => dentalRecord.ToothNumber == toothNumber).ToList();
                var dentalRecordsForm  = new DentalRecordsForm(tooth, toothDentalRecords);
                dentalRecordsForm.ShowDialog();

                _dentalRecords = _dentalRecords.Where(dentalRecord => dentalRecord.ToothNumber != toothNumber).ToList();
                _dentalRecords.AddRange(dentalRecordsForm.DentalRecords);
            }
        }
Beispiel #3
0
        private void AddDentalRecordButton_Click(object sender, EventArgs e)
        {
            var diaryRecordForm = new EditDentalRecordForm(_patientTooth.ToothNumber);

            if (diaryRecordForm.ShowDialog() == DialogResult.OK)
            {
                DentalRecords.Add(new DentalRecord
                {
                    ID          = Guid.NewGuid(),
                    Cause       = diaryRecordForm.Diagnosis,
                    Date        = diaryRecordForm.Date,
                    FromStatus  = diaryRecordForm.FromToothStatus,
                    ToStatus    = diaryRecordForm.ToToothStatus,
                    Tooth       = _patientTooth,
                    ToothNumber = _patientTooth.ToothNumber
                });

                RefreshDiary();
            }
        }