Пример #1
0
        private void BtnChangeClientInfo_Click(object sender, EventArgs e)
        {
            ChangeClientInfo chClient = new ChangeClientInfo();
            ClientPresenter  clPress  = new ClientPresenter(chClient, clientManager, groupManager, cardCreatorManager, messager);

            chClient.ShowDialog();
        }
Пример #2
0
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (RemoveGroup != null)
                {
                    RemoveGroup(this, EventArgs.Empty);
                }

                txbEdit.Text  = string.Empty;
                pEdit.Visible = false;
            }
            catch (RemoveGroupException rge)
            {
                DialogResult dr = MessageBox.Show(
                    string.Format("{0}{1}{1}{2}",
                                  rge,
                                  Environment.NewLine,
                                  "Открыть форму работы с клиентами?"),
                    "Ошибка удаления группы",
                    MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Error
                    );

                if (dr == System.Windows.Forms.DialogResult.OK)
                {
                    MySqlManager             dbm  = new MySqlManager();
                    Messager                 mess = new Messager();
                    ClientCardCreatorManager clientCardCreator = new ClientCardCreatorManager();
                    ClientManager            clm      = new ClientManager(dbm, mess);
                    GroupManager             gm       = new GroupManager(dbm, mess);
                    ChangeClientInfo         chClient = new ChangeClientInfo((Group)lbGroups.SelectedItem);

                    ClientPresenter clPress = new ClientPresenter(chClient, clm, gm, clientCardCreator, mess);

                    int          grInx = lbGroups.SelectedIndex;
                    DialogResult clientFormClosedResult = chClient.ShowDialog();

                    if (clientFormClosedResult == System.Windows.Forms.DialogResult.OK)
                    {
                        if (RefreshGroupList != null)
                        {
                            RefreshGroupList(this, EventArgs.Empty);
                        }

                        lbGroups.SelectedIndex = grInx;
                    }
                }
            }
        }