Пример #1
0
        private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewOrderForm form = new NewOrderForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                UpdateData();
            }
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string phone    = maskedTextBox1.Text;
            string password = txtBxPassword.Text;

            if (Controller.People.Count > 0)
            {
                var rr = Controller.People.ToList();

                Person person = Controller.People.FirstOrDefault(t => t.Phone == phone && t.Password == password);
                if (person == null)
                {
                    MessageBox.Show("Пользователь не найден");
                    return;
                }
                else
                {
                    if (person is Manager)
                    {
                        Manager manager = person as Manager;
                        if (manager.IsAdmin)
                        {
                            ApplicationHelper.CurrentRole = Model.Role.Admin;
                        }
                        else
                        {
                            ApplicationHelper.CurrentRole = Model.Role.Manager;
                        }

                        ApplicationHelper.CurrentManager = manager;

                        MainForm mainForm = new MainForm();
                        Hide();
                        mainForm.Show();
                        mainForm.FormClosed += MainForm_FormClosed;
                    }
                    else if (person is Client)
                    {
                        ApplicationHelper.CurrentRole = Model.Role.Client;

                        NewOrderForm mainForm = new NewOrderForm(client: person as Client);
                        Hide();
                        mainForm.FormClosed += MainForm_FormClosed;
                        mainForm.ShowDialog();
                    }
                }
            }
            else
            {
                ApplicationHelper.CurrentRole = Model.Role.Admin;

                MainForm mainForm = new MainForm();
                Hide();
                mainForm.Show();
                mainForm.FormClosed += MainForm_FormClosed;
            }
        }
Пример #3
0
        private void редактироватьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                Order order = dataGridView1.SelectedRows[0].DataBoundItem as Order;

                NewOrderForm form = new NewOrderForm(order);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    UpdateData();
                }
            }
        }