Exemplo n.º 1
0
 public SinhVien()
 {
     InitializeComponent();
     dal   = new SinhVienDAL();
     lobll = new LopBLL();
 }
Exemplo n.º 2
0
        private void Cmb2_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = 0;

            if (Program.mGroup.Equals("PGV"))
            {
                try
                {
                    Program.servername = cmb2.SelectedValue.ToString();
                    if (Program.servername.Equals(Program.tenServerDN))
                    {
                        Program.mlogin   = Program.mloginDN;
                        Program.password = Program.passwordDN;
                        DataConnection dc = new DataConnection();
                        //MessageBox.Show(Program.mloginDN);
                        //load
                        lobll = new LopBLL();
                        ShowAllLop();
                        Program.maLopSub = dataGridView1.Rows[0].Cells["MALOP"].Value.ToString();
                        dal = new SinhVienDAL();
                        ShowSinhVien();


                        int index1 = gridView1.FocusedRowHandle;
                        if (index1 >= 0)
                        {
                            txtmasv.Text = gridView1.GetRowCellValue(0, "MASV").ToString();
                            txtho.Text   = gridView1.GetRowCellValue(0, "HO").ToString();
                            txtten.Text  = gridView1.GetRowCellValue(0, "TEN").ToString();
                            //txtmalop.Text = gridView1.GetRowCellValue(index, "MALOP").ToString();
                            txtmalop.Text = dataGridView1.Rows[index].Cells["MALOP"].Value.ToString();
                            if (gridView1.GetRowCellValue(0, "PHAI").ToString().Equals("True"))
                            {
                                txtphai.SelectedIndex = 0;
                            }
                            else
                            {
                                txtphai.SelectedIndex = 1;
                            }
                            txtdate.Text    = gridView1.GetRowCellValue(0, "NGAYSINH").ToString();
                            txtnoisinh.Text = gridView1.GetRowCellValue(0, "NOISINH").ToString();
                            txtdiachi.Text  = gridView1.GetRowCellValue(0, "DIACHI").ToString();
                            txtghichu.Text  = gridView1.GetRowCellValue(0, "GHICHU").ToString();
                            if (gridView1.GetRowCellValue(0, "NGHIHOC").ToString().Equals("True"))
                            {
                                txtnghihoc.SelectedIndex = 0;
                            }
                            else
                            {
                                txtnghihoc.SelectedIndex = 1;
                            }
                        }
                    }
                    else
                    {
                        Program.mlogin   = Program.remotelogin;
                        Program.password = Program.remotepassword;
                        DataConnection dc = new DataConnection();


                        //Program.KetNoi();
                        lobll = new LopBLL();
                        ShowAllLop();
                        Program.maLopSub = dataGridView1.Rows[0].Cells["MALOP"].Value.ToString();
                        dal = new SinhVienDAL();
                        ShowSinhVien();


                        int index1 = gridView1.FocusedRowHandle;
                        if (index1 >= 0)
                        {
                            txtmasv.Text = gridView1.GetRowCellValue(0, "MASV").ToString();
                            txtho.Text   = gridView1.GetRowCellValue(0, "HO").ToString();
                            txtten.Text  = gridView1.GetRowCellValue(0, "TEN").ToString();
                            //txtmalop.Text = gridView1.GetRowCellValue(index, "MALOP").ToString();
                            txtmalop.Text = dataGridView1.Rows[0].Cells["MALOP"].Value.ToString();
                            if (gridView1.GetRowCellValue(0, "PHAI").ToString().Equals("True"))
                            {
                                txtphai.SelectedIndex = 0;
                            }
                            else
                            {
                                txtphai.SelectedIndex = 1;
                            }
                            txtdate.Text    = gridView1.GetRowCellValue(0, "NGAYSINH").ToString();
                            txtnoisinh.Text = gridView1.GetRowCellValue(0, "NOISINH").ToString();
                            txtdiachi.Text  = gridView1.GetRowCellValue(0, "DIACHI").ToString();
                            txtghichu.Text  = gridView1.GetRowCellValue(0, "GHICHU").ToString();
                            if (gridView1.GetRowCellValue(0, "NGHIHOC").ToString().Equals("True"))
                            {
                                txtnghihoc.SelectedIndex = 0;
                            }
                            else
                            {
                                txtnghihoc.SelectedIndex = 1;
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            st.Clear();
        }