Example #1
0
        private void Change_Click(object sender, EventArgs e)
        {
            int    id  = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString());
            string sql = string.Format("UPDATE Client SET Имя ='{0}', Фамилия ='{1}'," +
                                       "'Номер телефона' ='{2}', 'Марка авто' ='{3}', 'Гос номер' ='{4}', 'Тип услуги' ='{5}'," +
                                       "'Дата визита' ='{6}', Стоимость ='{7}', Исполнитель ='{8}' WHERE id = '{9}'",
                                       GetClient().FirstName, GetClient().SecondName, GetClient().PhoneNumber,
                                       GetClient().MarkAuto, GetClient().GovermentNumber, GetClient().TypeOfService,
                                       GetClient().VisitDate.ToString("dd.MM.yyyy"), GetClient().Cost, GetClient().Employee, GetClient().IdClient);

            ConnectDataBase.InputSqlInquiry(sql);
            FillDataGirdView();
            MessageBox.Show("Запись успешно изменена!", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #2
0
 private void Remove_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[5].Value.ToString() != "Безымянный" &&
         dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].HeaderText.ToString().Equals("id"))
     {
         ConnectDataBase.InputSqlInquiry(string.Format("DELETE FROM Client WHERE id ='{0}'", dataGridView1.CurrentCell.Value.ToString()));
         MessageBox.Show("Успешно!", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
         FillDataGirdView();
     }
     else
     {
         MessageBox.Show("Для удаления нажмите на ячейку с id!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
 private void Add_Click(object sender, EventArgs e)
 {
     try
     {
         string sql = string.Format("INSERT INTO Client VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')",
                                    GetClient().IdClient, GetClient().FirstName, GetClient().SecondName, GetClient().PhoneNumber, GetClient().MarkAuto,
                                    GetClient().GovermentNumber, GetClient().TypeOfService, GetClient().VisitDate.ToString("dd.MM.yyyy"), GetClient().Cost,
                                    GetClient().Employee);
         ConnectDataBase.InputSqlInquiry(sql);
         FillDataGirdView();
         MessageBox.Show("Запись успешно добавлена!", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch
     {
         MessageBox.Show("Введите значения!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }