private void cmb_name_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (flag2)
     {
         using (DataSet ds = DataManger.GetDataSet("stud_selectbyid", "x", new SqlParameter("@stud_id", (int)cmb_name.SelectedValue)))
         {
             foreach (DataRow item in ds.Tables["x"].Rows)
             {
                 txt_studname.Text  = item[1].ToString();
                 txt_studid.Text    = item[0].ToString();
                 cmb_studclass.Text = cmb1_class.Text;
                 stud_bar           = item[3].ToString();
                 stud_id            = item[0].ToString();
                 stud_class         = cmb1_class.Text;
                 stud_group         = item[2].ToString();
                 stud_name          = item[1].ToString();
                 using (DataSet dw = DataManger.GetDataSet("group_selectbyclass", "x", new SqlParameter("@class", cmb_studclass.Text)))
                 {
                     cmb_studgroup.DataSource    = dw.Tables["x"];
                     cmb_studgroup.DisplayMember = "group_id";
                 }
                 cmb_studgroup.Text = "";
                 cmb_studgroup.Text = item[2].ToString();
                 barc = item[3].ToString();
             }
         }
     }
 }
 private void btnstart_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("!!هل انت متاكد من بيانات المجموعه", @"confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
     {
         if (drb3_class.Text != "" && cmb_group2.Text != "")
         {
             id  = new List <string>();
             id2 = new List <string>();
             using (DataSet ds = DataManger.GetDataSet("stud_selectbygroupid", "x", new SqlParameter("@group_id", cmb_group2.Text)))
             {
                 foreach (DataRow item in ds.Tables["x"].Rows)
                 {
                     id.Add(item[0].ToString());
                 }
             }
             drb3_class.Enabled = false;
             cmb_group2.Enabled = false;
             txtbar.Enabled     = true;
             txtbar.Focus();
             btnfinish.Enabled = true;
             btnstart.Enabled  = false;
             c            = id.Count;
             lblabse.Text = id.Count.ToString();
         }
         else
         {
             MessageBox.Show("من فضلك املا الفراغات", "mistake", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
 private void cmb_studclass_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (DataSet ds = DataManger.GetDataSet("group_selectbyclass", "x", new SqlParameter("@class", cmb_studclass.Text)))
     {
         cmb_studgroup.DataSource    = ds.Tables["x"];
         cmb_studgroup.DisplayMember = "group_id";
     }
     cmb_studgroup.Text = "";
 }
 private void drb1_class_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (DataSet ds = DataManger.GetDataSet("group_selectbyclass", "x", new SqlParameter("@class", drb1_class.Text)))
     {
         drb2_groub.DataSource    = ds.Tables["x"];
         drb2_groub.DisplayMember = "group_id";
     }
     drb2_groub.Text = "";
 }
 void clear4()
 {
     clear2();
     using (DataSet ds = DataManger.GetDataSet("stud_selectbygroupid", "x", new SqlParameter("@group_id", cmb_group3.Text)))
     {
         cmb_name.DataSource    = ds.Tables["x"];
         cmb_name.DisplayMember = "stud_name";
         cmb_name.ValueMember   = "stud_id";
     }
     flag2         = true;
     cmb_name.Text = "";
 }
 private void cmb1_class_SelectedIndexChanged(object sender, EventArgs e)
 {
     clear2();
     flag = false;
     using (DataSet ds = DataManger.GetDataSet("group_selectbyclass", "x", new SqlParameter("@class", cmb1_class.Text)))
     {
         cmb_group3.DataSource    = ds.Tables["x"];
         cmb_group3.DisplayMember = "group_id";
     }
     flag            = true;
     cmb_group3.Text = "";
 }
 private void cmb_group3_SelectedIndexChanged(object sender, EventArgs e)
 {
     clear2();
     if (flag)
     {
         using (DataSet ds = DataManger.GetDataSet("stud_selectbygroupid", "x", new SqlParameter("@group_id", cmb_group3.Text)))
         {
             cmb_name.DataSource    = ds.Tables["x"];
             cmb_name.DisplayMember = "stud_name";
             cmb_name.ValueMember   = "stud_id";
         }
     }
     flag2         = true;
     cmb_name.Text = "";
 }
 private void btn_report_Click(object sender, EventArgs e)
 {
     if (clear3())
     {
         skinEngine1.Active = false;
         DataSet ds = DataManger.GetDataSet("absence_selectbymonth", "x",
                                            new SqlParameter("@mon", int.Parse(DateTime.Now.Month.ToString())),
                                            new SqlParameter("@stud_id", int.Parse(stud_id)));
         new Report(ds, stud_id, stud_name, stud_class, stud_group).ShowDialog();
         skinEngine1.Active = true;
     }
     else
     {
         MessageBox.Show("!!من فضلك حدد الطالب", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
        private void btn_update_Click(object sender, EventArgs e)
        {
            if (!btnfinish.Enabled)
            {
                if (clear3())
                {
                    DataManger.ExecuteNonQuery("stud_updatebystudid",
                                               new SqlParameter("@stud_name", txt_studname.Text),
                                               new SqlParameter("@group_id", cmb_studgroup.Text),
                                               new SqlParameter("@stud_id", int.Parse(txt_studid.Text)),
                                               new SqlParameter("@barcode", stud_bar)
                                               );

                    if (DataManger.GetDataSet("stud_selectbyid", "x", new SqlParameter("@stud_id", int.Parse(txt_studid.Text))).Tables["x"].Rows.Count > 1)
                    {
                        DataManger.ExecuteNonQuery("stud_updatebystudid",
                                                   new SqlParameter("@stud_name", stud_name),
                                                   new SqlParameter("@group_id", stud_group),
                                                   new SqlParameter("@stud_id", int.Parse(stud_id)),
                                                   new SqlParameter("@barcode", stud_bar)
                                                   );
                        MessageBox.Show("!!كود الطالب محجوز", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    clear4();
                    label21.BackColor = Color.LightGreen;
                    label21.ForeColor = Color.Black;
                    label21.Text      = "تم تعديل الطالب بنجاح.......";
                }
                else
                {
                    MessageBox.Show("!!بيانات الطالب غير كامله", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("!!يجب اتمام عملية الغياب قبل هذه العملية", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }