コード例 #1
0
ファイル: AddService.cs プロジェクト: veetash/CarDealerShip
        private void EditButton_Click(object sender, EventArgs e)
        {
            var index = ServiceListBox.SelectedIndex;

            if (index >= 0 && ServiceListBox.GetSelected(index))
            {
                var crash = Car.CrashHistory[index];
                if (DescTb.Text != crash.Description &&
                    DescTb.Text != "" ||
                    DateTp.Value != crash.Date ||
                    SeriousCb.Checked != crash.IsSerious)
                {
                    crash.Description = DescTb.Text;
                    crash.Date        = DateTp.Value;
                    crash.IsSerious   = SeriousCb.Checked;

                    ServiceListBox.DataSource = null;
                    ServiceListBox.DataSource = Car.CrashHistory;
                }
                else
                {
                    MessageBox.Show("Введите изменения!");
                }
            }
        }
コード例 #2
0
ファイル: AddService.cs プロジェクト: veetash/CarDealerShip
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            var index = ServiceListBox.SelectedIndex;

            if (index >= 0 && ServiceListBox.GetSelected(index))
            {
                var crash = Car.CrashHistory[index];
                Car.CrashHistory.Remove(crash);

                ServiceListBox.DataSource = null;
                ServiceListBox.DataSource = Car.CrashHistory;

                DateTp.Value         = DateTime.Today;
                DescTb.Text          = "";
                SeriousCb.CheckState = CheckState.Unchecked;
            }
        }
コード例 #3
0
ファイル: AddService.cs プロジェクト: veetash/CarDealerShip
        private void ServiceListBox_Click(object sender, EventArgs e)
        {
            var index = ServiceListBox.SelectedIndex;

            if (index >= 0 && ServiceListBox.GetSelected(index))
            {
                var crash = Car.CrashHistory[index];
                DateTp.Value = crash.Date;
                DescTb.Text  = crash.Description;
                if (crash.IsSerious)
                {
                    SeriousCb.CheckState = CheckState.Checked;
                }
                else
                {
                    SeriousCb.CheckState = CheckState.Unchecked;
                }
            }
        }