예제 #1
0
        public void editstudent() // load du lieu duoc nhap vao form2  cho sv
        {
            SV s = BLL_QLSV.Instance.FindSVWithMSSV(MSSV);

            MSSVBox.Text          = s.MSSV;
            MSSVBox.Enabled       = false;
            NameBox.Text          = s.NameSV;
            LopSH.SelectedIndex   = Convert.ToInt32(s.ID_Lop);
            dateTimePicker1.Value = s.NS;
            if (s.Gender == true)
            {
                male.Checked = true;
            }
            else
            {
                female.Checked = true;
            }
        }
예제 #2
0
        private SV getSV() // lay du lieu cua sv tu form 2
        {
            SV s = new SV();

            s.MSSV   = MSSVBox.Text;
            s.NameSV = NameBox.Text;
            s.ID_Lop = ((CBBItiem)LopSH.SelectedItem).value;
            s.NS     = dateTimePicker1.Value;
            if (male.Checked == true)
            {
                s.Gender = Convert.ToBoolean(male.Checked);
            }
            else
            {
                s.Gender = Convert.ToBoolean(female.Checked);
            }
            return(s);
        }
예제 #3
0
        public void editsv(SV s) // edit sv thu count thanh sv s
        {
            List <SV> listsv = new List <SV>();

            foreach (DataRow row in CSDL.Instance.DTSV.Rows)
            {
                listsv.Add(GetSV(row));
            }
            int count = 0;

            foreach (var i in listsv)
            {
                if (listsv[count].MSSV == s.MSSV)
                {
                    listsv[count] = s; // gan gia tri sinh vien thu count thanh sinh vien s sau khi da thay doi
                    break;
                }
                count++;
            }
            CSDL.Instance.setSV(listsv);
        }
예제 #4
0
        public void deletesv(SV s)
        {
            List <SV> listsv = new List <SV>();

            foreach (DataRow row in CSDL.Instance.DTSV.Rows)
            {
                listsv.Add(GetSV(row));
            }
            //tu dau den day dung de add 1 listsv moi de su dung trong ham delete
            int count = 0;

            foreach (var i in listsv)
            {
                if (listsv[count].MSSV == s.MSSV)
                {
                    listsv.RemoveAt(count); // xoa sinh vien vi tri count trong listsv
                    break;
                }
                count++;
            }
            CSDL.Instance.setSV(listsv); // ham dung de add listsv vao datarow
        }