예제 #1
0
        public List <GV> AddGV(string m)
        {
            GV s = new GV();

            for (int i = 0; i < this.l.Count; i++)
            {
                if (this.l[i].MaGV != m)
                {
                    this.l.Add(s);
                }
            }
            return(this.l);
        }
예제 #2
0
파일: Addform.cs 프로젝트: levien98ha/BT_C-
        void Add()
        {
            GV gv1 = new GV()
            {
                MaGV     = txtMGV.Text,
                TenGV    = txtTen1.Text,
                Khoa     = cbKhoa1.SelectedItem.ToString(),
                HocHam   = cbHocHam1.SelectedItem.ToString(),
                HocVi    = cbHocVi1.SelectedItem.ToString(),
                HocPhan  = cbHocPhan1.SelectedItem.ToString(),
                GioiTinh = rNam1.Checked,
                NgaySinh = dateTimePicker2.Value
            };

            this.dataSender(gv1);
        }
예제 #3
0
        public void setData(GV gv1)
        {
            string query1 = "insert into GiangVien (MaGV, TenGV, NgaySinh, GioiTinh, HocHam, HocVi, Khoa) values (" + gv1.MaGV + ",'" + gv1.TenGV + "','" + gv1.NgaySinh + "','" + gv1.GioiTinh + "','" + gv1.HocHam + "','" + gv1.HocVi + "','" + gv1.Khoa + "')";
            string query2 = "insert into Quanhe (MaGV, MaHP) values ('" + gv1.MaGV + "',(select MaHP from HocPhan where TenHP ='" + gv1.HocPhan + "'))";

            dh.ExecuteNonQuery(query1);
            dh.ExecuteNonQuery(query2);
            dataGridView1.DataSource = this.dh.GetList("SELECT TenGV, NgaySinh, GioiTinh, HocHam, HocVi, Khoa, TenHP FROM GiangVien, HocPhan, Quanhe WHERE(GiangVien.MaGV = Quanhe.MaGV AND HocPhan.MaHP = Quanhe.MaHP)");
            int cellnum = 0;
            int rownum  = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                cellnum = cellnum + 1;
                dataGridView1.Rows[rownum].Cells[0].Value = cellnum;
                rownum = rownum + 1;
            }
        }