Exemplo n.º 1
0
        private void dshsgrid_SelectionChanged(object sender, EventArgs e)
        {
            if (dshsgrid.SelectedRows.Count > 0)
            {
                button1.Visible = true;
                button2.Visible = true;
                DataGridViewRow row = dshsgrid.SelectedRows[0];
                txtht.Text    = row.Cells[0].Value.ToString();
                txtclass.Text = row.Cells[1].Value.ToString();
                txtdate.Text  = row.Cells[3].Value.ToString();
                txtaddr.Text  = row.Cells[4].Value.ToString();
                txtmail.Text  = row.Cells[5].Value.ToString();
                txthk1.Text   = row.Cells[6].Value.ToString();
                txthk2.Text   = row.Cells[7].Value.ToString();

                if (row.Cells[2].Value.ToString() == "Nam")
                {
                    namradio.Checked = true;
                }
                else
                {
                    nuradio.Checked = true;
                }
                HSB.GetMaHS(row.Cells[5].Value.ToString());
                txtma.Text = HocSinhDTO.id.ToString();
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool            erro = false;
            DataGridViewRow row  = DShsgridview.SelectedRows[0];
            string          mail = row.Cells[4].Value.ToString();

            HSB.GetMaHS(mail);
            string ML = "";

            foreach (var i in clasDTO.lop)
            {
                if (Classcombo.SelectedItem.ToString() == i.TenL1)
                {
                    ML = i.MaL1;
                }
            }
            string       mct = ML + HocSinhDTO.id.ToString();
            ChiTietClass ct  = new ChiTietClass(mct, ML, HocSinhDTO.id, 0, 0);

            if (ML != "")
            {
                foreach (var m in ChiTietClass.ctclas)
                {
                    if (mct == m.MaCT1)
                    {
                        erro = true;
                        MessageBox.Show("mã chi tiết lớp đã tồn tại");
                        break;
                    }
                    else
                    {
                        if (m.MaHS1 == HocSinhDTO.id)
                        {
                            erro = true;
                            MessageBox.Show("học sinh đã có lớp");
                            break;
                        }
                    }
                }
                if (erro == false)
                {
                    HSB.InsertCT(ct);
                    MessageBox.Show("successfull");
                    HSB.Load();
                }
            }
        }
Exemplo n.º 3
0
        private void dshsgrid_SelectionChanged(object sender, EventArgs e)
        {
            if (dshsgrid.SelectedRows.Count > 0)
            {
                subjectoffstudentGrid.Rows.Clear();
                if (UsserrDTO.u.Per == 3)
                {
                    button1.Visible = true;
                    button2.Visible = true;
                }

                DataGridViewRow row = dshsgrid.SelectedRows[0];
                txtht.Text    = row.Cells[0].Value.ToString();
                txtclass.Text = row.Cells[1].Value.ToString();
                txtdate.Text  = row.Cells[3].Value.ToString();
                txtaddr.Text  = row.Cells[4].Value.ToString();
                txtmail.Text  = row.Cells[5].Value.ToString();
                txthk1.Text   = row.Cells[6].Value.ToString();
                txthk2.Text   = row.Cells[7].Value.ToString();

                if (row.Cells[2].Value.ToString() == "Nam")
                {
                    namradio.Checked = true;
                }
                else
                {
                    nuradio.Checked = true;
                }
                HSB.GetMaHS(row.Cells[5].Value.ToString());
                txtma.Text = HocSinhDTO.id.ToString();
                HSB.getdsbd();
                var listmh2 = from l2 in CTMonHoc.mhHS select l2;
                var listmh  = from l in CTMonHoc.mhHS
                              join hk in HocKi.HK on l.MaHK1 equals hk.MaHK1
                              join m in CTMonHoc.mh on l.MaMon1 equals m.MaMon1 select new { m.TenMon1, hk.TenHK1, l.MaHK1, l.Diem15p1, l.Diem1t1, l.DiemCuoiKi1, l.MaHS1 };
                foreach (var list in listmh.ToList())
                {
                    if (list.MaHS1 == HocSinhDTO.id)
                    {
                        DataGridViewRow r = new DataGridViewRow();

                        DataGridViewCell cell = new DataGridViewTextBoxCell();
                        cell.Value = list.TenMon1;
                        r.Cells.Add(cell);
                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = list.TenHK1;
                        r.Cells.Add(cell);
                        string x   = list.MaHK1.ToString();
                        char[] ar  = x.ToCharArray();
                        string nam = ar[1].ToString() + ar[2].ToString() + ar[3].ToString() + ar[4].ToString();


                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = nam;
                        r.Cells.Add(cell);
                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = list.Diem15p1;
                        r.Cells.Add(cell);
                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = list.Diem1t1;
                        r.Cells.Add(cell);
                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = list.DiemCuoiKi1;
                        r.Cells.Add(cell);

                        subjectoffstudentGrid.Rows.Add(r);
                    }
                }
            }
        }