Beispiel #1
0
 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();
         }
     }
 }
Beispiel #2
0
 private void DataGridView1_SelectionChanged(object sender, EventArgs e)
 {
     {
         //MessageBox.Show(Convert.ToString(dataGridView1.CurrentRow.Index));
         //DataTable dataTable = BusinessClass.SpecString("Students", dataGridView1.CurrentRow.Index);
         //textBoxGroupe.Text = Convert.ToString(dataTable.Rows[0][0]);
         //MessageBox.Show(Convert.ToString(dataGridView1.CurrentRow.Index));
         //dataGridView1.Columns..SortMode = DataGridViewColumnSortMode.NotSortable;
     }
     ButtonEdit.Enabled = true;
     PresentationLayerClass.AddDataToTextBox(panel1, TableName,
                                             Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString()));
     //PresentationLayerClass.AddDataToTextBox(panel1, TableName)
     PresentationLayerClass.GetSetPicture(pictureBox1,
                                          Convert.ToInt32(dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString()));
     FilePath        = null;
     FlagSelectedRow = false;
 }
Beispiel #3
0
 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);
 }