private void ButtonSave_Click(object sender, EventArgs e) { if (FlagSelectedRow) { PresentationLayerClass.SendDataFromStudentTextBox(panel1, FilePath); UpdateData(TableName); //PresentationLayerClass.ClearControls(this); PresentationLayerClass.ClearBeforeCreate(panel1, pictureBox1, dataGridView1); PresentationLayerClass.OnlyReadSwitch(panel1, 3, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSearch, ButtonDelete, ButtonResetFilters, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectGroupe, ButtonErace, ButtonSelectRoom, ButtonSave, ButtonOpen, ButtonClear, }, false); dataGridView1.Enabled = true; ButtonCancelEdit.Hide(); } else { if (dataGridView1.CurrentRow != null) { int i = dataGridView1.CurrentRow.Index; PresentationLayerClass.SendDataFromStudentTextBox(panel1, FilePath, Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); UpdateData(TableName); dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0]; { //dataGridView1.SelectedRows[i].Cells[0]; //dataGridView1.Rows[i].Selected = true; //MessageBox.Show(Convert.ToString(dataGridView1.CurrentRow.Index)); //------- } PresentationLayerClass.AddDataToTextBox(panel1, TableName, Convert.ToInt32(dataGridView1[0, i].Value.ToString())); PresentationLayerClass.GetSetPicture(pictureBox1, Convert.ToInt32(dataGridView1[0, i].Value.ToString())); FilePath = null; FlagSelectedRow = false; PresentationLayerClass.OnlyReadSwitch(panel1, 3, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSearch, ButtonDelete, ButtonResetFilters, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectGroupe, ButtonErace, ButtonSelectRoom, ButtonSave, ButtonOpen, ButtonClear }, false); dataGridView1.Enabled = true; ButtonCancelEdit.Hide(); } } }
private void ButtonCreate_Click(object sender, EventArgs e) { PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSave, ButtonClear }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, false); PresentationLayerClass.OnlyReadSwitch(panel1, 1, false); textBox2.ReadOnly = true; dataGridView1.Enabled = false; ButtonCancelEdit.Visible = true; PresentationLayerClass.ClearBeforeCreate(panel1); FlagSelectedRow = true; }
private void ButtonCreate_Click(object sender, EventArgs e) { PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectGroupe, ButtonErace, ButtonSelectRoom, ButtonOpen, ButtonSave, ButtonClear }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonSearch, ButtonResetFilters, ButtonEdit }, false); PresentationLayerClass.OnlyReadSwitch(panel1, 3, false); dataGridView1.Enabled = false; ButtonCancelEdit.Visible = true; PresentationLayerClass.ClearBeforeCreate(panel1, pictureBox1, dataGridView1); FlagSelectedRow = true; textBoxName1.Focus(); }
private void ButtonDelete_Click(object sender, EventArgs e) { try { DialogResult dialogResult = MessageBox.Show("Обраний запис видалится.", "Видалити?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { BusinessClass.DataDeleteStudent(Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); } UpdateData(TableName); PresentationLayerClass.ClearBeforeCreate(panel1, pictureBox1, dataGridView1); FlagSelectedRow = true; } catch { } }
private void ButtonSave_Click(object sender, EventArgs e) { if (FlagSelectedRow) { PresentationLayerClass.SendDataFromHostelTextBox(panel1); UpdateData(TableName); //PresentationLayerClass.ClearControls(this); PresentationLayerClass.ClearBeforeCreate(panel1, dataGridView1); PresentationLayerClass.OnlyReadSwitch(panel1, 1, true); TextBoxRoomsCount.ReadOnly = true; PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSave, ButtonClear, }, false); dataGridView1.Enabled = true; ButtonCancelEdit.Hide(); } else { if (dataGridView1.CurrentRow != null) { int i = dataGridView1.CurrentRow.Index; PresentationLayerClass.SendDataFromHostelTextBox(panel1, Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); UpdateData(TableName); dataGridView1.CurrentCell = dataGridView1.Rows[i].Cells[0]; PresentationLayerClass.AddDataToTextBox(panel1, TableName, Convert.ToInt32(dataGridView1[0, i].Value.ToString())); FlagSelectedRow = false; PresentationLayerClass.OnlyReadSwitch(panel1, 1, true); TextBoxRoomsCount.ReadOnly = true; PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSave, ButtonClear }, false); dataGridView1.Enabled = true; ButtonCancelEdit.Hide(); } } }
private void ButtonCancelEdit_Click(object sender, EventArgs e) { PresentationLayerClass.ClearBeforeCreate(panel1); try { PresentationLayerClass.AddDataToTextBox(panel1, TableName, Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); } catch { } FlagSelectedRow = false; ButtonCancelEdit.Visible = false; dataGridView1.Enabled = true; PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSave, ButtonDelete, ButtonClear }, false); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.OnlyReadSwitch(panel1, 0, true); textBox2.ReadOnly = true; }
private void ButtonCancelEdit_Click(object sender, EventArgs e) { PresentationLayerClass.ClearBeforeCreate(panel1, pictureBox1); try { PresentationLayerClass.AddDataToTextBox(panel1, TableName, Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); PresentationLayerClass.GetSetPicture(pictureBox1, Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString())); } catch { } FilePath = null; FlagSelectedRow = false; ButtonCancelEdit.Visible = false; dataGridView1.Enabled = true; PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectGroupe, ButtonErace, ButtonSelectRoom, ButtonOpen, ButtonSave, ButtonDelete, ButtonClear }, false); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonSearch, ButtonResetFilters, ButtonEdit }, true); PresentationLayerClass.OnlyReadSwitch(panel1, 0, true); }
private void ButtonDelete_Click(object sender, EventArgs e) { try { DialogResult dialogResult = MessageBox.Show("Обраний запис видалится.", "Видалити?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (BusinessClass.DataDeleteGroupe(Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString()))) { MessageBox.Show("Групу успішно видалено."); } else { MessageBox.Show("Видалення неможливе. В групі є студенти."); } } UpdateData(TableName); PresentationLayerClass.ClearBeforeCreate(panel1, dataGridView1); FlagSelectedRow = true; } catch { } }
private void ButtonClear_Click(object sender, EventArgs e) { PresentationLayerClass.ClearBeforeCreate(panel1); TextBoxName.Focus(); }
private void ButtonClear_Clic(object sender, EventArgs e) { PresentationLayerClass.ClearBeforeCreate(panel1, pictureBox1); textBoxName1.Focus(); }