예제 #1
0
        private void ribbonButton1_Click(object sender, EventArgs e)
        {
            EditorForm form = new EditorForm("Новый отдел");

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SQL.ExecSQL("INSERT INTO 'departments' ('name') VALUES ('" + form.Value + "');");
                LoadDepartments();
            }
        }
예제 #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            EditorForm form = new EditorForm("Новый сотрудник");

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // добавляем запись
                SQL.ExecSQL("INSERT INTO 'workers' ('name') VALUES ('" + form.Value + "');");
                LoadData();
            }
        }
예제 #3
0
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     if (grid.SelectedRows.Count >= 0)
     {
         EditorForm form = new EditorForm("Редактировать данные сотрудника", grid.SelectedRows[0].Cells["name"].Value.ToString());
         if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             // изменить запись
             SQL.ExecSQL("DELETE FROM 'workers' WHERE id=" + grid.SelectedRows[0].Cells["id"].Value.ToString() + "; INSERT INTO 'workers' ('id', 'name') VALUES ('" + grid.SelectedRows[0].Cells["id"].Value.ToString() + "','" + form.Value + "');");
             LoadData();
         }
     }
 }