コード例 #1
0
 public void addGV_dal(Entity.GiangVien gv)
 {
     using (Context m = new Context())
     {
         m.GiangViens.Add(new Entity.GiangVien
         {
             MSGV     = gv.MSGV,
             TenGV    = gv.TenGV,
             NgaySinh = gv.NgaySinh,
             GioiTinh = gv.GioiTinh,
             HocHam   = gv.HocHam,
             HocVi    = gv.HocVi,
             Khoa     = gv.Khoa,
         });
         m.SaveChanges();
     }
 }
コード例 #2
0
ファイル: Context.cs プロジェクト: HuyLuuVan/CSharp-Winform
            protected override void Seed(Context context)
            {
                Entity.GiangVien gv1 = new Entity.GiangVien();
                gv1.MSGV     = "GV001";
                gv1.TenGV    = "Nguyễn Thu Thảo";
                gv1.GioiTinh = false;
                gv1.HocHam   = "Giáo sư";
                gv1.NgaySinh = Convert.ToDateTime("1997-12-12");
                gv1.HocVi    = "Tiến sĩ";;
                gv1.Khoa     = "CNTT";

                Entity.HocPhan hp1 = new Entity.HocPhan();
                hp1.MSHP  = "HP001";
                hp1.TenHP = "Lập trình Java";

                Entity.GV_HP gv_hp1 = new Entity.GV_HP();
                gv_hp1.MSGV = "GV001";
                gv_hp1.MSHP = "HP001";

                context.GiangViens.Add(gv1);
                context.HocPhans.Add(hp1);
                context.GV_HPs.Add(gv_hp1);
                context.SaveChanges();
            }
コード例 #3
0
 public void addGV_bll(Entity.GiangVien gv)
 {
     dal.addGV_dal(gv);
 }