private void ButtonEdit_Click(object sender, EventArgs e) { if (!FlagSelectedRow) { PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSave, ButtonDelete, ButtonClear }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, false); PresentationLayerClass.OnlyReadSwitch(panel1, 1, false); textBox2.ReadOnly = true; ButtonCancelEdit.Visible = 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 ButtonCreate_Click(object sender, EventArgs e) { PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectHostel, ButtonSave, ButtonClear }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, false); PresentationLayerClass.OnlyReadSwitch(panel1, 2, false); TextBoxFreePlace.ReadOnly = true; dataGridView1.Enabled = false; ButtonCancelEdit.Visible = true; PresentationLayerClass.ClearBeforeCreate(panel1, dataGridView1); FlagSelectedRow = true; ButtonSelectHostel.Focus(); }
private void ButtonSave_Click(object sender, EventArgs e) { if (FlagSelectedRow) { PresentationLayerClass.SendDataFromRoomTextBox(panel1); UpdateData(TableName); //PresentationLayerClass.ClearControls(this); PresentationLayerClass.ClearBeforeCreate(panel1, dataGridView1); PresentationLayerClass.OnlyReadSwitch(panel1, 1, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectHostel, ButtonSave, ButtonClear, }, false); dataGridView1.Enabled = true; ButtonCancelEdit.Hide(); } else { if (dataGridView1.CurrentRow != null) { int i = dataGridView1.CurrentRow.Index; PresentationLayerClass.SendDataFromRoomTextBox(panel1, 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())); FlagSelectedRow = false; PresentationLayerClass.OnlyReadSwitch(panel1, 1, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonDelete, ButtonCreate, ButtonEdit }, true); PresentationLayerClass.EnableDisableButtons(new Button[] { ButtonSelectHostel, 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); }