private void buttonWithAccessLevel11_Click(object sender, EventArgs e) { EmployeeAddEditForm eaef = new EmployeeAddEditForm("Добавить сотрудника", data); if(eaef.ShowDialog()==DialogResult.OK) { data.Tables["employee"].Rows.Add(eaef.Result); if (postgreConnection.UpdateDB("employee", data, 1)) RefreshEmployeeList(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { EmployeeAddEditForm eaef = new EmployeeAddEditForm( "Добавить сотрудника", data ); if (eaef.ShowDialog() == DialogResult.OK) { data.Tables["employee"].Rows.Add(eaef.Result); if (postgreConnection.UpdateDB("employee", data, 1)) RefreshBS(); } }
private void changeOrderButton_Click(object sender, EventArgs e) { if(listBox1.SelectedIndex!=-1) { EmployeeAddEditForm eaef = new EmployeeAddEditForm("Изменить сотрудника", data,data:data.Tables["employee"].Select("id="+listBox1.SelectedValue.ToString())[0].ItemArray,buttonCaption:"Редактировать"); if (eaef.ShowDialog() == DialogResult.OK) { data.Tables["employee"].Select("id=" + listBox1.SelectedValue.ToString())[0].ItemArray = eaef.Result; if (postgreConnection.UpdateDB("employee", data, 2)) RefreshEmployeeList(); } } }
private void toolStripButton2_Click(object sender, EventArgs e) { if (dataGridView2.DataSource != null) { EmployeeAddEditForm eaef = new EmployeeAddEditForm("Редактировать инофрмацию о сотруднике", dataSet1, data: dataSet1.Tables["employee"].Select("id=" + dataGridView2.SelectedRows[0].Cells["id"].Value.ToString())[0].ItemArray, buttonCaption: "Редактировать",isEditable:false); if (eaef.ShowDialog() == DialogResult.OK) { dataSet1.Tables["employee"].Select("id=" + eaef.Result[0].ToString())[0].ItemArray = eaef.Result; postgreConnection.UpdateDB("employee", dataSet1, 2); RefreshDataGridEmployees(); } } }
private void menuItemWithAccessLevel1_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0 && dataGridView1.SelectedRows[0].Cells[0].Value.ToString()!="-1") { EmployeeAddEditForm eaef = new EmployeeAddEditForm("Редактировать инофрмацию о сотруднике", dataSet1, data: dataSet1.Tables["employee"].Select("id=" + dataGridView1.SelectedRows[0].Cells[0].Value.ToString())[0].ItemArray, buttonCaption: "Редактировать", isEditable: false); if(eaef.ShowDialog() == DialogResult.OK) { dataSet1.Tables["employee"].Select("id=" + eaef.Result[0].ToString())[0].ItemArray = eaef.Result; postgreConnection.UpdateDB("employee", dataSet1, 2); RedrawSelectionDataGridView(); } } }
private void buttonWithAccessLevel2_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { object[] arr; EmployeeAddEditForm eae = new EmployeeAddEditForm(String.Format("Добавить сотрудника в отряд {0}", label2.Text), dataSet1); if (eae.ShowDialog() == DialogResult.OK) { dataSet1.Tables["employee"].Rows.Add(eae.Result); if (postgreConnection.UpdateDB("employee", dataSet1, 1)) { arr = new object[] { null, (int)listBox1.SelectedValue, (int)dataSet1.Tables["employee"].Rows[dataSet1.Tables["employee"].Rows.Count-1]["id"]};//add to squad_workers! dataSet1.Tables["squad_worker"].Rows.Add(arr); postgreConnection.UpdateDB("squad_worker", dataSet1, 1); } if (currentDrawItem != -1) RedrawSelectionDataGridView(); } } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { EmployeeAddEditForm eaef; if (dataGridView2.DataSource != null) { eaef = new EmployeeAddEditForm(String.Format("Добавить сотрудника в отряд {0}", label2.Text), dataSet1); if(eaef.ShowDialog() == DialogResult.OK) { dataSet1.Tables["employee"].Rows.Add(eaef.Result); if(postgreConnection.UpdateDB("employee", dataSet1, 1)) RefreshDataGridEmployees(); } } }
private void показатьКарточкуЭтогоСотрудникаToolStripMenuItem_Click(object sender, EventArgs e) { if(listBox2.SelectedIndex!=-1) { EmployeeAddEditForm eaf = new EmployeeAddEditForm( "Карточка сотрудника", dataSet1, isEditable: false, data: dataSet1.Tables["employee"].Select("id=" + listBox2.SelectedValue.ToString())[0].ItemArray, buttonCaption: "Редактировать"); if(eaf.ShowDialog()==DialogResult.OK) { dataSet1.Tables["employee"].Select("id=" + listBox2.SelectedValue.ToString())[0].ItemArray = eaf.Result; if (postgreConnection.UpdateDB("employee", dataSet1, 2)) EmployeeDataRefrash(); } } else MessageBox.Show("Неверный ввод"); }
private void menuItemWithAccessLevel17_Click(object sender, EventArgs e) { EmployeeAddEditForm eaef = new EmployeeAddEditForm("Добавить сотрудника", globalDS); if (eaef.ShowDialog() == DialogResult.OK) { globalDS.Tables["employee"].Rows.Add(eaef.Result); postgreConnection.UpdateDB("employee", globalDS, 1); } }
private void toolStripButton1_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { EmployeeAddEditForm eaef = new EmployeeAddEditForm( "Редактировать сотрудника", data, isEditable: true, data: data.Tables["employee"].Select("id=" + dataGridView1.SelectedRows[0].Cells["id"].Value.ToString())[0].ItemArray, buttonCaption: "Редактировать" ); if (eaef.ShowDialog() == DialogResult.OK) { data.Tables["employee"].Select("id=" + dataGridView1.SelectedRows[0].Cells["id"].Value.ToString())[0].ItemArray = eaef.Result; if (postgreConnection.UpdateDB("employee", data, 2)) RefreshBS(); } } }