Example #1
0
        //Выполняется при загрузке формы, заполнение таблицы данными из БД, настройка элементов управления
        private void Clients_Load(object sender, EventArgs e)
        {
            try
            {
                reconnectBtn.Font = new Font(reconnectBtn.Font.Name, 10, FontStyle.Regular | FontStyle.Underline);
                formDescriptor    = this;
                clientsTable.RowsDefaultCellStyle.BackColor            = System.Drawing.ColorTranslator.FromHtml("#f1f2f6");
                clientsTable.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#ffffff");
                DBConnection.GetClients();
                clientsTable.DataSource          = DBConnection.dtClients;
                clientsTable.CurrentCell         = clientsTable[0, 0];
                clientsTable.Rows[0].Selected    = true;
                clientsTable.Columns[10].Visible = false;
                clientsTable.Columns[11].Visible = false;
                if (DBConnection.dtClients.Rows.Count > 0)
                {
                    ReadClientsTableRow(0);
                }

                DBConnection.GetCountries();
                country.DataSource    = DBConnection.dtCountries;
                country.DisplayMember = "Название";
                country.ValueMember   = "ID";
                DBConnection.GetCities();
                city.DataSource    = DBConnection.dtCities;
                city.DisplayMember = "Название";
                city.ValueMember   = "ID";
            }
            catch (Exception ex)
            {
                exceptPanel.Visible = true;
                richTextBox1.Text   = ex.ToString();
            }
        }
Example #2
0
 private void label19_Click(object sender, EventArgs e)
 {
     try
     {
         clientsTable.DataSource = null;
         DBConnection.GetClients();
         clientsTable.DataSource = DBConnection.dtClients;
     }
     catch (Exception ex)
     {
         exceptPanel.Visible = true;
         richTextBox1.Text   = ex.ToString();
     }
 }
Example #3
0
 //Отмена действующих фильтров в таблице с клиентами
 private void filterCancelBtn_Click_1(object sender, EventArgs e)
 {
     try
     {
         clientName.Text         = "";
         clientsTable.DataSource = null;
         DBConnection.GetClients();
         clientsTable.DataSource = DBConnection.dtClients;
         if (DBConnection.dtClients.Rows.Count > 0)
         {
             ReadClientsTableRow(0);
         }
     }
     catch (Exception ex)
     {
         exceptPanel.Visible = true;
         richTextBox1.Text   = ex.ToString();
     }
 }
Example #4
0
 //Редактирование клиента, обновление данных в связанных таблицах
 private void saveClientBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (name.Text == "" || contactPerson.Text == "" || phone.Text == "" || adress.Text == "" || email.Text == "" || bankAccount.Text == "" || INN.Text == "" || country.Text == "" || city.Text == "")
         {
             MessageBox.Show("Заполните все поля!");
             return;
         }
         DBConnection.EditClient(Clients.clientID, name.Text, contactPerson.Text, phone.Text, country.SelectedValue.ToString(), city.SelectedValue.ToString(), adress.Text, email.Text, bankAccount.Text, INN.Text);
         DBConnection.GetClients();
         Clients.formDescriptor.clientsTable.DataSource = DBConnection.dtClients;
         Clients.ReadClientsTableRow(0);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #5
0
 //Происходит при загрузке формы, настройка элементов управления
 private void EditRequest_Load(object sender, EventArgs e)
 {
     try
     {
         loadingPanel.Visible = false;
         DBConnection.GetManagers();
         manager.DataSource    = DBConnection.dtManagers;
         manager.DisplayMember = "ФИО";
         manager.ValueMember   = "ID";
         DBConnection.GetClients();
         client.DataSource     = DBConnection.dtClients;
         client.DisplayMember  = "Название";
         client.ValueMember    = "ID";
         dateRequest.Value     = Convert.ToDateTime(date_request);
         dateContract.Value    = Convert.ToDateTime(date_contract);
         client.SelectedValue  = client_num;
         manager.SelectedValue = manager_num;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Example #6
0
        //Происходит при загрузке формы, настройка элементов управления
        private void AddRequest_Load(object sender, EventArgs e)
        {
            try
            {
                loadingPanel.Visible = false;

                DBConnection.GetClients();
                client.DataSource    = DBConnection.dtClients;
                client.DisplayMember = "Название";
                client.ValueMember   = "ID";

                DBConnection.GetManagers();
                manager.DataSource    = DBConnection.dtManagers;
                manager.DisplayMember = "ФИО";
                manager.ValueMember   = "ID";

                status.Text = "Новый";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #7
0
 //Удаление выбранного клиента
 private void delClientBtn_Click(object sender, EventArgs e)
 {
     try
     {
         if (clientsTable.Rows.Count == 0)
         {
             MessageBox.Show("Нет записей для удаления!");
             return;
         }
         clientsTable.DataSource = null;
         DBConnection.DeleteClient(clientID);
         DBConnection.GetClients();
         clientsTable.DataSource = DBConnection.dtClients;
         if (DBConnection.dtClients.Rows.Count > 0)
         {
             ReadClientsTableRow(0);
         }
     }
     catch (Exception ex)
     {
         exceptPanel.Visible = true;
         richTextBox1.Text   = ex.ToString();
     }
 }