private void BuyOut_Click(object sender, EventArgs e) { if (Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].DateTimeBuyOut <= DateTime.Now) { MessageBox.Show("Срок кредита истёк!"); --Client.Rank; Shop.Deposits.RemoveAt(Shop.IndOfDepByName(DepositComboBox.Text)); Deposits = Shop.FindDepositsByClient(Client); depositBindingSource.DataSource = Deposits; if (Deposits.Count != 0) { productBindingSource.DataSource = Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].Products; } else { productBindingSource.DataSource = null; DateTimeBox.Clear(); DateTimeBuyOutBox.Clear(); PriceBox.Clear(); } return; } var res = MessageBox.Show($"К оплате {Shop.GetPrice(Shop.FindDepByName(DepositComboBox.Text), Client)} грн. Подтвердить действие?", "", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { string name = DepositComboBox.Text; if (DepositComboBox.Text != "") { Shop.Deposits.RemoveAt(Shop.IndOfDepByName(name)); Deposits = Shop.FindDepositsByClient(Client); depositBindingSource.DataSource = Deposits; if (Deposits.Count != 0) { productBindingSource.DataSource = Shop.Deposits[Shop.IndOfDepByName(DepositComboBox.Text)].Products; } else { productBindingSource.DataSource = null; DateTimeBox.Clear(); DateTimeBuyOutBox.Clear(); PriceBox.Clear(); } } Shop.IsDirty = true; ++Client.Rank; } if (Deposits.Count == 0) { BuyOutButton.Enabled = false; } }
public User(User instance) { UserId = instance.UserId; IsConnected = instance.IsConnected; DateTimeBox = instance.DateTimeBox; }
public override void Initialize() { _menu = new Menu(); var menuButton1 = new MenuItemButton <object>() { Text = "Menu 1", }; menuButton1.AddChild(new MenuItemButton <object>() { Text = "Submenu 1.1" }); _menu.AddChild(menuButton1); var menuButton2 = new MenuItemButton <object>() { Text = "Menu 2", }; menuButton2.AddChild(new MenuItemButton <object>() { Text = "Submenu 2.1" }); menuButton2.AddChild(new MenuItemButton <object>() { Text = "Submenu 2.2" }); _menu.AddChild(menuButton2); Menu = _menu; _checkbox1 = new Checkbox { Location = new Point { Left = 3, Top = 5 }, Text = "Checkbox tentative" }; _checkbox1.CheckedChanged += checkbox1_CheckedChanged; RootPanel.AddChild(_checkbox1); _checkbox2 = new Checkbox { Location = new Point { Left = 3, Top = 7 }, IsChecked = true, Text = "Checkbox checked" }; RootPanel.AddChild(_checkbox2); _checkbox3 = new Checkbox { Location = new Point { Left = 3, Top = 9 }, IsChecked = false, Text = "Checkbox unchecked" }; RootPanel.AddChild(_checkbox3); _checkbox4 = new Checkbox { Location = new Point { Left = 3, Top = 11 }, IsChecked = false, Text = "Checkbox disabled", IsEnabled = false }; RootPanel.AddChild(_checkbox4); _label1 = new Label { Location = new Point { Left = 3, Top = 19 }, Text = "Label" }; RootPanel.AddChild(_label1); _radioButton1 = new RadioButton { Location = new Point { Left = 3, Top = 13 }, Text = "Radio unchecked" }; RootPanel.AddChild(_radioButton1); _radioButton2 = new RadioButton { Location = new Point { Left = 3, Top = 15 }, Text = "Radio checked", IsChecked = true }; RootPanel.AddChild(_radioButton2); _radioButton3 = new RadioButton { Location = new Point { Left = 3, Top = 17 }, Text = "Radio checked", IsChecked = true, IsEnabled = false }; RootPanel.AddChild(_radioButton3); _textBox1 = new TextBox { Location = new Point { Left = 29, Top = 16 } }; _textBox1.TextChanged += textBox1_TextChanged; RootPanel.AddChild(_textBox1); _dateTimeBox1 = new DateTimeBox() { Location = new Point { Left = 29, Top = 18 } }; RootPanel.AddChild(_dateTimeBox1); _numericBox1 = new NumericBox() { Location = new Point { Left = 29, Top = 20 } }; RootPanel.AddChild(_numericBox1); _button1 = new Button { Location = new Point { Left = 3, Top = 22 }, Width = 10 }; _button1.Pressed += button1_Pressed; RootPanel.AddChild(_button1); _button2 = new Button { Location = new Point { Left = 16, Top = 22 }, Width = 10, IsEnabled = false, Text = "Disabled button" }; _button2.Pressed += button2_Pressed; RootPanel.AddChild(_button2); _progressBar1 = new ProgressBar { Location = new Point { Left = 3, Top = 3 }, Width = 74, TextAligment = TitleAligment.Left }; RootPanel.AddChild(_progressBar1); _bnext1 = new Button { Location = new Point { Left = 40, Top = 22 }, Width = 10, Text = "Next 1", Tag = 1 }; _bnext1.Pressed += bNextPressed; RootPanel.AddChild(_bnext1); _bnext2 = new Button { Location = new Point { Left = 51, Top = 22 }, Width = 10, Text = "Next 2", Tag = 2 }; _bnext2.Pressed += bNextPressed; RootPanel.AddChild(_bnext2); _bnext3 = new Button { Location = new Point { Left = 62, Top = 22 }, Width = 10, Text = "Next 3", Tag = 3 }; _bnext3.Pressed += bNextPressed; RootPanel.AddChild(_bnext3); _panel1 = new BorderPanel { Location = new Point { Left = 28, Top = 4 }, Size = new Size { Height = 7, Width = 25 } }; RootPanel.AddChild(_panel1); var subRadiobuton1 = new RadioButton { Location = new Point { Left = 1, Top = 1 } }; _panel1.AddChild(subRadiobuton1); var subRadiobuton2 = new RadioButton { Location = new Point { Left = 1, Top = 3 } }; _panel1.AddChild(subRadiobuton2); var subRadiobuton3 = new RadioButton { Location = new Point { Left = 1, Top = 5 } }; _panel1.AddChild(subRadiobuton3); _comboBox1 = new ComboBox { Location = new Point { Left = 29, Top = 12 }, VisibleItemsCount = 7 }; _comboBox1.Items.AddRange(new[] { new ComboBoxItem() { Key = 1, Text = "EntityFX" }, new ComboBoxItem() { Key = 2, Text = "Green.Dragon" }, new ComboBoxItem() { Key = 3, Text = "Guzalianna" }, new ComboBoxItem() { Key = 4, Text = "Prozz" }, new ComboBoxItem() { Key = 5, Text = "Aik2029" }, new ComboBoxItem() { Key = 6, Text = "Zombie" }, new ComboBoxItem() { Key = 7, Text = "Wesker" }, new ComboBoxItem() { Key = 8, Text = "Perez" }, new ComboBoxItem() { Key = 9, Text = "Chuvak" }, new ComboBoxItem() { Key = 10, Text = "Magistr" }, new ComboBoxItem() { Key = 11, Text = "Mad" }, new ComboBoxItem() { Key = 12, Text = "XOBAH" } }); RootPanel.AddChild(_comboBox1); RootPanel.AddChild(new Checkbox { Location = new Point { Left = 29, Top = 14 }, Text = "Checkbox for overlapp" }); _image = Image.FromString( @"───▄▄▄ ─▄▀░▄░▀▄ ─█░█▄▀░█ ─█░▀▄▄▀█▄█▄▀ ▄▄█▄▄▄▄███▀ "); _image.Location = new Point() { Left = 55, Top = 4 }; RootPanel.AddChild(_image); _plotChart = new PlotChart() { Size = new Size() { Height = 10, Width = 30 }, Location = new Point() { Left = 48, Top = 11 }, PlotSymbol = ':' }; _plotChart.Points = GenerateSinChartPoints(_plotChart.Size, 7); RootPanel.AddChild(_plotChart); StatusStrip = new StatusStrip(); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 1" }); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 2" }); _timeStripItem = new StatusStripLabel { Text = "Item 3", ItemLocation = ItemLocationEnum.Right }; StatusStrip.AddChild(_timeStripItem); StatusStrip.AddChild(new StatusStripLabel { Text = "Item 4", ItemLocation = ItemLocationEnum.Right }); StatusStrip.AddChild(new StatusStripButton { Text = "But 1", ItemLocation = ItemLocationEnum.Left }); StatusStrip.AddChild(new StatusStripButton { Text = "But 2", ItemLocation = ItemLocationEnum.Left }); _statusStripProgressBar = new StatusStripProgressBar { Text = "P: {0}", Width = 14, Minimum = 0, Value = 16, Maximum = 25 }; StatusStrip.AddChild(_statusStripProgressBar); Initializetable(); _timer.Elapsed += timer_Elapsed; _timer.Start(); _timer2.Elapsed += _timer2_Elapsed; _timer2.Start(); }