Example #1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if(flag==0)
            {
                if (dgViewData.SelectedIndex == -1)
                {
                    MessageBox.Show("Необходимо выделить запись");
                    return;
                }
                if (dgViewData.SelectedCells.Count > 2)
                {
                    MessageBox.Show("Необходимо выделить одну запись");
                    return;
                }
                DataRowView rowView = dgViewData.SelectedValue as DataRowView;
                ADDEditTypeWindow f = new ADDEditTypeWindow(fwbd.connection, 1, Convert.ToInt32(rowView[0].ToString()));
                f.ShowDialog();
                fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
                HiddenColumns();
            }
            if (flag == 1)
            {
                if (dgViewData.SelectedIndex == -1)
                {
                    MessageBox.Show("Необходимо выделить запись");
                    return;
                }
                if (dgViewData.SelectedCells.Count > 7)
                {
                    MessageBox.Show("Необходимо выделить одну запись");
                    return;
                }
                DataRowView rowView = dgViewData.SelectedValue as DataRowView;
                ADDEditTeachers f = new ADDEditTeachers(fwbd.connection, 1, Convert.ToInt32(rowView[0].ToString()));
                f.ShowDialog();
                fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
                HiddenColumns();
            }
            if (flag == 2)
            {
                if (dgViewData.SelectedIndex == -1)
                {
                    MessageBox.Show("Необходимо выделить запись");
                    return;
                }
                if (dgViewData.SelectedCells.Count > 3)
                {
                    MessageBox.Show("Необходимо выделить одну запись");
                    return;
                }
                DataRowView rowView = dgViewData.SelectedValue as DataRowView;
                ADDEditSubgroupsWindow f = new ADDEditSubgroupsWindow(fwbd.connection, 1, Convert.ToInt32(rowView[0].ToString()));
                f.ShowDialog();
                fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
                HiddenColumns();
            }



        }
Example #2
0
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     if(flag==0)
     {
         ADDEditTypeWindow f = new ADDEditTypeWindow(fwbd.connection, 0, 1);
         f.ShowDialog();
         fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
         HiddenColumns();
     }
     if (flag == 1)
     {
         ADDEditTeachers f = new ADDEditTeachers(fwbd.connection, 0, 1);
         f.ShowDialog();
         fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
         HiddenColumns();
     }
     if (flag == 2)
     {
         ADDEditSubgroupsWindow f = new ADDEditSubgroupsWindow(fwbd.connection, 0, 1);
         f.ShowDialog();
         fwbd.FillingDataGrid(dgViewData, CommandSelect, Name);
         HiddenColumns();
     }
   //  MessageBox.Show("stop");
 }