Ejemplo n.º 1
0
        //مسح
        private void button3_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    int       Row    = dataGridView1.CurrentRow.Index;
                    frmDialog dialog = new frmDialog("هل انت متأكد من رغبتك بحذف التدريب المحدد؟ سيتم حذف جميع المتدربين المشتركين بهذا التدريب", true);
                    dialog.ShowDialog();
                    if (frmDialog.State)
                    {
                        if (_Games.DeleteGame(row.Cells[0].Value.ToString()))
                        {
                            new frmDialog("تم مسح التدريب").ShowDialog();
                            //MessageBox.Show("تم مسح التدريب");
                            dataGridView1.Focus();
                            ShowGames();
                            try
                            {
                                this.dataGridView1.CurrentCell = this.dataGridView1[1, Row - 1];
                                dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
                            }
                            catch
                            {
                            }
                        }

                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                new frmDialog("لا يوجد تدريبات لمسحها").ShowDialog();
                return;
            }
        }
Ejemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows.Count > 0)
     {
         foreach (DataGridViewRow row in dataGridView1.SelectedRows)
         {
             int       Row    = dataGridView1.CurrentRow.Index;
             frmDialog dialog = new frmDialog("هل انت متأكد من رغبتك بحذف هذا المتدرب؟", true);
             dialog.ShowDialog();
             if (frmDialog.State)
             {
                 _Subs.DeleteSub(row.Cells[0].Value.ToString());
                 new frmDialog("تم مسح المتدرب").ShowDialog();
                 //MessageBox.Show("تم مسح المتدرب");
                 ShowSubs();
                 dataGridView1.Focus();
                 try
                 {
                     this.dataGridView1.CurrentCell = this.dataGridView1[1, Row - 1];
                     dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
                 }
                 catch { }
             }
             else
             {
                 return;
             }
         }
     }
     else
     {
         new frmDialog("لا يوجد مشتركين لمسحهم").ShowDialog();
         //MessageBox.Show("!لايوجد مشتركين لمسحهم");
         this.Focus();
     }
 }